Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'll add my usual comment in discussions about interpreter/compiler books: I'd really love to read a modern book or in-depth tutorial on creating a statically-typed functional language, with discussions on pattern matching, type inference, tail call elimination, ADTs, etc.

There are so many great books out there on how to create a lisp, or a typical mutable object-oriented language, but with one notable exception (that's unfinished), there are no approachable online tutorials/books out there that I've found on building compilers or interpreters for functional languages. Only academic papers, a textbook, and one or two books from 20-30 years ago.

Pierce's Types and Programming Languages is a great textbook that covers all of this material, but from an extremely detailed and formal academic perspective. It would be great to see more approachable tutorials or short books online to complement Pierce's text.

I've started writing my own in-depth tutorial on this subject using Scala as the implementation language, but would love to see other tutorials/books as well.



> I'd really love to read a modern book or in-depth tutorial on creating a statically-typed functional language, with discussions on pattern matching, type inference, tail call elimination, ADTs, etc

I'm interested in that too. I've heard good things about Appel's book [1], but haven't read it yet.

> There are so many great books out there on how to create a lisp, or a typical mutable object-oriented language

For what it's worth, I haven't found much about creating object-oriented languages. There's a lot on Lispy dynamicall-typed languages, but I haven't seen much on things like method dispatch, vtables, inheritance, etc.

One of the reasons I'm writing this book is to try to cover that. Even if you don't like OOP languages, I think it's worth knowing more about how they work under the hood since they are so prevalent in the industry.

> I've started writing my own in-depth tutorial on this subject using Scala as the implementation language

Interesting! Is it online yet?

[1]: https://www.cs.princeton.edu/~appel/modern/ml/


"Modern Compiler Implementation" isn't too bad, but it is a general purpose introductory compiler text rather than being dedicated to functional languages. It does briefly touch on subjects like closure conversion and type inference, but doesn't give working code.

Appel's other compiler book, "Compiling with Continuations", goes into more depth while falling short of being a complete tutorial on writing a compiler for ML.


You might find http://esumii.github.io/min-caml/index-e.html interesting. While not as well-presented as munificent's current effort, it does present a working functional language compiler as a tutorial.


Essentials of Programming Languages doesn't cover all of this, but it's a pretty good start (at least on the interpreter side).


What's the notable exception?


Write you a Haskell by Stephen Diehl:

http://dev.stephendiehl.com/fun/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: