A toolkit for working with Binary Lambda Calculus
  • Common Lisp 92.9%
  • Scheme 5.8%
  • Makefile 1.3%
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-11-28 22:41:49 +04:00
.github Initial commit. 2024-05-16 03:39:24 +04:00
example example/hailstone.lisp: Add 2025-11-28 03:42:16 +04:00
source cli(prting-cased): Try pretty parsing when no nested type matches 2025-11-28 22:41:49 +04:00
tests Initial commit. 2024-05-16 03:39:24 +04:00
.gitignore Initial commit. 2024-05-16 03:39:24 +04:00
cl-blc.asd source/: Split everything per API entry (read,eval,coerce etc.) 2025-11-24 02:39:41 +04:00
guix.scm Initial commit. 2024-05-16 03:39:24 +04:00
LICENSE LICENSE: Bump. 2025-01-06 01:03:17 +04:00
makefile makefile(blc): Make conditional on source file changes 2025-11-21 00:42:11 +04:00
README.org README: Reorient it putting CLI tool first 2025-11-27 00:47:58 +04:00

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 T tries to return intuitive results, but types can also be provided explicitly. See coerce docstring 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.