Hacker News new | comments | show | ask | jobs | submit login

Yeah, I’ve found Haskell a pleasure to work with for writing compilers. There’s no single thing, just a combination of language features and libraries. The bulk of a compiler is transforming trees of stuff, which Haskell makes very easy, and it nudges you pretty strongly in the direction of making code testable and refactorable.

I don’t have any particular recommendations. Mostly I’ve just been figuring things out as I go along, reading papers and asking for help. I’d written compilers & interpreters before, but got into using Haskell for it with Write Yourself a Scheme[1]. I’ve also heard good things about Implementing a JIT Compiled Language with Haskell and LLVM[2].

[1]: https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_...

[2]: http://www.stephendiehl.com/llvm/

Y'all might find it interesting that the first attempt at a Perl6 implementation was done in Haskell and was considered vitally important.

Pugs was, by my count, the third or fourth attempt. I can think of at least two in the Parrot repository long before Pugs was a thing, and I believe one of those had a fork/rewrite before 2005.

Lol thanks Chromatic. Always good to get corrected by someone who was there and actually knows. Thanks for your work!

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