Question: (2) Derivation and parse tree (55 points) The questions in this section are based on the grammar given in the colored box at right (a)

 (2) Derivation and parse tree (55 points) The questions in this
section are based on the grammar given in the colored box at

(2) Derivation and parse tree (55 points) The questions in this section are based on the grammar given in the colored box at right (a) what is the associativity of the "operator? (5) assign ld = expr points) (b) What is the associativity of the + operator? 55 expr exgr + term I expr - tera I tera points) teca factor I factor * tern (c) For the " and + operators, do they have the same prectdence, does the " operator have greater facter (expe) precedence than +, or does + have greater precedence than +?(5 points) factor is id I nut (d) Using this grammar show a leftmost derivation and a parse tree for the strings in d.1 and d.2. (20) leAAC C points) Show the parse tree as either a graphical tree or a noe a \begin{tabular}{l|l|l} & 1 & 1 \end{tabular} text-based "indented tree". We've done the first one for you as an example of the desired output format. (d.o)1+2prog=>exprexpr+term=>term+termfactor+term =>1+term=>1+factor1+2 1+tertin>1+fictor (d,1)A+3B (d,2)C=(1+A)+B (e) Modify the grammar to add two new operators as follons, (20 points) - A unary minus operator (-) that has precedence higher than any of ", +, or binary minus. - A binary exponentiatios operator () that has precedence higher than unary minus and is right associative. For ecample, the string 7432 woula be interpteted as x(4((3(2)))) which would evaluate to 1.44444444w

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!