a2 - CIS 755, Assignment #2 Due: 24 April '06 1. (4...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 755, Assignment #2 Due: 24 April ’06 1. (4 points). Consider the IMP language whose translational semantics we defined in class. Suppose we revise IMP to be a block structured language (but no procedures or functions). So a h prog i is a h block i (rather than a h command i ); and a (new) alternative for h command i is h block i . A h block i consists of a h decl seq i followed by h stmt seq i and the h decl seq i includes (only) variable declarations. How would you revise the translational semantics of IMP to account for these changes? Note that you cannot any longer use the names of variables as we did because in the same program we may have, in two different blocks or possibly an outer block and a nested block, two different variables declared both called XYZ , so if you were to use XYZ in the assembly language code, it would be ambiguos. Instead, you would have to introduce a sort of symbol table, assign addresses (or something) to the variables, use those addresses in the code you produce. And in the attribute grammar, you would have
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 04/10/2008 for the course CSE 755 taught by Professor Neelamsoundarajan during the Winter '05 term at Ohio State.

Ask a homework question - tutors are online