Redirected
retagged by
996 views
0 votes
0 votes

Associativity and precedence of operators is defined by grammar. So C should be right.

Please help

retagged by

5 Answers

Best answer
3 votes
3 votes

Actually here u have to draw the tree and associate semantic rule and work accordingly..

However as the grammar is ambiguous as clear from the grammar , so we can construct the parse tree in other way too i.e. taking E --> E ↑ E at the topmost level so in that case we will get A) as correct option..Hence both are true..

Hence option C) is correct answer..

selected by
0 votes
0 votes
Option b cannot be the answer because * is having higher precedence than | symbol.So * should be evaluated first.

Hence the answer is option a.
0 votes
0 votes
A is correct answer , travel the tree from bottom to up , first (a) will be printed then (b) then (*) then (c) and at last (!)
0 votes
0 votes
it is ambigous grammar. So we can have two different parse tree

so we can have both the print sequence

C is correct answer here

ona funny note: it is ACEE question.. so be sure that the answer marked is always incorrect

Related questions

1 votes
1 votes
2 answers
4
Lakshay Kakkar asked Nov 20, 2017
795 views
What is the correct answer to this problem? In the key, the answer is given as A but I'm getting C. Please tell me why it is so. Thanks.