in Compiler Design retagged by
321 views
1 vote
1 vote

If i am wrong please let me correct with giving proper explanation.

in Compiler Design retagged by
321 views

1 Answer

2 votes
2 votes
Best answer

Yes, Correct! but a string can not ambiguous. Though given grammar is ambiguous!

A grammar will be called ambiguous if can generate more than one parse tree/Left most derivations/Right most derivations for same string.

One more point to be noticed here is that, in first parse tree, left id*id will be evaluated first while in second parse tree id+id will be evaluated first,

selected by

4 Comments

Means 2&4 both options are correct

0
0
i think 4th is only answer.
1
1
But here in option 2 two parse tree are possible then why not option 2.

please reply...
0
0
As i earlier mentioned in my solution, both parse trees are not same, as in first tree * will be evaluated first and in second tree, + will be evaluated first.
1
1