- Common Lisp 92.9%
- Scheme 5.8%
- Makefile 1.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github | ||
| example | ||
| source | ||
| tests | ||
| .gitignore | ||
| cl-blc.asd | ||
| guix.scm | ||
| LICENSE | ||
| makefile | ||
| README.org | ||
cl-blc
cl-blc is a library and a CLI tool for working with Binary Lambda Calculus.
cl-blc read-s, eval-uates and (pretty-) print-s Binary Lambda Calculus expressions. Also includes a CLI tool for compilation of BLC (both one-bit and eight-bit encoding) to standalone executables and running it interactively.
See for more context:
Getting Started
Clone the Git repository:
git clone --recursive https://github.com/aartaka/cl-blc ~/common-lisp/
To make a CLI tool (the only dependency is a Lisp compiler like sbcl):
cd ~/common-lisp/cl-blc/
make blc LISP=sbcl
The tool allows you to run BLC scripts, both univeral and binary format
$ ./blc run example/first.blc -- --:character
hello
h
Compilation is an option too
$ ./blc compile example/first.blc string:character first
$ ./first
hello
h
Lisp files (in a format resembling Scheme with let-s, lambda-s, and non-funcall application) can be converted to uni and bin formats:
$ ./blc lisp2uni example/sort.lisp
01000100010000010110011110000000000101010000000101111001111111111100000000001010101111111011100110000011000010110111100101111011111011000010110011100000110000101101111101111000010110110000010010111011110101111110111000001000000101010110111101100000001000001100001000110100001110000101110110100000000101011110000001100111011110001100010
# Same, saves ones and zeros to example/sort.blc
$ ./blc lisp2uni example/sort.lisp example/sort.blc
cl-blc is also a Lisp library for BLC handling, the API shadows standard symbols:
-
read - to read a BLC term from pathname, string, array, or stream.
-
compile - to compile a Lisp-like form to BLC intermediate representation.
-
eval - to run a provided IR and get result closure.
-
coerce - to coerce this closure back to Lisp.
coerce x Ttries to return intuitive results, but types can also be provided explicitly. Seecoercedocstring for that. -
write - to output the IR to uni, binary, hex, or literal IR format.
Examples
See /aartaka/cl-blc/src/branch/main/source/package.lisp and docstrings for usage examples.