COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which grammar gives multiple parse trees for the same string?
A
Unambiguous
B
Regular
C
Ambiguous
D
All of the above
Explanation: 

Detailed explanation-1: -Answer:Ambiguous GrammarsA grammar for which there are two different parse trees for the same terminal string is said to be ambiguous.

Detailed explanation-2: -A grammar that produces more than one parse tree for some sentence is said to be ambiguous.

Detailed explanation-3: -Parsing ambiguous grammars using LR parser-GeeksforGeeks.

Detailed explanation-4: -Definition: A grammar is called ambiguous if there is a string for which there is more than one parse tree in the grammar.

Detailed explanation-5: -In computer science, an ambiguous grammar is a context-free grammar for which there exists a string that can have more than one leftmost derivation or parse tree. Every non-empty context-free language admits an ambiguous grammar by introducing e.g. a duplicate rule.

There is 1 question to complete.