Homework Programming Language Processor Class Really Need Help Codes Thank Much Q43828128
Homework from programming language processor class… I really needhelp with the codes… Thank you very much
Question 3 Answer the questions to add the followig if-then-else statement the if-then statement with the optional else clause) to PL/0. Production rule statement if condition then statementi (else statement Action A statement ‘if condition then statement; (else statemental) works as follows. 1. Evaluate condition. 2. If the value of condition is true, execute statement; 3. If the value of condition is false and statement, exists, execute statement Description To resolve ambiguity of the grammar of PL/O’, we use the follow ing rule. . When we find an else, we relate the else to the nearest then which has not be related to any else yet. Question 3-4 Fig.6 and Fig. 7 show a test program else.pl0 and its output respectively. Write the output of else.plo compiled by your PL/0′ compiler in your report, var x; % ./plod else.pl begin start compilation x := 0; start execution while x<3 do begin if x < 1 then write 0 else if x < 2 then write 1 2 else write 2; writeln; x := x+1; end; end Figure 6: A test program else.plo Figure 7: The output of else.pl Show transcribed image text Question 3 Answer the questions to add the followig if-then-else statement the if-then statement with the optional else clause) to PL/0. Production rule statement if condition then statementi (else statement Action A statement ‘if condition then statement; (else statemental) works as follows. 1. Evaluate condition. 2. If the value of condition is true, execute statement; 3. If the value of condition is false and statement, exists, execute statement Description To resolve ambiguity of the grammar of PL/O’, we use the follow ing rule. . When we find an else, we relate the else to the nearest then which has not be related to any else yet. Question 3-4 Fig.6 and Fig. 7 show a test program else.pl0 and its output respectively. Write the output of else.plo compiled by your PL/0′ compiler in your report, var x; % ./plod else.pl begin start compilation x := 0; start execution while x
Expert Answer
Answer to Homework from programming language processor class… I really need help with the codes… Thank you very much …
OR