Re: Compilers in six hours

cytron@kato.wustl.edu (Ron Cytron)
Wed, 25 May 1994 15:25:31 GMT

          From comp.compilers

Related articles
[6 earlier articles]
Re: Compilers in six hours anton@mips.complang.tuwien.ac.at (1994-05-19)
Re: Compilers in six hours chase@Think.COM (1994-05-19)
Re: Compilers in six hours hbaker@netcom.com (1994-05-20)
Re: Compilers in six hours monnier@di.epfl.ch (Stefan Monnier) (1994-05-22)
Re: Compilers in six hours munk@prl.philips.nl (1994-05-24)
Re: Compilers in six hours li@marcus.cs.umn.edu (1994-05-24)
Re: Compilers in six hours cytron@kato.wustl.edu (1994-05-25)
Re: Compilers in six hours hobbs@gemmax.zko.dec.com (1994-05-26)
| List of all articles for this month |

Newsgroups: comp.compilers
From: cytron@kato.wustl.edu (Ron Cytron)
Keywords: courses
Organization: Washington University in St. Louis
References: 94-05-066 94-05-101
Date: Wed, 25 May 1994 15:25:31 GMT

I have students in the first course translate from a C-like language
(extended with nested procedures, and the Algol-68 "everything has a
value" semantics, but cut back on data types and constructs) to a
Scheme-like language. In the target language, the atomic unit of
execution is an Expression, and each has a:


  (PushLevel n (LinkExpression k)
      (Args (SymbolID s1)
                  (SymbolID s2)
                    ...
      )
      (Locals (SymbolID l1)
                      (SymbolID l2)
              ...
      )
  )


which declares the static nesting depth (n), the next outer scope (k), and
the arguments and locals associated with this expression.


I find this an easy target for a one-semester course, and I provide an
interpreter for it, so students can watch their programs execute.


This could be followed up with some low-level code generation, probably
using iburg, or could be the subject of program optimization, which I
teach in a second course.


The next time I teach the first course, I may short-change parsing
somewhat to cover the code generation, so the students do get a feeling
for low-level code issues.


The run-time library is written in this intermediate language, by the way.


There's tech report I could send interested people on this intermediate
language (which I call FrIL).


  Ron Cytron
  Washington University
--


Post a followup to this message

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