COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
....grammar can have more than one parse tree generating a given string of a terminals.
A
Ambiguous
B
Context free grammer
C
Context sensitive
D
Unambiguous
Explanation: 

Detailed explanation-1: -Ambiguous Grammars A grammar for which there are two different parse trees for the same terminal string is said to be ambiguous. We can prove this grammar is ambiguous by demonstrating two parse trees for the same terminal string.

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

Detailed explanation-3: -If a string has more than one parse tree in a given grammar, that grammar is called ambiguous.

Detailed explanation-4: -A grammar in which multiple rightmost (or leftmost) derivations exist for a sentence is called an ambiguous grammar. An ambiguous grammar can produce multiple derivations and multiple parse trees.

There is 1 question to complete.