Computer Science & Electrical Engineering

Compiler Construction – SMD163



Homework assignment 5

1.

Show how the compilation schemes E and S introduced on slides 41 - 51 in the notes for
lecture no. 8 can be extended to describe the translation of the following constructs into 386
assembly language:
2.

Using the definitions for E and S from the slides together with the extensions that you
described in your answers to Question 1, translate the following program into 386 assembly
language.

       tot  =  0;
       j  =  0;
       while (count > j) {
           tot  =  tot + a[j];
           j  =  j + 1;
       }

You may assume that all variables are allocated globally, at symbolic addresses denoted by
their respective names.

Be sure to follow the compilation rules in the same, mechanical fashion that a compiler
would, and do not attempt to optimize the generated assembly code in any way.


Report via email to Subject line: SMD163 - 5.  Deadline is Feb 27, 10:00.





Homework assignments are carried out individually.

Oral discussion is good, copying files is not
!