Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Sets:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Project]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaneous:
[2001S]
[98F]
[SamR]
[Glimmer Labs]
Summary: In today's lab, you will explore the translation of Stupid, Sam's Totally Unintelligble Program Instruction Doohicky, to PAL, the pseduo-assembly language that I've written (okay, started to write) as an intermediate language for your compilers.
Warning: Stupid, the Stupid translator, PAL, and this lab are under development. All of them probably have many bugs. Let me know which ones you notice.
Collaboration: Feel free to work on this lab in pairs or trios.
Turning It In: You do not need to turn in this lab. It is intended primarily for your edification.
Grading: Since you're not going to turn it in, I'm not going to grade it (not that I usually grade things anyway).
Supporting Files:
Setup:
Make a copy of the Stupid directory.
For example, you could execute the following instruction.
% cp -r /home/rebelsky/Web/Courses/CS362/2002F/Examples/Stupid .
Stupid, Sam's Totally Unintelligible Programing Instruction Doohicky,
is a sample programming language I've written (okay, that I'm writing)
as an example of various issues we've discussed in class. You can learn
about the syntax of the language from
StupidParser.java.
You should be able to figure out the meaning of most parts of the language
from the grammar.
a. Scan through the programs in the Examples subdirectory.
See if you can determine what each one should do.
b. Execute each in turn with
% java Stupid Examples/____.stupid
Update the translateExpression method in
StupidTranslator.java to handle subtraction,
multiplication, and division in addition to addition.
Test your changes.
a. Update the translateAssignment method in
StupidTranslator.java so that it coerces from
integers to reals and from reals to integers. You should
find the PAL instruction I2F and F2I
useful.
b. Update the translateExpression method in
StupidTranslator.java so that it coerces from
integers to reals whentever an operation is applied to an
integer and a real.
Monday, 2 December 2002 [Samuel A. Rebelsky]
Tuesday, 3 December 2002 [Samuel A. Rebelsky]
Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Sets:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Project]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaneous:
[2001S]
[98F]
[SamR]
[Glimmer Labs]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue Dec 10 08:53:35 2002.
The source to the document was last modified on Tue Dec 3 09:15:00 2002.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS362/2002F/Labs/lab.13.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby