Idorobots / spartan

A small Lisp dialect that serves me as a test bed for programming language features.
MIT License
13 stars 3 forks source link
actor-model compiler compiler-design concurrency continuations language-design lisp-dialect programming-language rules-engine scheme

foofSpartan

Spartan is a small Lisp dialect that serves me as a test bed for programming language features.

Currently implemented features are:

See here for some usage examples. You can run these examples with:

hello

errors

## Compiler Run `./build.sh` to build the compiler CLI. The compiler is far from being useful, it performs only rudimentary low-hanging fruit optimizations & validations. It loosely follows the nanopass framework, with currently implemented passes being: - parsing, - built-in macro expansion, - syntax tree elaboration, - implicit body handling, - quasiquote expansion, - constant value annotation, - free-variable annotation, - binding form analysis, - syntax tree validation, - alpha conversion, - built-in function inlining, - user function inlining, - constant propagation, - constant folding, - common subexpression elimination, - copy propagation, - dead code elimination, - `letrec` binding reordering, - `letrec` conversion, - continuation passing style transformation, - flat closure conversion, - global value hoisting, - target-safe name mangling, - target code generation. ## REPL The REPL supports a traditional flow of read-eval-print - each line entered is executed automatically and the results are printed immediately:

repl

There's also a _basic_ twist - the REPL accepts a full listing and allows editing it line by line:

basic