Postscript as a target language? (Al Stavely)
Sun, 8 Aug 1993 20:19:15 GMT

          From comp.compilers

Related articles
Postscript as a target language? (1993-08-08)
Re: Postscript as a target language? (1993-08-09)
Re: Postscript as a target language? (1993-08-09)
Re: Postscript as a target language? (1993-08-09)
Re: Postscript as a target language? (Chris DONAWA) (1993-08-09)
Re: Postscript as a target language? (1993-08-10)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Al Stavely)
Keywords: courses, question, comment
Organization: New Mexico Tech, USA
Date: Sun, 8 Aug 1993 20:19:15 GMT

Every year I teach a compiler course here, a fairly standard first course
in which students implement a whole (simple) compiler as a group project.
Usually, the target language is the assembly language for the machines
that our computer center happens to be running at the time. For reasons
which I don't want to explain here, I can't do that this year. I'm
searching for a different target language.

I've considered C, and also various intermediate-level languages or
artificial machine languages for which I might be able to find freeware
interpreters. More likely possibilities might be awk and FORTRAN. What
I'm leaning toward at the moment is... Postscript! After all, in some
ways it's similar to the machine language for a rather abstract stack
architecture -- in fact, it's just the machine language of a lot of
computers that happen to have printers wrapped around them. We could
execute it directly in a printer to produce output (!), or "interpret" it
using any of the various previewers around.

Some advantages might be:

- we already have all the software we'd need
- our students might already have some familiarity with it
- the subset I'd use would have a clean and simple semantics
- it would be farther away from the source language than C would be

A disadvantage might be that it's still at a rather high level, so that the
project wouldn't be as "realistic" an exercise than translating into
assembler. But maybe that's not so bad, at least for a first course.

Is this a completely silly idea? Does anyone have any thoughts on this, or
any experiences to share?
- Allan Stavely, New Mexico Tech, USA
[Makes sense to me. The first compiler I wrote, for a course assignment,
turned APL into Basic. Worked, too. I wrote it in Trac, but that's a
separate issue. The only problem with Postscript is that as a stack
language, it doesn't give you a place to do register allocation. -John]

Post a followup to this message

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