Show HN: Admiran: a pure, lazy functional language and self-hosting compiler

  • Posted 9 hours ago by taolson
  • 2 points
https://github.com/taolson/Admiran
I wrote this over the past two years to explore how pure, lazy, functional languages like Haskell and Miranda are implemented and efficiently compiled. It has evolved into a fairly small (~7kloc) compiler written in itself, along with a library of pure, functional data structures. Even though the compiler is small enough to be read and understood by a single person, it implements:

* lazy lists, tuples, pattern matching, range and list comprehension syntax, algebraic data types, abstract data types, modules, user-defined value and type operators, etc.

* 19-pass compiler with whole-program compilation, inter-module inlining and optimizations, automatic derivation of comparison and show functions, module serialization / deserialization for caching module compiles

* Hindley-Milner type inference and checking

* Small runtime implements 2-generation compacting garbage collector

* Library includes implementations of map, set, bag, immutable and mutable vectors, functor/applicative/monad for maybe, either, state, and io types, parser combinators, etc.

If you are interested in pure functional programming languages, or want to have an interesting language for the next Advent Of Code season, it might be useful to you.

0 comments