...
Theory-of-Computation
December 6, 2023
Finite-Automata
December 6, 2023
Theory-of-Computation
December 6, 2023
Finite-Automata
December 6, 2023

Theory-of-Computation

Question 34

The grammar whose productions are

  → if id then 
  → if id then   else 
  → id := id 

is ambiguous because

A
the sentence
if a then if b then c:=d
B
the left most and right most derivations of the sentence
if a then if b then c:=d
give rise top different parse trees
C
the sentence
if a then if b then c:=d else c:=f
has more than two parse trees
D
the sentence
if a then if then c:=d else c:=f
has two parse trees
Question 34 Explanation: 
We have to generate
“if a then if b then c:=d else c:=f”.
Parse tree 1:

Parse tree 2:
Correct Answer: D
Question 34 Explanation: 
We have to generate
“if a then if b then c:=d else c:=f”.
Parse tree 1:

Parse tree 2:

Leave a Reply

Your email address will not be published. Required fields are marked *