Beginner Compilers & Programming Language Theory
Q6 / 100

What is a context-free grammar used for in compilers?

Correct! Well done.

Incorrect.

The correct answer is B) Specifying the syntactic structure of programming languages, enabling automated parser generation

B

Correct Answer

Specifying the syntactic structure of programming languages, enabling automated parser generation

Explanation

CFGs define programming language syntax: statement → if ( expr ) statement | for ( expr ; expr ; expr ) statement | ... Parser generators (yacc, ANTLR, Bison) automatically build parsers from CFG specifications.

Progress
6/100