Question: Write down the leftmost derivations for the following programs in Arithlang. 1. 342 2. (* 4 2) 3. (- (/ 4 2) 1) 4. (*

Write down the leftmost derivations for the following programs in Arithlang. 1. 342 2. (* 4 2) 3. (- (/ 4 2) 1) 4. (* (-7 1) (+2 4) ) 5. (- 3 (+ 1 1) )

The leftmost derivation is a derivation in which the leftmost available non-terminal is expanded first. For example, the leftmost derivation for (+ 1 2) is: 1. program --> 2. exp --> 3. addexp --> 4. `(' '+' exp (exp)+ ')' --> 5. `(' '+' numexp (exp)+ ')' --> 6. `(' '+' Number (exp)+ ')' --> 7. `(' '+' DIGIT (exp)+ ')' --> 8. `(' '+' 1 (exp)+ ')' --> 9. `(' '+' 1 exp ')' --> 10. `(' '+' 1 numexp ')' --> 11. `(' '+' 1 Number ')' --> 12. `(' '+' 1 DIGIT ')' --> 13. `(' '+' 1 2 ')'

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!