[Haskell-cafe] Materials on Compiling Functional Languages.

Justin Bailey jgbailey at gmail.com
Thu Mar 10 17:32:21 UTC 2016


Max,

I had similar questions several years ago and was able to do a term
project to answer them.  I wrote a really simple compiler for a
Haskell-like language called "habit". The code doesn't work anymore,
but you can read my report here:

  https://github.com/m4dc4p/mil/blob/master/caffeine/report/report.pdf

It covers translating an AST into x86, closure representation, among
other topics.

Under that directory you'll also find the source code to the compiler
and a presentation I gave on it.

On Thu, Mar 10, 2016 at 4:42 AM, Maksymilian Owsianny
<maksymilian.owsianny at gmail.com> wrote:
> @Jonne
>
> Maybe I should have been a little more precise. I'm specifically
> interested in a compilation step, that is turning a AST of some
> functional language say untyped lambda calculus into a sequence of
> imperative instructions.
>
> And I'm looking for a somewhat structured materials on the subject.
>
> If I were to give an analogy it would be how you would teach someone
> about sorting algorithms. You would start with simple solutions that
> most people come up on their own, like insert or bubble sort. Then you
> go on about explaining problems with complexity of that solutions and
> you present slightly more complex but optimal algorithms like quick or
> merge sort. Then maybe you would give a proof that n log n is best you
> can do for comparison based solutions. Then you could ask what could
> be done if you remove that restriction, and so on...
>
> That way I could get a more complete understanding of the field.
>
> Where all I was able to fish from google were papers about (to
> continue the analogy) theoretical complexity of a sorting algorithm on
> a quantum computer or constant time improvements of a heap sort given
> architecture with SIMD instruction set.
>
> And of course given enough time I would be able to piece all that
> knowledge together, but I'm hoping someone could spare me that time.
>
> @Gil
>
> Thanks for suggestions, I was able to locate previously these series
> by Stephan Diehl and they are truly quality material, the only problem
> is that the first one deals with compiling an imperative language. So
> it is of great use as practical solution to llvm generation but
> doesn't really answers any of my theoretical questions about
> functional language compilation. The second one on the other hand
> deals with haskell so that's a bit of a jump already but also is still
> a work in progress and crucially doesn't yet have the chapters
> regarding compilation. As for others most of them are new to me so
> I guess I'll have to take a deeper look.
>
> Ultimately I wasn't really expecting to get all that knowledge on
> a silver platter. I guess I'll have to dig into all that literature
> until I'll come out enlightened, so really anything useful you can
> throw at me I'll be grateful for.
>
> Thanks,
> Max.
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list