- Rust 97.9%
- Nix 2.1%
| book | ||
| naj | ||
| src | ||
| .envrc | ||
| .gitignore | ||
| book.toml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
narju 🐱
narju gismu - x₁ is orange [color] in shade x₂ [medium red-yellow].
this type of lisp is historically named after colours, so narju takes its name from the lojban word for orange - after a handsome orange cat. 🐱
narju is a self-reflective, meta-circular lisp, based on Nada Amin's Collapsing Towers of Interpreters
Running
$ nix run git+https://git.avery.garden/thorn/narju
naj with no argument is the prompt; naj FILE runs a file.
An interpreter is an ordinary value, and which one a procedure runs under is a field of it. So altering the semantics is rebuilding a closure under a different interpreter — no global mutation, and nothing else in scope moves:
> (define (inc n) (+ n 1))
'inc
> (inc 0)
1
> (define (shifted i)
(with-handler i 'eval-lit
(lambda h (m l e r k) (apply-cont k ((l 'lift) (+ e 10))))))
'shifted
> ((with-interp inc (shifted (interp-of inc))) 0)
11
> (inc 0)
1
The prompt itself is an object program (naj/repl.naj), as is the library it
runs on (naj/prelude.naj) and the evaluator underneath both
(naj/tower.naj). The Rust in this repository is λ↑↓ — the stage-polymorphic
floor the tower compiles down to — plus a scheduler and the host adapters a
task sends messages to.
Documentation for the floor is at narju-docs:
$ nix build .#docs # rustdoc
Development
a nix development shell is exposed with the rust toolchain, compatible language servers etc
nix develop
License
MIT.