

Compiling to λ-calculus - sindoc
http://matt.might.net/articles/compiling-up-to-lambda-calculus/

======
rpearl
It is interesting that your _compilers_ class targets the lambda calculus.

While we have a thorough curriculum on functional programming at CMU (and for
one class I did write several compilers which took more complex languages and
translated them to the lambda calculus and even more minimalistic languages
like the SK (optionally I) combinator calculus, that class wasn't on
compilers, it was "Principles of Programming Languages". It also covered type
theory, implementing type inference, and so on.

Whereas our compilers class covers the sort of topics you would expect in a
compiler targeting a real architecture: parsing/lexing, choosing intermediate
languages, SSA form, optimizations, register allocation, code generation, and
so on. We have a separate class which covers compiling higher order typed
languages (SML in particular).

Our compilers class is also unusual (in ones I have seen) in that, instead of
building a lexer, building a parser, doing translation, and so on for each
stage, as separate projects, rather students build a whole compiler for each
assignment. The language compiled gains more and more features: first control
flow, then function calls, then memory operations (structs, arrays, heap-
allocation).

Might I ask your thinking when choosing the lambda calculus as the basis for
your compilers class?

~~~
mattmight
It was a normal compilers class.

We compiled Python.

This was just an exercise for week one.

------
russellallen
This is more of a meta-comment, but it is always interesting seeing links like
this (here on Hacker News and elsewhere) which attract a fair number of
upvotes, but no comments.

Perhaps we're all afraid of looking stupid... easier to discuss Job's
retirement or something less scary :)

Anyway, to drop down a metalevel, this is fabulous but also interesting for
what the lambda calculus doesn't talk about - concurrency and more broadly
time. I'd like to see more pages like this but which come from an actor model
of computation or some other process calculus.

~~~
mattmight
Would you like a "Compiling over to the pi-calculus" article?

~~~
russellallen
Definitely. If done in the same general style as your lambda calculus one I
think it would be a great resource.

------
DanielRibeiro
Very nice. It would be nice to see it compiling down to the typed lamba
calculus as well[1]

[1] <http://math.ucr.edu/home/baez/rosetta.pdf> , pg55

~~~
lemming
And while we're taking requests, one in a similar style on type inference
would be great too.

~~~
motxilo
You can examine Chapter 4 of Essentials of Programming Languages for the
basics of type inference ;)

