Question: 1. Using the following rewrite rules for arithmetic expressions, draw a derivation tree for the expression 5*3+1+4 . expr expr add-op term | term term
1. Using the following rewrite rules for arithmetic expressions, draw a derivation tree for the expression 5*3+1+4.
| expr | expr add-op term | term |
| term | term mult-op factor | factor |
| factor | ( expr ) | digit-seq |
| add-op | + | - |
| mult-op | * | DIV | MOD |
| digit-seq | digit digit-seq | digit |
| digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
2. Using the following rewrite rules for arithmetic expressions, draw a derivation tree for the expression 5*3+1+4.
| expr | term { add-op term } |
| term | factor { mult-op factor } |
| factor | ( expr ) | digit-seq |
| add-op | + | - |
| mult-op | * | DIV | MOD |
| digit-seq | digit digit-seq | digit |
| digit | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
