COMPUTER SCIENCE AND ENGINEERING
COMPILER DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Only terminals and non-terminals
|
|
Only a set of productions
|
|
Only a start symbol
|
|
All the above
|
Detailed explanation-1: -Context-free grammars consist of terminals (w1, w2, …, wV), nonterminals (N1, N 2, …, Nn), a start symbol (N1), and rules. Terminal symbols represent context that appear in the strings generated by the grammar. Nonterminal symbols are placeholders for patterns of terminal symbols that can be generated by nonterminals.
Detailed explanation-2: -A context free grammar (CFG) is a forma grammar which is used to generate all the possible patterns of strings in a given formal language. It is defined as four tuples − G=(V, T, P, S) G is a grammar, which consists of a set of production rules.
Detailed explanation-3: -In general a context-free grammar G is a 4-tuple (V, , R, S) where V is a set of variables, is an alphabet of terminal symbols, R is a set of rules, and S is a start symbol. The elements of V − are called nonterminals and are analogous to parts of speech.