COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A grammar that produces only one parse tree for some sentence is said to be ____
A
Regular
B
Irregular
C
Ambiguous
D
Unambiguous
Explanation: 

Detailed explanation-1: -A context-free grammar is called unambiguous grammar if there exists one and only one derivation tree or parse tree. Hence the correct answer is Ambiguous.

Detailed explanation-2: -A grammar is said to be ambiguous if there exists more than one leftmost derivation or more than one rightmost derivation or more than one parse tree for the given input string. If the grammar is not ambiguous, then it is called unambiguous.

Detailed explanation-3: -A grammar for which there are two different parse trees for the same terminal string is said to be ambiguous.

Detailed explanation-4: -A grammar can be unambiguous, if the grammar does not contain ambiguity. This means if it does not contain more than one left most derivation (LMD) or more than one right most derivation (RMD) or more than one parse tree for the given input string, it is an unambiguous grammar.

There is 1 question to complete.