Homework Programming Language Processor Class Really Need Help Thank Much Clear Version Q43828134
Homework from programming language processor class… I really needhelp… Thank you very much
clear version
var i, a[10]; % ./plod array.pl ; start compilation start execution begin 1 :- 9; while i >= 0 do begin a[i] – i. i; 1:- i – 1; end; 1 :- 0; while i < 10 do begin write a[i]; writeln; 1 :- 1 + 1; end; end. Figure 8: array.pl Figure 9: The output of ar- ray.plo Question 4 Answer the following questions to introduce one-dimensional array to PL/ We usume that the first element of an array has index zero and that arrays are allocated over a stack. Question 4-3 A name and an address are registered in a symbol table for a scalar variable. Consider information registered in a symbol table for an array, and modify a structure Table in table.c of which a symbol table consists. Explain the modification in your report. Question 4-4 Introduce the following two instructions loda’ and son into the function execute in codegen.c. Explain the modification in your report. A load Instruction “loda’ A load instruction “loda, level, addr’ works as follows (Fig. 10). 1. Pop a value (inder) from a stack. 2. Push a value of ‘stack displayſlere + addr + indel (val in Fig. 10) to the stack A store instruction ‘stoa A store instruction ‘ston, Icel, addr’ works as follows (Fig.11). 1. Pop a value (na!) from a stack. 2. Pop a value (index) from the stack 3. Set ‘stack display level + addr + inded to the value ral A ll + Fit to page Page View Question 4-3 A name and an address are registered in a symbol table for a scalar variable, Consider information registered in a symbol table for an array, and modify a structure TableE in table.c of which a symbol table consists. Explain the modification in your report. Question 4-4 Introduce the following two instructions “loda’ and ‘stoa’ into the function execute in codegen.c. Explain the modification in your report. A load instruction ‘loda’ A load instruction ‘loda, level, addr’ works as follows (Fig.10). 1. Pop a value (index) from a stack. 2. Push a value of ‘stack(display[level] + addr + index’ (val in Fig.10) to the stack A store instruction ‘stoa’ A store instruction ‘stoa, level, addr’ works as follows (Fig. 11). 1. Pop a value (val) from a stack. 2. Pop a value (index) from the stack. 3. Set ‘stack (display(level + addr + index)’ to the value val name record fo=n → a collision $(x)=h- a yered LICHTTEITA entries with a same hash value Show transcribed image text var i, a[10]; % ./plod array.pl ; start compilation start execution begin 1 :- 9; while i >= 0 do begin a[i] – i. i; 1:- i – 1; end; 1 :- 0; while i
Expert Answer
Answer to Homework from programming language processor class… I really need help… Thank you very much clear version…
OR