Wed, 10 Jun 1998 10:20:48 -0700
US Air Force Academy
> I am planning to teach a "special subjects" class this coming
> fall at the University of St. Thomas entitled "Language
> Structures and Compilers". I would like to give the students
> experience both the Ada and with compilers. I expect that
> few, if any, of them have written a compiler, or part of same,
> before. The proposed class-size is 15 students.
I personally teach the Compiler Theory and Design course here at the
Air Force Academy. I tend to favor teaching concepts before tools
(see e.g. Dennis Frailey's comments in June '98 SIGCSE Bulletin). As
a consequence, my students implement a compiler from scratch in Ada
95 that compiles a subset of Ada 95. We use AdaGIDE/GNAT on Win 95.
> [I personally have been involved with the writing of 4 different
> compilers, two which were "real" and two of which were "toys".
> I am concerned about how big a system I can introduce the
> students to without them getting lost.]
The key thing here seems to be scaling down the language to be
compiled. Last year, I had the students write a complete lexer for
Ada 95. This seemed a bit of overkill, so I'll probably remove the
things we won't be using. Our subset of Ada 95 included:
procedures/subprocedures (no packages/tasks/etc.)
simple types (integer, float -- just need two to have type checking)
array types (no records)
Important note on arrays-- it is much easier to parse array
dereferences if you use square brackets. Is a(3,5) a function call
or an array dereference?
> What textbook would be good?
> What compiler(s) are available in Ada for modification?
Last year I used Crafting a Compiler in C by Fischer and LeBlanc.
The students tended to dislike it, since its examples are all in C
and they were using Ada. This year, I got permission from the
publisher to photocopy the Ada version (Crafting a Compiler).
For our last project, I introduced them to lex/yacc (actually
scaflex/scayacc from the PAL) and we did a short exercise.
Martin C. Carlisle, Asst Prof of Comp Sci,
US Air Force Academy, [log in to unmask]
DISCLAIMER: The content of this message does not
necessarily reflect the opinions of the US Air
Force Academy, or the US government