Question: 7. Design a CFG that generates the arithmetic expressions, with t, -, *, (), a, b, c, together with a new terminal symbol for exponentiation

 7. Design a CFG that generates the arithmetic expressions, with t,

7. Design a CFG that generates the arithmetic expressions, with t, -, *, (), a, b, c, together with a new terminal symbol for exponentiation t. Your grammar should be unambiguous, properly associative. More specifically, it should be left associative for addition +, - and multiplication*, right associative for the exponentiation t. (Recall that, being left associa- tive for addition , an expression such as a +b+c should have the unique arsing as the sum of a + b and c.) It should also have a precedence rule embedded in the grammar that is highest for exponentiation, second high- est for multiplication, and finally for addition/subtraction. With addition and subtraction, whichever is left most gets precedence. For example: for the expression The only valid derivation should parse it as such: First, f t g, then etft g: also, c"d, then cd etftg: also a + b and then a + b- .. (You-don't need to prove all the requirements here are satisfied. But if you correctly prove that all the requirements here are satisfied, you will earn extra credit.)

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!