926 views
1 votes
1 votes
E --> number       {E1.val = number.val}

E --> E+E              {E.val = E.val+E.val}

E --> E*E               {E.val = E.val*E.val}

The  above grammar and the semantic rules are fed to a yacc tool (which is an LALR(1) parser generator) for parsing and evaluating arithmetic expressions. Which one of the following is true about the action of yacc for the given grammar?

A) It detects recursion and eliminates it.

B) It detects RR conflict and resolves in favor of Shift

C) It detects SR conflict and resolves in favor of Reduce

D) It detects SR conflict and resolves in favor of Shift

-----------------------------------------

I have little confusion in drawing the states for such recursive grammers. And what does it mean to resolve a conflict in favour of something???? (It will be very helpful if you also attact pic of state diagram along with the answer) Thnx

1 Answer

Best answer
4 votes
4 votes
Yacc detects SR conflict and resolves in favor of Shift.
Resolves means what it will do on SR conflict.
selected by

Related questions

1 votes
1 votes
2 answers
1
shekhar chauhan asked Jun 5, 2016
1,062 views
Either L attribute or S attributed .What kind of SDT it is ?S ->E# Out('#')E - E+E Out('+')E ->TT - T#F Out('*)T - FF - (E)F - a Out ('a')For the sentence...