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:
Verified
Q14: Which of the following describes a handle
Q15: An LALR(1) parser for a grammar G
Q16: Consider the following two statements:
P: Every regular
Q17: Consider the following grammar. S -> S
Q18: A canonical set of items is given
Q19: Consider the grammar defined by the following
Q20: Consider the following grammar:
S ? FR
R ?
Q21: Consider the following translation scheme. S ?
Q22: The grammar A ? AA | (A)
Q23: Consider the grammar S ? (S) |
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents