Question: Homework from Programming Language Processor class... I really need help with the codes Thank you very much! This is figure 1. hint: Question 2 Answer
This is figure 1. 

Question 2 Answer the following questions to add the following repeat-until statement to PL/0. Production rule statement + repeat statement until condition Action A statement 'repeat statement until condition' works as follows. 1. Execute statement. 2. If the value of condition is false, go to the step 1. Otherwise, exit this loop. Question 2-1 Write object codes for the repeat-until statement like object codes for the do-while statement of Fig.1. Question 2-2 Modify getSource.h and getSource.c to register two tokens repeat and until to your PL/O'compiler. Explain the modification in your report, labell: Object codes of statement Object codes of condition jpc label2 jmp labeli label2: Figure 1: Object codes for a do-while statement Statement then statemene Statement - if rendition Statement it condition do | Stutcmene while - condition Statement - repent statement then statement centile condition staterberg else statement - condition then - Statement y aller fotien port is 1 uest False ntrod tions do statement while condition luct ni 1 TRU A Grammar to a Recursive Descendent Parser (1/4) (1) We combine production rules Ay, Aa, ..., Aan into a production rule A ala, ... an. We describe a{ba} as {a//B}. (2) We translate each combined rule A-a into a procedure A(). void A() { - T(a) TO) is a procedure which translates a symbol sequence a into procedures
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
