The C language is:
2002
The C language is:
- A.
A context-free language
- B.
A context-sensitive language
- C.
A regular language
- D.
Fully parsable only by a Turing machine
Attempted by 7 students.
Show answer & explanation
Correct answer: B
The correct answer is Option B. The grammar used for the syntactic structure of C is largely context-free, but the complete language of valid C programs also includes context-dependent restrictions. For example, an identifier must be declared before use and its use must be compatible with its declared type. Such requirements cannot be captured by a regular language or by a simple context-free grammar alone; in the Chomsky hierarchy this makes the full C language context-sensitive.