COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
For a context-free grammar, left hand side of production rules should contain
A
Single nonterminal
B
Set of both terminals and nonterminals
C
Set of terminals
D
None of the other options
Explanation: 

Detailed explanation-1: -N is a set of non-terminal symbols. T is a set of terminals where N ∩ T = NULL. P is a set of rules, P: N → (N ∪ T)*, i.e., the left-hand side of the production rule P does have any right context or left context.

Detailed explanation-2: -Terminals = symbols of the alphabet of the language being defined. ◆ Variables = nonterminals = a finite set of other symbols, each of which represents a language. ◆ Start symbol = the variable whose language is the one being defined.

Detailed explanation-3: -P is a set of production rules, which is used for replacing non-terminals symbols(on the left side of the production) in a string with other terminal or non-terminal symbols(on the right side of the production). S is the start symbol which is used to derive the string.

Detailed explanation-4: -A set of nonterminal symbols (or variables) which are placeholders for patterns of terminal symbols that can be generated by the nonterminal symbols. These are the symbols that will always appear on the left-hand side of the production rules, though they can be included on the right-hand side.

Detailed explanation-5: -A set of non-terminals (V). Non-terminals are syntactic variables that denote sets of strings. A set of tokens, known as terminal symbols (). A set of productions (P). One of the non-terminals is designated as the start symbol (S); from where the production begins.

There is 1 question to complete.