[Haskell-cafe] Re: [Haskell] Compiler Construction course using Haskell?

Don Stewart dons at galois.com
Wed Aug 20 14:16:52 EDT 2008


chris:
> >>I plan to give a course in compiler construction,
> >>using Haskell as the implementation language
> >>(not as source or target language).
> >>
> >>Something along these lines:
> >>1. combinator parsers (Parsec),
> >>2. simple interpreter (arithmetical expressions)
> >>3. add algebraic data types, functions
> >>4. type checker
> >>5. code generator.
> >>Ideally, 2..5 would be using the very same tree traversal code
> >>and just change the monad for evaluation.
> >>
> >>Any comments appreciated. Have you given such a course? Taken?
> 
> At Utrecht University, they teach excellent courses on exactly this  
> subject, using Haskell. The course webpage [1] is probably a useful  
> resource for you, as it shows exactly what we were thought (I  
> participated in the course last year). We made heavy use of Utrecht's  
> Attribute Grammar Compiler [2], which is a pre-processor for Haskell  
> that allows you to very easily build programs using an attribute  
> grammar. This proved to be a really nice way to do the tree  
> transformations. I very much liked the idea of attribute grammars, but  
> I personally don't like pre-processors very much.
> 
> Also, we targeted Simple Stack Machine as a platform. This is an  
> assembly-like language that has a graphical interpreter, so you can  
> actually see your code, do single-stepping, see your stack, etc. It  
> proved to be quite useful. As a student, I it added a lot of  
> educational value, but a real language would also be cool (e.g. Harpy  
> [4]).

And Language.C

    http://hackage.haskell.org/cgi-bin/hackage-scripts/package/language-c


More information about the Haskell-Cafe mailing list