Re: Teaching compiler courses

Daniel L. McCue <>
Wed, 20 Nov 91 16:43:24 GMT

          From comp.compilers

Related articles
Teaching compiler courses (1991-11-15)
Re: Teaching compiler courses (Daniel L. McCue) (1991-11-20)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Daniel L. McCue <>
Keywords: courses
Organization: Compilers Central
References: 91-11-057
Date: Wed, 20 Nov 91 16:43:24 GMT (Jim Kadin) writes:

>I am teaching an undergraduate compiler writing course and I would like
>some pointers as to what target language to use for the students'

>Our source language is a subset of Pascal. We will be implementing the
>compilers in C on Sun workstations.

>I've been thinking of using the USCD P-code machine for the target

>Is this a good idea?


I was faced with the same dilemma for my compiler course this term.

I had the following bias:

I didn't want to have the students generate p-code or such-like since
I wanted them to consider register allocation etc.

I didn't want to have them target a real machine (or simulator for a
real machine) because
      a) it's *TOO* realistic - you get all the warts of a real machine and
      b) unless there was a good simulator for it, the students would have
            no help debugging their generated code.

Here's how I solved it:

I designed a simple general register machine - a few dozen instructions, a
couple of addressing modes, no floating-point. I wrote an assembler for
the this machine that generates "a.out" files and a simulator that
provides a graphical display of memory, registers and instructions as the
program is executed.

The code is in C++ and uses X-Windows (through InterViews) for the
displays. The documentation is extremely limited :) Since time was short,
the code is not exactly a polished example of C++ programming, InterViews
programming, asssembler design or simulator design, but it works. I
ported it without difficulty from my Sun workstation to an Encore Multimax
for the students to use. I don't know how portable it is otherwise.

You're welcome to the code.
Send mail if interested to


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.