Re: [Haskell] Compiler Construction course using Haskell?

Hi Johannes,
There is a similar course in Chalmers. The home page is here:
http://www.cs.chalmers.se/Cs/Grundutb/Kurser/progs/current/
There students were required to implement full parser, partial
typechecker and partial interpreter for C++ in either C++, Java or
Haskell. We used BNFC for the parser:
http://www.cs.chalmers.se/Cs/Research/Language-technology/BNFC/
which was easier for most students I think. In any way I would
recomend Happy+Alex or BNFC instead of Parsec but this is only my
personal preference.
Best Regards,
Krasimir
2008/8/20 Johannes Waldmann
Hello.
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?
If I really decide to do it, then slides (in German) will be made available.
Best regards, J.W.
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell

Similar course at UNSW, http://www.cse.unsw.edu.au/~cs3161/ type checker, type inference and interpreter + proofs. kr.angelov:
Hi Johannes,
There is a similar course in Chalmers. The home page is here:
http://www.cs.chalmers.se/Cs/Grundutb/Kurser/progs/current/
There students were required to implement full parser, partial typechecker and partial interpreter for C++ in either C++, Java or Haskell. We used BNFC for the parser:
http://www.cs.chalmers.se/Cs/Research/Language-technology/BNFC/
which was easier for most students I think. In any way I would recomend Happy+Alex or BNFC instead of Parsec but this is only my personal preference.
Best Regards, Krasimir
2008/8/20 Johannes Waldmann
: Hello.
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?
If I really decide to do it, then slides (in German) will be made available.
Best regards, J.W.
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Thanks for all the pointers. This is very useful. On parsers: yes, LL/LR theory and table-based parsers have been developed for a reason and it's no easy decision to throw them out. Still, even Parsec kind of computes the FIRST sets? And - I positively hate preprocessors. I really want my domain specific languages embedded because I want to use Haskell's types, functions, modules etc. for the domain specific objects (parsers, AST walkers, etc.) Best regards, J.W.

On Wed, 20 Aug 2008, Johannes Waldmann wrote:
On parsers: yes, LL/LR theory and table-based parsers have been developed for a reason and it's no easy decision to throw them out. Still, even Parsec kind of computes the FIRST sets?
No, it doesn't. That's not actually possible for monadic parsers as they support context-sensitive languages and have no means of telling them from context-free ones. -- flippa@flippac.org "I think you mean Philippa. I believe Phillipa is the one from an alternate universe, who has a beard and programs in BASIC, using only gotos for control flow." -- Anton van Straaten on Lambda the Ultimate

Dear Johannes, Besides the IPT course, we also teach a course hat used to be called grammars and parsing. This course is taken before the compiler construction course. In this course we deal with parser combinators, datatypes, folds, first and follow, LL(1), and some more stuff, all in Haskell. The lecture notes are available from the webpage for the course: http://www.cs.uu.nl/docs/vakken/gont/literatuur.html The web page is in Dutch, but the lecture notes are in English. All the best, Johan On 20 Aug 2008, at 21:47, Johannes Waldmann wrote:
Thanks for all the pointers. This is very useful.
On parsers: yes, LL/LR theory and table-based parsers have been developed for a reason and it's no easy decision to throw them out. Still, even Parsec kind of computes the FIRST sets?
And - I positively hate preprocessors. I really want my domain specific languages embedded because I want to use Haskell's types, functions, modules etc. for the domain specific objects (parsers, AST walkers, etc.)
Best regards, J.W.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (5)
-
Don Stewart
-
Johan Jeuring
-
Johannes Waldmann
-
Krasimir Angelov
-
Philippa Cowderoy