The implementation of functional programming languages

So I've started SLPJ's "The implementation of functional programming languages" and these and my reading notes, on-going questions and summary.

Summary

Overall outline.
  • Part I: translate a non-strict FPL (Miranda taken as an example) to a first intermediate representation (enriched lambda calculus), then to lambda calculus.
  • Part II: an implementation of lambda calculus is given.
  • Part III: an efficient implementation is proposed.

Questions

  • Can we skip part II?
  • "It seems than graph reduction is probably less attractive than environment-based approach for language with strict semantic". Why is that? (TODO: check after chapter 11 if we are able to answer this question).
  • "A functional language has a natural representation as a tree". But... "graph reduction". Are we talking about the same thing? An IR with recursion might not be a tree anymore. Or, should we talk about tree reduction?
  • Built-in functions are introduced for efficiency reason. Could we describe them in the high-level without sacrificing speed? Or at least, some rules that they should obey, e.g. HEAD (CONS a b) = a?

Glossary (in order of appearance)

  • Redex: reducible expression, like (+ 2 4). (* (+ 2 4) 8) isn’t.
  • Beta-reduction. Cute name for function application in the realm of lambda calculus.
  • Beta-abstraction. Reverse rule.
  • Beta-conversion = covers both.
  • Alpha-conversion = renaming (e.g. \x.x+1 ⇔ \y.y+1)

Exercices

The book doesn't propose exercices, let's extract ones.
  • Express CONS, HEAD, TAIL as lambdas. Solution page 17.

Comments