One way of defining the abstract syntax for the expressions of Figure 6.17 is as follows: xpr → expr + expr | expr * expr | number number → digit { digit } digit→ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9...


One way of defining the abstract syntax for the expressions of Figure 6.17 is as follows:


xpr → expr + expr | expr * expr | number


number → digit { digit }


digit→ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9


(a) Why are there no precedences or associativities expressed in this grammar?


(b) Why are there no parentheses in this grammar?


(c) The rule for number is written in EBNF in this grammar, yet we stated in the text that this obscures the structure of the parse tree. Why is the use of EBNF legitimate here? Why did we not use EBNF in the rule for expr?

Nov 20, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here