-
Consider the following translation scheme:
S → FR
R → *E{print (‘*’); R | ε
E → F + E {print (‘+’); |F
F → (S)| id {print (id. value);}
Here, id is a token that represents an integer and id value represents, the corresponding integer value. For an input ‘2 * 3 + 4’, this translation scheme prints.
-
- 2 * 3 + 4
- 2 * + 3 4
- 2 3 * 4 +
- 2 3 4 + *
- 2 * 3 + 4
Correct Option: D
I figured out the following tree and found the answer will be D. make a tree and perform post order evaluation.