Handout No. 8
CS 4110 Compiler Design
Istvan Simon
Describes the format of the object program output by the
PL compiler, and how to run the object code on the PL abstract machine.
Other Handouts
back
notes
The compiler should output the object code in successive lines, one integer
per line. Comments may follow the integer. Comments are ignored by
the PL interpreter. The default name of the object code should be "in.pl".
A sample in.pl file is provided in ~simon/4110. Copy it to your area and
try it out. This very simple program reads two integers then outputs
the constant 10 and the product of the two integers read. The output of
the executed program goes to a file called "out.pl".
The PL interpreter can be run by invoking the command ~simon/4110/ppl
in the
current directory where your in.pl file resides. It will open this
file, load it into its memory, then run it. Any input read by the PL object
program is read from standard in. For convenience the input dialogue is
also sent to out.pl, so a record of the run of your program(s) can be easily
submitted. You will have to rename out.pl to save a run, for if you run
it again, or another program, the interpreter will clobber the previous
version of out.pl.
If you have comments
or suggestions, email me at simon@csuhayward.edu