{"id":13836540,"url":"https://github.com/woodrush/lambdalisp","last_synced_at":"2026-02-16T16:06:21.140Z","repository":{"id":59612002,"uuid":"524053843","full_name":"woodrush/lambdalisp","owner":"woodrush","description":"A Lisp interpreter written in untyped lambda calculus","archived":false,"fork":false,"pushed_at":"2023-03-10T17:42:26.000Z","size":1169,"stargazers_count":244,"open_issues_count":2,"forks_count":11,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-08T23:07:32.561Z","etag":null,"topics":["interpreter","lambda-calculus","lisp","lisp-interpreter","repl"],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/woodrush.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-08-12T10:58:19.000Z","updated_at":"2025-08-15T08:04:07.000Z","dependencies_parsed_at":"2024-01-13T17:01:54.289Z","dependency_job_id":"0db1243b-0b9e-48ac-9177-2a3352e9c03b","html_url":"https://github.com/woodrush/lambdalisp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/woodrush/lambdalisp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodrush%2Flambdalisp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodrush%2Flambdalisp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodrush%2Flambdalisp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodrush%2Flambdalisp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woodrush","download_url":"https://codeload.github.com/woodrush/lambdalisp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woodrush%2Flambdalisp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000729,"owners_count":26082862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["interpreter","lambda-calculus","lisp","lisp-interpreter","repl"],"created_at":"2024-08-04T15:00:49.306Z","updated_at":"2025-10-08T23:07:35.690Z","avatar_url":"https://github.com/woodrush.png","language":"Common Lisp","readme":"![LambdaLisp's logo](./bin/lambdalisp_logo.png)\n\u003cbr\u003e\n[![test](https://github.com/woodrush/lambdalisp/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/woodrush/lambdalisp/actions/workflows/test.yml)\n\n\nLambdaLisp is a Lisp interpreter written as an untyped lambda calculus term.\nIt basically runs a large subset of Common Lisp as shown in the [Features](#features) section.\nThe entire lambda calculus expression is viewable as a PDF [here](https://woodrush.github.io/lambdalisp.pdf).\n\n\n## Overview\nLambdaLisp is a Lisp interpreter written as a closed untyped lambda calculus term.\nIt is written as a lambda calculus term `LambdaLisp = λx. ...`\nwhich takes a string `x` as an input and returns a string as an output.\nThe input `x` is the Lisp program and the user's standard input,\nand the output is the standard output.\nCharacters are encoded into lambda term representations of natural numbers using the [Church encoding](https://en.wikipedia.org/wiki/Church_encoding),\nand strings are encoded as a list of characters with lists expressed as lambdas in the [Scott encoding](https://en.wikipedia.org/wiki/Mogensen%E2%80%93Scott_encoding),\nso the entire computation process solely consists of the beta-reduction of lambda terms,\nwithout introducing any non-lambda-type object.\n\nSupported features are closures and persistent bindings with `let`, reader macros, 32-bit signed integers, strings, and much more.\nLambdaLisp is tested by running programs on both Common Lisp and LambdaLisp and comparing their outputs.\nThe largest LambdaLisp-Common-Lisp polyglot program that has been tested is [lambdacraft.cl](./examples/lambdacraft.cl),\nwhich runs the Lisp-to-lambda-calculus compiler [LambdaCraft](https://github.com/woodrush/lambdacraft) written for this project, also used to compile LambdaLisp itself.\n\nWhen run on a lambda calculus interpreter that runs on the terminal,\nLambdaLisp presents a REPL where you can interactively define and evaluate Lisp expressions.\nThese interpreters automatically process the string-to-lambda encoding for handling I/O through the terminal.\nSupported interpreters are:\n\n- SectorLambda, the [521-byte lambda calculus interpreter](https://justine.lol/lambda/) written by Justine Tunney\n- The [IOCCC](https://www.ioccc.org/) 2012 [\"Most functional\"](https://www.ioccc.org/2012/tromp/hint.html) interpreter written by John Tromp\n  (the [source](https://www.ioccc.org/2012/tromp/tromp.c) is in the shape of a λ)\n- Universal Lambda interpreter [clamb](https://github.com/irori/clamb) and Lazy K interpreter [lazyk](https://github.com/irori/lazyk) written by Kunihiko Sakamoto\n\nLisp has been described by Alan Kay as the [Maxwell's equations of software](https://www.gnu.org/software/mes/manual/html_node/LISP-as-Maxwell_0027s-Equations-of-Software.html).\nIn the same sense, I believe that lambda calculus is the particle physics of computation.\nLambdaLisp may therefore be a gigantic electromagnetic [Lagrangian](https://en.wikipedia.org/wiki/Mathematical_formulation_of_the_Standard_Model) that connects the realm of human-friendly programming to the origins of the notion of computation itself.\n\n\n## Usage\nLambdaLisp runs on x86-64-Linux and other platforms such as Mac.\n\n### Trying the LambdaLisp REPL (on x86-64-Linux)\nYou can try the LambdaLisp REPL by simply running:\n\n```sh\ngit clone https://github.com/woodrush/lambdalisp\ncd lambdalisp\nmake run-repl\n```\nThe requirement is `cc` which should be installed by default.\nTo try it on a Mac, please see the next section.\n\nThis will run LambdaLisp on SectorLambda, the [521-byte lambda calculus interpreter](https://justine.lol/lambda/).\nThe source code being run is [lambdalisp.blc](./bin/lambdalisp.blc),\nwhich is the lambda calculus term shown in [lambdalisp.pdf](lambdalisp.pdf) written in [binary lambda calculus](https://tromp.github.io/cl/Binary_lambda_calculus.html) notation.\n\nSectorLambda automatically takes care of the string-to-lambda I/O encoding to run LambdaLisp on the terminal.\nInteraction is done by writing LambdaLisp in continuation-passing style,\nallowing a Haskell-style interactive I/O to work on lambda calculus interpreters.\n\nWhen building SectorLambda, Make runs the following commands to get its source codes:\n\n- `Blc.S`: `wget https://justine.lol/lambda/Blc.S?v=2`\n- `flat.lds`: `wget https://justine.lol/lambda/flat.lds`\n\nAfter running `make run-repl`, the REPL can also be run as:\n\n```sh\n( cat ./bin/lambdalisp.blc | ./bin/asc2bin; cat ) | ./bin/Blc\n```\n\n\n### Trying the LambdaLisp REPL (on Other Platforms)\nSectorLambda is x86-64-Linux exclusive. On other platforms such as a Mac, the following command can be used:\n\n```sh\ngit clone https://github.com/woodrush/lambdalisp\ncd lambdalisp\nmake run-repl-ulamb\n```\nThis runs LambdaLisp on the lambda calculus interpreter `clamb`.\nThe requirement for this is `gcc` or `cc`.\n\nAfter running `make run-repl-ulamb`, the REPL can also be run as:\n\n```sh\n( cat ./bin/lambdalisp.ulamb | ./bin/asc2bin; cat ) | ./bin/clamb -u\n```\n\nTo run LambdaLisp on other lambda calculus interpreters, please see the Supported Lambda Calculus Interpreters section.\n\n\n\n### Playing the Number Guessing Game\nOnce `make run-repl` is run, you can play the [number guessing game](./examples/number-guessing-game.cl) with:\n\n```sh\n( cat ./bin/lambdalisp.blc | ./bin/asc2bin; cat ./examples/number-guessing-game.cl; cat ) | ./bin/Blc\n```\n\nIf you ran `make run-repl-ulamb`, you can run:\n\n```sh\n( cat ./bin/lambdalisp.ulamb | ./bin/asc2bin; cat ./examples/number-guessing-game.cl; cat ) | ./bin/clamb -u\n```\n\nYou can run the same script on Common Lisp. If you use SBCL, you can run it with:\n\n```sh\nsbcl --script ./examples/number-guessing-game.cl\n```\n\n\n## Examples\n\n### Closures\nThe following LambdaLisp code runs right out of the box:\n\n```lisp\n(defun new-counter (init)\n  ;; Return a closure.\n  ;; Use the let over lambda technique for creating independent and persistent variables.\n  (let ((i init))\n    (lambda () (setq i (+ 1 i)))))\n\n;; Instantiate counters\n(setq counter1 (new-counter 0))\n(setq counter2 (new-counter 10))\n\n(print (counter1)) ;; =\u003e 1\n(print (counter1)) ;; =\u003e 2\n(print (counter2)) ;; =\u003e 11\n(print (counter1)) ;; =\u003e 3\n(print (counter2)) ;; =\u003e 12\n(print (counter1)) ;; =\u003e 4\n(print (counter1)) ;; =\u003e 5\n```\n\nAn equivalent JavaScript code is:\n\n```javascript\n// Runs on the browser's console\nfunction new_counter (init) {\n    let i = init;\n    return function () {\n        return ++i;\n    }\n}\n\nvar counter1 = new_counter(0);\nvar counter2 = new_counter(10);\n\nconsole.log(counter1()); // =\u003e 1\nconsole.log(counter1()); // =\u003e 2\nconsole.log(counter2()); // =\u003e 11\nconsole.log(counter1()); // =\u003e 3\nconsole.log(counter2()); // =\u003e 12\nconsole.log(counter1()); // =\u003e 4\nconsole.log(counter1()); // =\u003e 5\n```\n\n### Object-Oriented Programming\nAs described in [Let Over Lambda](https://letoverlambda.com/),\nwhen you have closures, you get object-oriented programming for free.\nLambdaLisp has a built-in OOP feature implemented as predefined macros based on closures.\nIt supports Python-like classes with class inheritance:\n\n```lisp\n;; Runs on LambdaLisp\n(defclass Counter ()\n  (i 0)\n\n  (defmethod inc ()\n    (setf (. self i) (+ 1 (. self i))))\n\n  (defmethod dec ()\n    (setf (. self i) (- (. self i) 1))))\n\n\n(defclass Counter-add (Counter)\n  (defmethod *init (i)\n    (setf (. self i) i))\n\n  (defmethod add (n)\n    (setf (. self i) (+ (. self i) n))))\n\n\n(defparameter counter1 (new Counter))\n(defparameter counter2 (new Counter-add 100))\n\n((. counter1 inc))\n((. counter2 add) 100)\n\n(setf (. counter1 i) 5)\n(setf (. counter2 i) 500)\n```\n\nAn equivalent Python code is:\n\n```python\nclass Counter ():\n    i = 0\n\n    def inc (self):\n        self.i += 1\n        return self.i\n    \n    def dec (self):\n        self.i -= 1\n        return self.i\n\nclass Counter_add (Counter):\n    def __init__ (self, i):\n        self.i = i\n    \n    def add (self, n):\n        self.i += n\n        return self.i\n\ncounter1 = Counter()\ncounter2 = Counter_add(100)\n\ncounter1.inc()\ncounter2.add(100)\n\ncounter1.i = 5\ncounter2.i = 500\n```\n\n\n### More Examples\nMore examples can be found under [./examples](./examples).\nThe largest program written for LambdaLisp that has been tested is [lambdacraft.cl](./examples/lambdacraft.cl),\nwhich runs the lambda calculus compiler [LambdaCraft](https://github.io/woodrush/lambdacraft) written for this project, also used to compile LambdaLisp itself.\n\n\n\n## Features\nKey features are:\n\n- Signed 32-bit integers\n- Strings\n- Closures, lexical scopes, and persistent bindings with `let`\n- Object-oriented programming feature with class inheritance\n- Reader macros with `set-macro-character`\n- Access to the interpreter's virtual heap memory with `malloc`, `memread`, and `memwrite`\n- Show the call stack trace when an error is invoked\n- Garbage collection during macro expansion\n\nSupported special forms and functions are:\n\n- defun, defmacro, lambda (\u0026rest can be used)\n- quote, atom, car, cdr, cons, eq\n- +, -, *, /, mod, =, \u003e, \u003c, \u003e=, \u003c=, integerp\n- read (reads Lisp expressions), read-char, peek-char, print, format (supports `~a` and `~%`), write-to-string, intern, stringp\n- let, let*, labels, setq, boundp\n- progn, loop, block, return, return-from, if, cond, error\n- list, append, reverse, length, position, mapcar\n- make-hash-table, gethash (setf can be used)\n- equal, and, or, not\n- eval, apply\n- set-macro-character, `` ` ``   `,`   `,@`   `'`   `#\\`\n- carstr, cdrstr, str, string comparison with =, \u003e, \u003c, \u003e=, \u003c=, string concatenation with +\n- defun-local, defglobal, type, macro\n- malloc, memread, memwrite\n- new, defclass, defmethod, `.`, field assignment by setf\n\n\n## Supported Lambda Calculus Interpreters\nBelow is a summary of the supported lambda calculus interpreters.\nAll interpreters run on the terminal and automatically handles the previously described\nstring-to-lambda encoding for the standard I/O.\nEach interpreter uses a slightly different I/O encoding, classified below as languages.\n\nLambdaLisp is written natively as a lambda term based on the language [Binary Lambda Calculus](https://tromp.github.io/cl/cl.html).\nIt is adapted to other languages by wrapping it with an [encoder-decoder](./src/lazyk-ulamb-blc-wrapper.cl) that absorbs the language spec differences.\n\n\n| Language                                                     | Extension | Engine                  | Program Format               |\n|--------------------------------------------------------------|-----------|-------------------------|------------------------------|\n| [Binary Lambda Calculus](https://tromp.github.io/cl/cl.html) | *.blc     | Untyped Lambda Calculus | Binary (asc2bin can be used) |\n| [Universal Lambda](http://www.golfscript.com/lam/)           | *.ulamb   | Untyped Lambda Calculus | Binary (asc2bin can be used) |\n| [Lazy K](https://tromp.github.io/cl/lazy-k.html)             | *.lazy    | SKI Combinator Calculus | ASCII                        |\n\n| Interpreter                                         | Language               | Platforms    | Build Command | Author                             | Notes                                                                                                                                                                                |\n|-----------------------------------------------------|------------------------|--------------|---------------|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Blc](https://justine.lol/lambda/)                  | Binary Lambda Calculus | x86-64-Linux | `make blc`    | [@jart](https://github.com/jart)   | [521-byte interpreter](https://justine.lol/lambda/)                                                                                                                                  |\n| [tromp](https://www.ioccc.org/2012/tromp/hint.html) | Binary Lambda Calculus | Any          | `make tromp`  | [@tromp](https://github.com/tromp) | [IOCCC](https://www.ioccc.org/) 2012 [\"Most functional\"](https://www.ioccc.org/2012/tromp/hint.html) - the [source](https://www.ioccc.org/2012/tromp/tromp.c) is in the shape of a λ |\n| [uni](https://tromp.github.io/cl/cl.html)           | Binary Lambda Calculus | Any          | `make uni`    | [@tromp](https://github.com/tromp) | Unobfuscated version of `tromp`                                                                                                                                                      |\n| [clamb](https://github.com/irori/clamb)             | Universal Lambda       | Any          | `make clamb`  | [@irori](https://github.com/irori) | Fast UL interpreter                                                                                                                                                                  |\n| [lazyk](https://github.com/irori/lazyk)             | Lazy K                 | Any          | `make lazyk`  | [@irori](https://github.com/irori) | Fast Lazy K interpreter                                                                                                                                                              |\n\n### Building the Lambda Calculus Interpreters\nSeveral notes about the interpreters:\n\n- The BLC intepreter `Blc` runs only on x86-64-Linux systems.\n- The BLC interpreter `tromp` may not compile on a Mac with the defualt gcc (which is actually an alias of clang). Details are provided below.\n- The most reliably compilable BLC interpreter is `uni`, which compiles and runs on both Linux and Mac.\n- The interpreters for Universal Lambda and Lazy K, `clamb` and `lazyk`, can be built and run on both of these systems.\n\nTo build all interpreters:\n\n```sh\nmake interpreters\n```\n\nOr, to build them individually:\n```sh\nmake blc tromp uni clamb lazyk asc2bin\n```\n\nHere, asc2bin is a utility that packs ASCII 0/1 bitstreams to a byte stream, the format accepted by the BLC and UL interpreters.\n\nThe interpreters' source codes are obtained from external locations.\nWhen the make recipe is run, each recipe obtains these external source codes using the following commands:\n\n- `blc`:\n  - `Blc.S`: `wget https://justine.lol/lambda/Blc.S?v=2`\n  - `flat.lds`: `wget https://justine.lol/lambda/flat.lds`\n- `uni`: `wget https://tromp.github.io/cl/uni.c`\n- `tromp`: `wget http://www.ioccc.org/2012/tromp/tromp.c`\n- `clamb`: `git clone https://github.com/irori/clamb`\n- `lazyk`: `git clone https://github.com/irori/lazyk`\n\n\n\n### Running LambdaLisp\n#### On Binary Lambda Calculus\nAfter building all of the required tools and interpreters, running LambdaLisp on the Binary Lambda Calculus interpreter `Blc` can be done as follows:\n\n```sh\ncd ./bin\n# Pack the 01 bitstream to a bytestream\ncat lambdalisp.blc | ./asc2bin \u003e lambdalisp.blc.bin\n\ncat lambdalisp.blc.bin -            | ./Blc # Run the LambdaLisp REPL\ncat lambdalisp.blc.bin [filepath]   | ./Blc # Run a LambdaLisp script and exit\ncat lambdalisp.blc.bin [filepath] - | ./Blc # Run a LambdaLisp script, then enter the REPL\n```\n\nTo run on `tromp` or `uni`, replace `Blc` with `tromp` or `uni`.\n\nRunning `cat -` with the hyphen connects the standard input after the specified input files,\nallowing the user to interact with the interpreter through the terminal after reading a file.\nIf `cat -` doesn't work, the following command can be used instead:\n\n```sh\n( cat lambdalisp.blc.bin [filepath]; cat ) | ./Blc\n```\n\n#### On Universal Lambda\nRunning LambdaLisp on the Universal Lambda interpreter `clamb` can be done as follows.\nNote that `lambdalisp.ulamb` and `lambdalisp.blc` are different files although they look similar,\nsince they are different languages.\nThis is since the I/O lambda term encoding is different for these languages.\nOtherwise, both languages are based entirely on untyped lambda calculus.\n```sh\ncd ./bin\n\n# Pack the 01 bitstream to a bytestream\ncat lambdalisp.ulamb | ./asc2bin \u003e lambdalisp.ulamb.bin\n\n# The -u option is required for handling I/O properly\n./clamb lambdalisp.ulamb.bin -u                    # Run the LambdaLisp REPL\ncat [filepath]   | ./clamb -u lambdalisp.ulamb.bin # Run a LambdaLisp script and exit\ncat [filepath] - | ./clamb -u lambdalisp.ulamb.bin # Run a LambdaLisp script, then enter the REPL\n```\n\n#### On Lazy K\nRunning LambdaLisp on the Lazy K interpreter `lazyk` can be done as follows:\n```sh\ncd ./bin\n# The -u option is required for handling I/O properly\n./lazyk ./lambdalisp.lazy -u                    # Run the LambdaLisp REPL\ncat [filepath]   | ./lazyk lambdalisp.lazy -u # Run a LambdaLisp script and exit\ncat [filepath] - | ./lazyk lambdalisp.lazy -u # Run a LambdaLisp script, then enter the REPL\n```\n\n### Building 'tromp' on a Mac\nMac has `gcc` installed by default or via Xcode Command Line Tools.\nHowever, `gcc` is actually installed as an alias to `clang`, which is a different compiler that doesn't compile `tromp`.\nThis is confirmable by running `gcc --version`. On my Mac, running it shows:\n\n```sh\n$ gcc --version\nConfigured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1\nApple clang version 12.0.0 (clang-1200.0.32.29)\nTarget: x86_64-apple-darwin19.6.0\nThread model: posix\nInstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin\n```\n\nA workaround for this is to use `uni` instead, which is an unobfuscated version of `tromp` compilable with clang.\nTo build `tromp`, first install gcc via [Homebrew](https://brew.sh/):\n\n```sh\nbrew install gcc\n```\n\nCurrently, this should install the command `gcc-11`.\nAfter installing gcc, check the command it has installed.\n\nThen, edit the `Makefile`'s `CC` configuration:\n\n```diff\n- CC=cc\n+ CC=gcc-11\n```\n\nThen, running\n```sh\nmake tromp\n```\nwill compile `tromp`.\n\n\n\n## Building from Source\nLambdaLisp's source code is written using [LambdaCraft](https://github.com/woodrush/lambdacraft), a DSL written in Common Lisp for compiling\nCommon Lisp to lambda calculus terms which written for this project.\nBuilding from source requires SBCL (Steel Bank Common Lisp), a Common Lisp interpreter.\n\nFirst install SBCL with:\n\n```sh\nsudo apt install sbcl\n```\n\nor on a Mac with:\n```sh\nbrew install sbcl\n```\n\nLambdaLisp can then be compiled with:\n```sh\nmake blc-src     # Builds lambdalisp.blc, for Binary Lambda Calculus\nmake ulamb-src   # Builds lambdalisp.ulamb, for Universal Lambda\nmake lazyk-src   # Builds lambdalisp.lazy, for Lazy K\n```\n\nTo compile [lambdalisp.pdf](./lambdalisp.pdf), first install LaTeX, and then run:\n```sh\nmake pdf\n```\n\n\n## Testing\nThere are 2 types of tests for LambdaLisp.\nEach test requires SBCL (Steel Bank Common Lisp), a Common Lisp interpreter.\n\nTo run the tests, run:\n\n```sh\nmake test      # Runs the tests on the BLC interpreter `uni`\nmake test-all  # Runs the tests on all of the available interpreters\n```\n\n`make test-all` uses a maximum of about 5GB of memory (on the largest program [examples/lambdacraft.cl](examples/lambdacraft.cl), which takes several minutes) and takes about 10 minutes on my machine.\n\nThe GitHub Actions CI runs `make test-ulamb`, which does the following:\n\n- Compiles [./bin/lambdalisp.blc](./bin/lambdalisp.blc) from [./src/main.cl](./src/main.cl) using SBCL\n- Builds `Blc` (SectorLambda)\n- Runs `./examples/src/*.cl` on both LambdaLisp (run with `Blc`) and SBCL and compares the outputs\n- Runs `./examples/src/*.lisp` on LambdaLisp and compares the outputs with `./test/*.lisp.out`\n- Runs the LambdaCraft Compiler Hosting Test (described below)\n\n\n### Output Comparison Test\nRuns the programs in `./examples/`. Runnable with:\n\n```sh\nmake test-blc test-blc-uni test-blc-tromp test-ulamb test-lazyk\n```\n\n- The files `examples/*.cl` run both on Common Lisp and LambdaLisp producing identical results, except for the initial `\u003e ` printed by the REPL in LambdaLisp. For programs with the extension `*.cl`, the programs are run in Steel Bank Common Lisp (SBCL) and LambdaLisp, and the outputs are compared.\n- The files `examples/*.lisp` are LambdaLisp-exclusive programs. The output of these files are compared with `test/*.lisp.out`.\n- LambdaLisp runs on three lambda-calculus-based and SKI-combinator-calculus-based languages,\n  binary lambda calculus, Universal Lambda, and Lazy K.\n  For binary lambda calculus, there are three interpreters, Blc, uni, and tromp.\n  Each `make` command shown here runs this test in each of the languages and interpreters.\n\n### LambdaCraft Compiler Hosting Test\n- `examples/lambdacraft.cl` runs [LambdaCraft](https://github.com/woodrush/lambdacraft), a Common-Lisp-to-lambda-calculus compiler written in Common Lisp,\n  used to compile the lambda calculus source for LambdaLisp.\n  It defines a binary lambda calculus (BLC) program that prints the letter `A` and exits, \n  and prints the BLC source code for the defined program.\n- The LambdaCraft compiler hosting test first executes `examples/lambdacraft.cl` on LambdaLisp, then runs the output BLC program on a BLC interpreter, and checks if it prints the letter `A` and exits.\n- The test is run on binary lambda calculus, with either the interpreter Blc or uni.\n\nRunnable with:\n```sh\nmake test-compiler-hosting-blc test-compiler-hosting-blc-uni\n```\n\n### Experimental: Self-Hosting Test\nThis test is currently theoretical since it requires a lot of time and memory, and is unused in `make test-all`.\nThis test extends the previous LambdaCraft compiler hosting test and checks if the Common Lisp source code for LambdaLisp runs on LambdaLisp itself. Since the LambdaCraft compiler hosting test runs properly, this test should theoretically run as well, although it requires a tremendous amount of memory and time. The test is run on the binary lambda calculus interpreter Blc.\n\nOne concern is whether the 32-bit heap address space used internally in LambdaLisp is enough to compile this program. This can be solved by compiling LambdaLisp with an address space of 64-bit or larger, which can be done simply by replacing the literal `32` (which only appears once in `src/lambdalisp.cl`) with `64`, etc.\nAnother concern is whether if the execution hits Blc's maximum term limit. This can be solved by compiling Blc with a larger memory limit, by editing the rule for `$(BLC)` in the Makefile.\n\n\nRunnable with:\n```sh\nmake test-self-host\n```\n\n## Lambda Calculus Interpreter Written in LambdaLisp\nThe [examples-advanced](./examples-advanced/) directory features lambda calculus interpreters written in LambdaLisp itself.\nThis means that we have a lambda calculus interpreter written in Lisp, which is written in lambda calculus, that runs on a lambda calculus interpreter.\n\nFurthermore, the interpreter [lisplambda-bit.lisp](./examples-advanced/lisplambda-bit.lisp)\nis capable of running [uni.blc](https://www.ioccc.org/2012/tromp/uni.blc),\nthe bit-oriented BLC self-interpreter from the IOCCC 2012 \"Most functional\" entry written by John Tromp.\nuni.blc is a bit-oriented BLC interpreter written in bit-oriented BLC itself.\nFrom the standard input, it takes a program and a standard input, and evaluates the result of the program applied with the standard input.\n\nThis means that we have a lambda calculus interpreter written in lambda calculus itself, which runs on a lambda calculus interpreter written in Lisp, which is written in lambda calculus, that runs on a lambda calculus interpreter.\n\n\n## How it Works\nImplementation details are introduced in [this blog post](https://woodrush.github.io/blog/lambdalisp.html).\n","funding_links":[],"categories":["Common Lisp","Esoteric Lisp interpreters"],"sub_categories":["Other Esoteric Assemblers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoodrush%2Flambdalisp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoodrush%2Flambdalisp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoodrush%2Flambdalisp/lists"}