shithub: femtolisp

ref: 49d1461e441aea2ebb5bd237bad1026723582b85
dir: /README.md/

View raw version
# femtolisp

A compact interpreter for a minimal lisp/scheme dialect.

This is a reanimation of
https://github.com/lambdaconservatory/femtolisp with bigger plans.

Supported OS: [9front](http://9front.org), Unix-like operating systems (OpenBSD, NetBSD, Linux, etc).

Supported CPUs: any decent 32 or 64-bit, little or big endian.

Tested on: 9front/arm64, OpenBSD/386, NetBSD/sparc64, Alpine/amd64, Android/arm64.

Some of the changes from the original include:

 * aggressive clean up, removal, renaming and refactoring
 * seamless arbitrary precision integers
 * `[` and `]`, `{` and `}` are synonyms to `(` and `)`
 * `λ` as a shorthand for `lambda`
 * some of the previously available (but not merged) patches from the community and [Julia](https://github.com/JuliaLang/julia) are applied
 * "boot" image is built into the executable
 * vm opcode definitions and tables are generated from a single file
 * fixed bootstrap (makes it work properly when opcodes change)

## Building

### POSIX

	meson setup build -Dbuildtype=release
	ninja -C build test

### Plan 9

	mk all test

## Characteristics

  * lexical scope, lisp-1
  * unrestricted macros
  * case-sensitive
  * simple compacting copying garbage collector
  * Scheme-style varargs (dotted formal argument lists)
  * "human-readable" bytecode with self-hosted compiler
  * circular structure can be printed and read
  * `#.` read macro for eval-when-read and readably printing builtins
  * read macros for backquote
  * symbol character-escaping printer
  * exceptions
  * gensyms (can be usefully read back in, too)
  * `#| multiline comments |#`, `#;(block comment...`, lots of other lexical syntax
  * generic compare function, cyclic equal
  * cvalues system providing C data types and a C FFI
  * constructor notation for nicely printing arbitrary values