Nguyễn Tuyền
New member
The below 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 recursion
B. It detects reduce-reduce conflict and resolves
C. It detects shift-reduce conflict and resolves the conflict in favor of a shift over a reduce action
D. It detects shift-reduce conflict and resolves the conflict in favor of a reduce over a shift action
Code:
E -> number Eval number val
E E .val E .VAL E .val
E # E E .val E .VAL E .val
;
B. It detects reduce-reduce conflict and resolves
C. It detects shift-reduce conflict and resolves the conflict in favor of a shift over a reduce action
D. It detects shift-reduce conflict and resolves the conflict in favor of a reduce over a shift action