----------------------------------------------------------------------

CSE 401: Compilers

[Home] [Admin] [Details] [Help] [Other]

Help / Building PL/0

----------------------------------------------------------------------

On orcas/sanjuan, copy the PL/0 compiler sources into your directory by executing:
    {orcas} (~)% cd
    {orcas} (~)% mkdir cse401
    {orcas} (~)% cd cse401
    {orcas} (~/cse401)% cp -r /cse/courses/cse401/CurrentQtr/pl0_base pl0
Only type what is after the % symbol. I put the fake prompt in to help you understand from which directory you should type each command.
You need to make sure file permissions are correct. First we make sure all files are accessible by you. Next we remove the temptation for others to sneek a peek.
    {orcas} (~/cse401)% chmod -R  u+rwX pl0
    {orcas} (~/cse401)% chmod -R go-rwx pl0
To compile the PL/0 compiler type:
    {orcas} (~/cse401)% cd pl0
    {orcas} (~/cse401/pl0)% make
You may get a few warnings from the C++ compiler; you can ignore these. (The new compiler is fussier than the old one about requiring casts and such.)
Now you must either create a PL/0 program, or use one of the provided samples fib.0 or squares.0, included with pl0_base. To compile a PL/0 program called fib.0 type:
    {orcas} (~/cse401/pl0)% ./plzero fib.0
This will create an assembly language program named fib.s.
The assembly language program created in the previous step will now be the input to the mips simulator called "spim". To get spim running do the following:

1. Add /cse/courses/cse401/CurrentQtr/spim/bin to your PATH. (Depending on the shell you have, you can use setenv or export to do this.)

2. Now you can start spim by typing:
    {orcas} (~/cse401/pl0)% spim
3. You can also start a more user friendly xterm version of spim by typing:
    {orcas} (~/cse401/pl0)% xspim
4. To get your assembly program running, at the spim prompt (after you have started spim), enter:
    {orcas}  (~/cse401/pl0)(spim) load "fib.s"
In the X version you can simply click on the load button, and it will ask you for the file name. After loading your .s file, make it execute by typing:
    {orcas}  (~/cse401/pl0)(spim) run
For more details on running spim or xspim, do the following:

1. Add /cse/courses/cse401/CurrentQtr/spim/man to your MANPATH. (Use setenv or export, whichever you shell allows.)

2. Type:
    {orcas} (~cse401/pl0)% man spim
3. The file /cse/courses/cse401/CurrentQtr/spim/info/spim.ps has all you want to know about spim. Do look at it once. It's a great help!

----------------------------------------------------------------------

401admin@cs.washington.edu (Last modified: 04/28/98)

Netscape-HTML Checked!