Question: (2) Derivation and parse tree (55 points) The questions in this section are based on the prog assign | expr grammar given in the colored

(2) Derivation and parse tree (55 points) The questions in this section are based on the prog assign | expr grammar given in the colored box at right (a) what is the associativity of the * operator? (5 points) (b) What is points) (c) For the " and + operators, do they have the same precedence, does the * operator have greater factor ( expr) precedence than +, or does + have greater precedence than *? ( 5 points) factor id 1 num (d) Using this grammar show a leftmost derivation and a parse tree for the strings in d.1 and d.2. (20 1dABC points) Show the parse tree as either a graphical tree or a text-based "indented tree". We've done the first one for you as an example of the desired output format. (d.0)1+2 progexprexpr+termterm+termfactor+term 1+term>1+factor=>1+2 (d.1) A3B (d.2)C=(1+A)B (e) Modify the grammar to add two new operators as follows. (20 points) - A unary minus operator () that has precedence higher than any of +, or binary minus - A binary exponentiation operator (**) that has preoedence higher than unary minus and is right associative. For example, the string " 143+2 would be interpreted as 1(4((3(2)))) which would evaluate to 1.44444444
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
