views:

31

answers:

1

Which are the resources on implementation of interpreters/compilers for functional languages? I would like practical examples, and I already have a copy of The Implementation of Functional Programming Languages.

+2  A: 

"The Implementation of Functional Languages" is indeed a good resource. Here are a few that I can think of.

  • Simon Peyton Jones' list of papers is a treasure trove for someone who wants to know more about compiling functional languages. And it's free! Read them all and you might find that you don't need another resource. Plus these papers all come with a practical example: GHC :-). Link: http://research.microsoft.com/en-us/um/people/simonpj/papers/papers.html
  • "Compiling with Continuations" by Andrew Appel. It's a bit dated by now but still somewhat helpful. Lots of code in there.
  • "Modern Compiler Implemention" by Andrew Appel. The only general compiler book that I know of that at least provide some details as to implement functional languages. The material is still not very deep, but the book as a whole is pretty decent and I can recommend it as a general compiler book.

Good luck!

svenningsson
Which version of Miranda does the book use? Because it use data instead ::= and type instead ==. What about: > pprAExpr :: CoreExpr -> String> pprAExpr e = isAtomicExpr e | pprExpr e> pprAExpr e = otherwise | "(" ++ pprExpr e ++ ")"| is supossed to be a guard or boolena operator?
Hai
I'm not sure sure what book you are referring to. There are versions of the books by Appel that uses ML (Standard ML to be specific). All of the papers of Simon Peyton Jones that are written later than 1990 uses Haskell. The syntax of Haskell should be straightforward. If you're only familiar with Miranda perhaps this link might be useful:http://www.cs.mu.oz.au/~bjpop/papers/mira2hask.ps.gz
svenningsson
I refer to Implementing functional languages: a tutorial.
Hai
Ok, well I have never programmed in Miranda, I have used Haskell and Gofer. In my experience it is easy to translate the Miranda code used in the book to Haskell, you should even be able to do the translation in your head with a little practice. As for your concrete question I think the vertical bar is used as a guard, just like in Haskell.
svenningsson