Re: Compiler construction projects (Anton Ertl)
12 Jun 2005 21:30:38 -0400

          From comp.compilers

Related articles
Compiler construction projects (Roderick Bloem) (2005-06-02)
Re: Compiler construction projects (TOUATI Sid) (2005-06-02)
Re: Compiler construction projects (Laurence Finston) (2005-06-02)
Re: Compiler construction projects (2005-06-10)
Re: Compiler construction projects (2005-06-12)
Re: Compiler construction projects (Gene) (2005-06-19)
Re: Compiler construction projects (Oliver Bandel) (2005-06-23)
Re: Compiler construction projects (Skandinavisches Seminar) (2005-06-26)
| List of all articles for this month |

From: (Anton Ertl)
Newsgroups: comp.compilers
Date: 12 Jun 2005 21:30:38 -0400
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 05-06-006
Keywords: courses
Posted-Date: 12 Jun 2005 21:30:38 EDT

Roderick Bloem <> writes:
>I am teaching compiler construction for the second time this year, and I
>would like to exchange experiences with others teaching the same course.
> In particular, I would be interested in the details of projects to
>build a compiler: Which source and destionation languages do you use,

Source language: Every year a different one; they are rather minimal,
but with enough features to write useful programs; i.e., the ability
to call functions (e.g., for memory allocation or I/O) and some kind
of aggregate data structures (arrays, records, (Oberon-style)
extensible records/objects, or Lisp-style list cells). I also
typically design that language such that there is something
interesting for the "semantic checker" to do (often with stuff that
cannot be done easily with L-attributed grammars).

You can find the assignments (including the source languages) for the
last six years in <>
(in German).

Destination language: Alpha assembly language (AMD64 in the future).
We have thought about generating JVM code or somesuch now and then,
but have always decided against it because in a compilers course the
students should make contact with the bare metal;

>which implementation language for the compiler, and, especially, which

We use flex, bison, ox and burg/iburg. This means that the
implementation language is C.

Ox is an attributed grammar tool, and we use it because it is
relatively simple and works with lex/yacc (and with some work also
with flex/bison). Unfortunately it is orphaned, it has been
distributed under a non-free license (so nobody else can adopt it),
and I cannot find the author. Does anyone know where I can reach Kurt
M. Bischoff (formerly at Iowa State University)?

Burg/iburg are tree parser generators (used as code generator

>On the tools especially, I would like to hear experiences of people
>using different tools and better tools, perhaps even tools for building
>attributed grammars.

As for better, in the first year we just used yacc/bison without an
attribute grammar tool, and most of the students' compilers failed on
nested constructs (because the students used global variables in the
yacc actions, and did not deal with them properly). So using
something better seems essential, even for such a small project. And
anyway, if they don't learn to use tools in the compilers course at
the university, they will never get the hang of it.

We then looked at Ox, Cocktail and Eli, and finally decided on Ox,
mainly because of its simplicity. Even Ox seems quite heavy-weight
for such a small project. Other tools typically require you to define
an abstract syntax etc.; these are probably good ideas for large
projects, but for tiny ones like our compiler projects they require
just too much overhead.

- anton
M. Anton Ertl

Post a followup to this message

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