Don't know if my language is considered Lil' enough for this, but it's a pure, lazy functional language based upon Miranda (progenitor language to Haskell) that compiles to x86-64 asm. ~6700 SLOC for the (self-hosted!) compiler, and ~3300 SLOC additional for the extensive library of functional data structures and functions.
I really loved Miranda back when I learned about it. I still have the book. I think it never took off because it was quite expensive for universities to use. Im sure David Turner regrets his price model today. Now he has made Miranda available here https://www.cs.kent.ac.uk/people/staff/dat/miranda/
Yes, the open-source release he did is what introduced me to Miranda. I rewrote a lot of my previous Haskell solutions to Advent of Code puzzles with it, and liked it so much I decided to try to improve on it ;-)
That's what led to Admiran. I originally wrote Admiran in Miranda, then bootstrapped from that to self-hosting when it was stable enough to do so. The original Miranda combinator compiler / interpreter took 20 minutes to compile all of Admiran, while the self-hosted version now takes 20 seconds.
One of the grad students of David Turner has taken up maintenance on the original Miranda source; the repository is now at https://codeberg.org/DATurner/miranda
My little language Newt is 7 kloc. Dunno if it's worth including, it's mostly an exercise to learn how these things work and is not as polished as I'd like.
- Self-hosted
- Compiles to javascript
- Bidirectional typechecking with NbE (based on elaboration zoo)
- Dependent type checking
- type classes
- ADTs with dependent pattern matching
- TCO (trampoline for mutually tail recursive functions)
- Erasure of compile-time only values (0, ω quantities, but not linear)
Either newt was already in the list, or it got added. We talked a bit about using our languages for AoC 2024 -- looks like you've been keeping busy working on it!
Keyboards of early MIT systems[1] and Lisp Machines[2] had brackets (parentheses) and square brackets on the same key where square brackets and curly brackets are on modern keyboards.
I've always found OCaml's (* ... *) comments annoying, because it needs shift for both characters. But I suspect it's easier to type on a french keyboard.
I've been playing with my own Smalltalk implementation. I guess it qualifies as a tiny _language_, but the class library is huge!
Yes, I know that all who do not understand Smalltalk are doomed to re-implement it, poorly. I'm just cutting out the middleman - and this allows it to do things Smalltalk normally doesn't. It allows me to think so far outside the box it's not even visible anymore.
The hardest part with small languages isn't the parser, it's the standard library and error messages. Getting a helpful IDE experience in that footprint is a significant engineering challenge.
https://github.com/taolson/Admiran
That's what led to Admiran. I originally wrote Admiran in Miranda, then bootstrapped from that to self-hosting when it was stable enough to do so. The original Miranda combinator compiler / interpreter took 20 minutes to compile all of Admiran, while the self-hosted version now takes 20 seconds.
One of the grad students of David Turner has taken up maintenance on the original Miranda source; the repository is now at https://codeberg.org/DATurner/miranda
- Self-hosted
- Compiles to javascript
- Bidirectional typechecking with NbE (based on elaboration zoo)
- Dependent type checking
- type classes
- ADTs with dependent pattern matching
- TCO (trampoline for mutually tail recursive functions)
- Erasure of compile-time only values (0, ω quantities, but not linear)
- Web playground
- LSP (added this month)
- Syntax is similar to Agda / Idris / Haskell
https://github.com/dunhamsteve/newt
1: http://xahlee.info/kbd/sail_keyboard.html
2: http://xahlee.info/kbd/space-cadet_keyboard.html
Curl was a proprietary Lisp that {curly brackets} and was designed in the 1990s to build web applications.
https://en.wikipedia.org/wiki/Curl_(programming_language)
Knuth solves the bracket issue by redefining his keymap to swap () with [] and + with = (macos keymap files found at the bottom of this page: https://www-cs-faculty.stanford.edu/~knuth/programs.html )
The above really reminds me of tcl, though, which uses square brackets to force evaluation of the command they wrap.
Yes, I know that all who do not understand Smalltalk are doomed to re-implement it, poorly. I'm just cutting out the middleman - and this allows it to do things Smalltalk normally doesn't. It allows me to think so far outside the box it's not even visible anymore.
disclaimer: I'm the author
https://github.com/mlajtos/fluent/blob/main/client.tsx
EDIT: Actually, it's not quite "ML-family" enough for this post. But it is a remarkably cool project! :)
And here is a set of single file lambda calculus implementations with a variety of extensions: https://github.com/solomon-b/lambda-calculus-hs
`polytt` is kind of an ended experiment but that lambda calculus repo i plan to extend in the near future.
https://justine.lol/sectorlisp2/