Solved

Consider the Following Expression Grammar

Question 24

Multiple Choice

Consider the following expression grammar. The seman-tic rules for expressioncalculation are stated next to each grammar production.
E ? number E.val = number. val
| E '+' E E(1) .val = E(2) .val + E(3) .val
| E '×' E E(1) .val = E(2) .val × E(3) .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 thefollowing 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

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents