What is a context-free grammar (CFG)?
19 views
- A grammar that can only generate regular languages
- A grammar that can generate languages that include context information
- A grammar that can generate languages with context-free rules (Correct Answer)
- A grammar that can generate only natural languages
Explanation
Answer: c) A grammar that can generate languages with context-free rules.
Explanation: A context-free grammar (CFG) is a formal grammar that describes a language by a set of production rules that do not depend on the context of the symbols being generated. In other words, the rules of a CFG only consider the symbols being generated, not their surroundings.