narju
narju is a lisp whose evaluator is written in itself and handed to every procedure as an ordinary value. it descends from Nada Amin and Tiark Rompf’s Collapsing Towers of Interpreters, and from the 3-lisps before that.
this book assumes lisp. it covers what narju has that your lisp does not.
the interpreter is a value. (interp-of f) gives the semantics f runs
under, an association list of handlers. (with-interp f m) rebuilds f under
different semantics. reflection, tracing, sandboxing and stage control are all
written on those two.
there is no level counter. a level is a closure chain. a handler that is itself an object closure gets interpreted by the interpreter it closed over, and the regress bottoms out at the compiled floor. going up a level is calling a function.
compilation is a form. clambda is lambda that compiles its body against
the semantics in force. the reflective machinery stages away, leaving no
interpretive overhead and no tower.
tasks are the concurrency. BEAM-style: heaps, mailboxes, turn budgets, monitors, supervisors. a task’s semantics is a field of its closure, so two tasks in one world can be running different languages.
the outside world is a peer. stdout, the clock, the filesystem and the
network gate are addresses of the shape ('host stdout). there is no i/o
primitive.
the floor underneath is λ↑↓, the stage-polymorphic language from the Collapsing
Towers paper, written in rust in src/floor/. naj/tower.naj,
naj/prelude.naj and naj/repl.naj are object programs it runs.
read the four parts in order the first time. staging leans on semantics-as-a-value, and the concurrency chapters lean on both.
no example here is checked by the build. each was run through naj while
writing; if one has rotted, trust the binary.