Jill is a functional programming language built for the Nand2Tetris platform, as an alternative to the Jack high-level language.
It is designed as a drop-in replacement for Jack, as it uses the same VM instruction set and underlying HACK architecture, and follows similar design principles (willing to sacrifice ease of use to favour ease of implementation), while offering a functional alternative to Jack's very object-oriented, verbose style (
I like to think of Jill as Jack's more elegant, modern sister).
Some notable features include:
- functions as first-class citizens (ability to store them in variables, pass them on to other functions as arguments, and return from functions as a result)
- optimized tail-call recursion to use constant stack space (single stack frame)
- data modeling using algebraic data types with primitive pattern-matching (per type variant)
- note that, as with Jack, all variables are still effectively 16-bit integers, therefore Jill is dynamically typed
- minimal language design
- only 3 main concepts (types, variables and functions)
- expressions can only be literals, variables or function calls
- expanded standard library which is lazily-generated (instructions are generated only for modules and functions which were used in codebase)
- common design choices of functional languages (no loops, variables are immutable, code is organized into modules etc.)
You can find code examples, compiler source code and more in the
project repository.