Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Implementing functional languages: a tutorial (1992) (research.microsoft.com)
118 points by rspivak on Dec 26, 2015 | hide | past | favorite | 10 comments


This seems to be a shorter version of the same author's book from 1987, also available online

http://research.microsoft.com/en-us/um/people/simonpj/papers...

I haven't read the tutorial, but the book is strongly recommended.


They explain it like this:

An earlier book by one of us, [Peyton Jones 1987], covers similar material to this one, but in a less practically oriented style. Our intention is that a student should be able to follow a course on functional-language implementations using the present book alone, without reference to the other. The scope of this book is somewhat more modest, corresponding to Parts 2 and 3 of [Peyton Jones 1987]. Part 1 of the latter, which discusses how a high-level functional language can be translated into a core language, is not covered here at all.


Nothing is said in the abstract about type system. Anyone knows if the subject is covered?

Also, the book is from 1992, which should be added to the title.


We focus exclusively in this book on the ‘back end’ of functional-language compilers. We make no attempt to discuss how to translate programs written in a fully fledged functional language [...] or how to type-check such programs.

(Added the year. Thanks.)


I imagine this would still be useful if compilers like Haskell can produce intermediate code for what's described in the book. Not sure if they do but I have an academic paper that created a G-machine to Forth (CPU) compiler for embedded Haskell. Made me think there was a G-machine output option.

Point being, plenty one can contribute to FP in terms of safety, performance, integration, and so on just knowing backends. Esp if more people do FP CPU's.


There's a "Core" output option which is not far from STG if I remember right.


Here it is:

https://downloads.haskell.org/~ghc/7.6.2/docs/html/users_gui...

The next page references dllthomas's command. Here's the language it outputs:

https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Co...

So, the trick to answer our question is if any knowledgeable readers can tell us whether what's in this guide helps on the path to understanding that language. If so, then it's a start to working with and improving it.


GHC also has a -ddump-stg option (according to `ghc --show-options | grep stg`). I assume it does what it says on the tin...


I've been meaning to read more of this book. The first chapters are great. Now of only I had time...


I realize this was before excellent broadband and before the smartphone, but why gzip a pdf :(




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

Search: