← RGPV CD-501 Theory of Computation December 2024 Solved Question Paper
Question
Write a short note on properties of context-free grammar (any two of Q8).
Asked in: CD-501 | December 2024 | 8(d)
Answer
A context-free grammar is a tuple G=(V,Σ,P,S), with variables V, terminals Σ, productions P and start variable S. Each production has one variable on the left and a string of variables and terminals on the right. The language consists of terminal strings derivable from S.
CFGs express recursive structures, for example S→aSb|ε generates matched a and b blocks. Derivations can be represented by parse trees. A grammar is ambiguous if some generated string has two distinct parse trees; ambiguity is a property of the grammar, and some context-free languages are inherently ambiguous.
Context-free languages are closed under union, concatenation and star, but not under general intersection or complement. Membership and emptiness are decidable; equivalence and ambiguity of arbitrary CFGs are undecidable. CFGs and nondeterministic pushdown automata have equivalent language-recognition power.
Normal forms such as CNF and GNF simplify proofs and algorithms. CFGs are central to programming-language syntax, expression parsing and compiler design. They cannot describe every language: the language of equal counts in three ordered blocks aⁿbⁿcⁿ is not context-free.
← RGPV CD-501 Theory of Computation December 2024 Solved Question Paper
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion