Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write down the leftmost derivations for the following programs in Arithlang. 1.

ID: 3875039 • Letter: W

Question

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 ')'

Explanation / Answer

Write down the leftmost derivations for the following programs in Arithlang.

1. 342

  

-------------------------------------------------------------------------------------------------------------------------------------------------

2. (* 4 2)

1. program -->
2. exp -->
3. mulexp -->
4. `(' '*' exp (exp)+ ')' -->
5. `(' '*' numexp (exp)+ ')' -->
6. `(' '*' Number (exp)+ ')' -->
7. `(' '*' DIGIT (exp)+ ')' -->
8. `(' '*' 4 (exp)+ ')' -->
9. `(' '*' 4 exp ')' -->
10. `(' '*' 4 numexp ')' -->
11. `(' '*' 4 Number ')' -->
12. `(' '*' 4 DIGIT ')' -->
13. `(' '*' 4 2 ')'

------------------------------------------------------------------------------------------------------------------------------------------------------

3. (- (/ 4 2) 1)

---------------------------------------------------------------------------------------------------------------------------------------------------------

4. (* (-7 1) (+2 4) )

  

----------------------------------------------------------------------------------------------------------------------------------------------------------

5. (- 3 (+ 1 1) )

   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote