1)Consider the following translation scheme. S→ ER R→ *E{print ('*'); } R| ε E→ F + E {print ('+'); } | F F→ (S) |id {print (id. value);} Here id is a token that represents an integer ad id. value represents the corresponding integer value. For an input '2 * 3 + 4', this translation scheme prints(a) 2 * 3 + 4 (c) 2 * + 3 4 (c) 2 3 * 4 + (d) 2 3 4 + * 2)Consider the following grammar.S → S * ES → EE → F+EE →FF → idConsider the following LR(0) items corresponding to the grammar above.(i) S → S *.E(ii) E → F. + E(iii) E → F + .EGiven the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar? [1 mark](A) (i) and (ii)(B) (ii) and (iii)(C) (i) and (iii)(D) None of the above
No comments:
Post a Comment