Re: Compiler construction projects

anton@mips.complang.tuwien.ac.at (Anton Ertl)
12 Jun 2005 21:30:38 -0400

          From comp.compilers

Related articles
Compiler construction projects roderick.bloem@ist.tu-graz.ac.at (Roderick Bloem) (2005-06-02)
Re: Compiler construction projects touati@prism.uvsq.fr (TOUATI Sid) (2005-06-02)
Re: Compiler construction projects lfinsto1@gwdg.de (Laurence Finston) (2005-06-02)
Re: Compiler construction projects torbenm@diku.dk (2005-06-10)
Re: Compiler construction projects anton@mips.complang.tuwien.ac.at (2005-06-12)
Re: Compiler construction projects ressler@usma.edu (Gene) (2005-06-19)
Re: Compiler construction projects oliver@first.in-berlin.de (Oliver Bandel) (2005-06-23)
Re: Compiler construction projects skandgoe@gwdg.de (Skandinavisches Seminar) (2005-06-26)
| List of all articles for this month |
From: anton@mips.complang.tuwien.ac.at (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 <roderick.bloem@ist.tu-graz.ac.at> 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 <http://www.complang.tuwien.ac.at/ublu/skriptum/>
(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
>tools?


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
generators).


>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
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/home.html


Post a followup to this message

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