Help / Building PL/0

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

On the instructional Linux systems (e.g. fiji), copy the PL/0 compiler sources into your directory by executing:
    {fiji} (~)% cd
    {fiji} (~)% mkdir cse401
    {fiji} (~)% cd cse401
    {fiji} (~/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: accessible by you, but not by others.
    {fiji} (~/cse401)% chmod -R  u+rwX,go-rwx pl0
To compile the PL/0 compiler type:
    {fiji} (~/cse401)% cd pl0
    {fiji} (~/cse401/pl0)% make
(You may get a few warnings from the C++ compiler; you can ignore these.) 
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:
    {fiji} (~/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". 

Note: the version of spim reached via the following instructions is an alpha executable, i.e. it runs on orcas/sanjuan, not on linux, so you need to log in there to run the following steps. I believe your home directories are identical on both systems, so you do not need to copies files from one to the other. --- WLR, 10/2/99

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: 

    {sanjuan} (~/cse401/pl0)% spim
3. You can also start a more user friendly xterm version of spim by typing:
    {sanjuan} (~/cse401/pl0)% xspim
4. To get your assembly program running, at the spim prompt (after you have started spim), enter:
    {sanjuan}  (~/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:
    {sanjuan}  (~/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:

    {sanjuan} (~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! 
Would you prefer to work on NT? Althought the same base sources should compile there, you're somewhat on your own. In particular, you should bring files back to Linux for final testing and turnin, so allow a little time for this. Differences in how the two compilers handle uninitialized variables have caused portability problems for some students; MSVC defaults seem to mask uninitialized values.

Rough directions:

Hopefully this should compile with no errors or warnings on MSVC, at least it definitely does on Version 5.0. If there are any problems, or if you need some help, please send mail.