├── bin └── graph.png ├── src ├── asc2bit.c ├── asc2bin.c ├── bcl2ski.c └── graph.dot ├── LICENSE ├── Makefile └── README.md /bin/graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/woodrush/lambda-calculus-devkit/HEAD/bin/graph.png -------------------------------------------------------------------------------- /src/asc2bit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (void) { 5 | char c; 6 | while ((c = getchar()) != EOF) { 7 | for (int mask = (1 << 7); mask; mask >>= 1) { 8 | putchar('0' + (c & mask ? 1 : 0)); 9 | fflush(stdout); 10 | } 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/asc2bin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main (void) { 5 | char c; 6 | char buf = 0; 7 | int mask = 1 << 7; 8 | int n = 0; 9 | while ((c = getchar()) != EOF) { 10 | if (c & 1) { 11 | buf |= mask; 12 | } 13 | mask >>= 1; 14 | n++; 15 | if (n == 8) { 16 | putchar(buf); 17 | fflush(stdout); 18 | buf = 0; 19 | mask = 1 << 7; 20 | n = 0; 21 | } 22 | } 23 | if (n > 0) { 24 | putchar(buf); 25 | } 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /src/bcl2ski.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char get01 () { 4 | char c; 5 | do { 6 | c = getchar(); 7 | } while (!(c == '0' || c == '1' || c == EOF)); 8 | return c; 9 | } 10 | 11 | int main (void) { 12 | char c; 13 | while ((c = get01()) != EOF) { 14 | if (c == '0') { 15 | c = get01(); 16 | if (c == '0') { 17 | putchar('k'); 18 | } else if (c == '1') { 19 | putchar('s'); 20 | } else { 21 | fputs("Error: Unexpected EOF", stderr); 22 | return 1; 23 | } 24 | } else if (c == '1') { 25 | putchar('`'); 26 | } 27 | } 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Hikaru Ikuta 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/graph.dot: -------------------------------------------------------------------------------- 1 | digraph G { 2 | rankdir=LR 3 | { 4 | rank = same; 5 | lambdacraft [label="LambdaCraft\n(Common Lisp)"] 6 | lam [label="*.lam\n(Plaintext lambda\nwith macros)"] 7 | __l1 [label="Human-friendly code" shape="plaintext"] 8 | } 9 | 10 | { 11 | rank = same; 12 | lam_oneline [label="*.lam\n(One-liner plaintext\nclosed lambda)"] 13 | __l2 [label="Plaintext closed lambda" shape="plaintext"] 14 | } 15 | 16 | { 17 | rank = same; 18 | blc [label="*.blc\n(BLC, ASCII 0/1\nBLC notation)"] 19 | ulamb [label="*.ulamb\n(UL, ASCII 0/1\nBLC notation)"] 20 | lazy [label="*.lazy\n(Lazy K,\nSKI notation)"] 21 | __l3 [label="BLC/SKI notation\n(ASCII)" shape="plaintext"] 22 | } 23 | 24 | { 25 | rank = same; 26 | Blc [label="*.Blc\n(BLC, binary)"] 27 | Ulamb [label="*.Ulamb\n(UL, binary)"] 28 | __l4 [label="0/1 bit streams\npacked to bytes" shape="plaintext"] 29 | } 30 | 31 | { 32 | rank = same; 33 | Blc_interpreter [label="Blc (BLC)"] 34 | unipp [label="uni++ (BLC)"] 35 | tromp [label="tromp (BLC)"] 36 | clamb [label="clamb (UL)"] 37 | lazyk [label="lazyk (Lazy K)"] 38 | __l5 [label="Interpreters" shape="plaintext"] 39 | } 40 | 41 | 42 | lam_oneline -> blc [label="lam2bin/blc-AIT"] 43 | lam_oneline -> ulamb [label="lam2bin/blc-AIT"] 44 | lam -> blc [label="blc-AIT"] 45 | lam -> ulamb [label="blc-AIT"] 46 | lambdacraft -> blc [label="LambdaCraft"] 47 | lambdacraft -> ulamb [label="LambdaCraft"] 48 | lambdacraft -> lazy [label="LambdaCraft"] 49 | lambdacraft -> lam_oneline [label="LambdaCraft"] 50 | 51 | blc -> Blc [label="asc2bin"] 52 | ulamb -> Ulamb [label="asc2bin"] 53 | 54 | Blc -> Blc_interpreter 55 | Blc -> unipp 56 | Blc -> tromp 57 | Ulamb -> clamb 58 | lazy -> lazyk 59 | } 60 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # This setting needs to be changed on a Mac to compile tromp.c (make ./bin/tromp, make test-blc-tromp, etc.). 2 | # Please see README.md for details. 3 | CC=cc 4 | 5 | # Binary lambda calculus 6 | BLC=./bin/Blc 7 | UNI=./bin/uni 8 | TROMP=./bin/tromp 9 | UNIPP=./bin/uni++ 10 | UNID=./bin/unid 11 | UNIOBF=./bin/UniObf 12 | BLCAIT=./bin/blc-ait 13 | 14 | # Universal lambda 15 | CLAMB=./bin/clamb 16 | 17 | # Lazy K 18 | LAZYK=./bin/lazyk 19 | 20 | 21 | # Tools 22 | ASC2BIN=./bin/asc2bin 23 | ASC2BIT=./bin/asc2bit 24 | LAM2BIN=./bin/lam2bin 25 | BCL2SKI=./bin/bcl2ski 26 | 27 | # Others 28 | CABAL=cabal 29 | 30 | 31 | all: interpreters tools 32 | interpreters: blc tromp uni uni++ UniObf clamb lazyk 33 | tools: asc2bin lam2bin blc-ait 34 | 35 | 36 | 37 | .PRECIOUS: out/%.blc-out 38 | out/%.blc-out: examples/% $(target_blc) $(BLC) $(ASC2BIN) 39 | mkdir -p ./out 40 | if [ -f "test/$*.in" ]; then \ 41 | ( cat $(target_blc) | $(ASC2BIN); cat $< test/$*.in ) | $(BLC) > $@.tmp; else \ 42 | ( cat $(target_blc) | $(ASC2BIN); cat $< ) | $(BLC) > $@.tmp; fi 43 | mv $@.tmp $@ 44 | 45 | .PRECIOUS: out/%.blc-tromp-out 46 | out/%.blc-tromp-out: examples/% $(target_blc) $(TROMP) $(ASC2BIN) 47 | mkdir -p ./out 48 | if [ -f "test/$*.in" ]; then \ 49 | ( cat $(target_blc) | $(ASC2BIN); cat $< test/$*.in) | $(TROMP) > $@.tmp; else \ 50 | ( cat $(target_blc) | $(ASC2BIN); cat $< ) | $(TROMP) > $@.tmp; fi 51 | mv $@.tmp $@ 52 | 53 | .PRECIOUS: out/%.blc-uni-out 54 | out/%.blc-uni-out: examples/% $(target_blc) $(UNI) $(ASC2BIN) 55 | mkdir -p ./out 56 | if [ -f "test/$*.in" ]; then \ 57 | ( cat $(target_blc) | $(ASC2BIN); cat $< test/$*.in ) | $(UNI) > $@.tmp; else \ 58 | ( cat $(target_blc) | $(ASC2BIN); cat $< ) | $(UNI) > $@.tmp; fi 59 | mv $@.tmp $@ 60 | 61 | .PRECIOUS: out/%.ulamb-out 62 | out/%.ulamb-out: examples/% $(target_ulamb) $(ULAMB) $(ASC2BIN) 63 | mkdir -p ./out 64 | if [ -f "test/$*.in" ]; then \ 65 | ( cat $(target_ulamb) | $(ASC2BIN); cat $< test/$*.in ) | $(ULAMB) -u > $@.tmp; else \ 66 | ( cat $(target_ulamb) | $(ASC2BIN); cat $< ) | $(ULAMB) -u > $@.tmp; fi 67 | mv $@.tmp $@ 68 | 69 | .PRECIOUS: out/%.lazyk-out 70 | out/%.lazyk-out: examples/% $(target_lazyk) $(LAZYK) 71 | mkdir -p ./out 72 | if [ -f "test/$*.in" ]; then \ 73 | cat $< $*.in | $(LAZYK) $(target_lazyk) -u > $@.tmp; else \ 74 | cat $< | $(LAZYK) $(target_lazyk) -u > $@.tmp; fi 75 | mv $@.tmp $@ 76 | 77 | 78 | #================================================================ 79 | # Building the interpreters 80 | #================================================================ 81 | .PHONY: uni++ 82 | uni++: $(UNIPP) 83 | ./build/binary-lambda-calculus/uni.cpp: 84 | mkdir -p ./build 85 | cd build; git clone https://github.com/melvinzhang/binary-lambda-calculus 86 | 87 | $(UNIPP): ./build/binary-lambda-calculus/uni.cpp 88 | cd build/binary-lambda-calculus && make uni 89 | mv ./build/binary-lambda-calculus/uni $(UNIPP) 90 | 91 | .PHONY: unid 92 | unid: $(UNID) 93 | $(UNID): ./build/binary-lambda-calculus/uni.cpp 94 | cd build/binary-lambda-calculus && make unid 95 | mv ./build/binary-lambda-calculus/unid $(UNID) 96 | 97 | .PHONY: clamb 98 | clamb: $(CLAMB) 99 | ./build/clamb/clamb.c: 100 | mkdir -p ./build 101 | cd build; git clone https://github.com/irori/clamb 102 | 103 | $(CLAMB): ./build/clamb/clamb.c 104 | cd build/clamb; $(CC) -O2 clamb.c -o clamb 105 | mv build/clamb/clamb ./bin 106 | chmod 755 $(CLAMB) 107 | 108 | 109 | .PHONY: lazyk 110 | lazyk: $(LAZYK) 111 | ./build/lazyk/lazyk.c: 112 | mkdir -p ./build 113 | cd build; git clone https://github.com/irori/lazyk 114 | 115 | $(LAZYK): ./build/lazyk/lazyk.c 116 | cd build/lazyk; $(CC) -O2 lazyk.c -o lazyk 117 | mv build/lazyk/lazyk ./bin 118 | chmod 755 $(LAZYK) 119 | 120 | 121 | .PHONY: blc 122 | blc: $(BLC) 123 | build/Blc.S: 124 | mkdir -p ./build 125 | wget https://justine.lol/lambda/Blc.S?v=2 126 | mv Blc.S?v=2 ./build/Blc.S 127 | 128 | build/flat.lds: 129 | mkdir -p ./build 130 | wget https://justine.lol/lambda/flat.lds 131 | mv flat.lds ./build 132 | 133 | $(BLC): build/Blc.S build/flat.lds 134 | # Extend the maximum memory limit to execute large programs 135 | # Make TERMS configurable 136 | cd build; cat Blc.S | sed -e 's/#define.*TERMS.*//' > Blc.ext.S 137 | # Compile with the option -DTERMS=50000000 (larger than the original -DTERMS=5000000) to execute large programs 138 | cd build; $(CC) -c -DTERMS=50000000 -o Blc.o Blc.ext.S 139 | cd build; ld.bfd -o Blc Blc.o -T flat.lds 140 | mv build/Blc ./bin 141 | chmod 755 $(BLC) 142 | 143 | 144 | build/tromp.c: 145 | mkdir -p ./build 146 | wget http://www.ioccc.org/2012/tromp/tromp.c 147 | mv tromp.c ./build 148 | 149 | .PHONY: tromp 150 | tromp: $(TROMP) 151 | $(TROMP): ./build/tromp.c 152 | # Compile with the option -DA=9999999 (larger than the original -DM=999999) to execute large programs 153 | cd build; $(CC) -Wall -W -std=c99 -O2 -m64 -DInt=long -DA=9999999 -DX=8 tromp.c -o tromp 154 | mv build/tromp ./bin 155 | chmod 755 $(TROMP) 156 | 157 | build/uni.c: 158 | mkdir -p ./build 159 | wget https://tromp.github.io/cl/uni.c 160 | mv uni.c ./build 161 | 162 | .PHONY: uni 163 | uni: $(UNI) 164 | $(UNI): ./build/uni.c 165 | # Compile with the option -DA=9999999 (larger than the original -DM=999999) to execute large programs 166 | cd build; $(CC) -Wall -W -O2 -std=c99 -m64 -DM=9999999 uni.c -o uni 167 | mv build/uni ./bin 168 | chmod 755 $(UNI) 169 | 170 | ./build/AIT: 171 | mkdir -p ./build 172 | cd build; git clone https://github.com/tromp/AIT 173 | 174 | .PHONY: blc-ait 175 | blc-ait: $(BLCAIT) 176 | $(BLCAIT): ./build/AIT ./build/AIT/AIT.lhs ./build/AIT/Lambda.lhs ./build/AIT/Main.lhs 177 | # Install Haskell dependencies 178 | $(CABAL) install dlist --lib 179 | $(CABAL) install mtl-2.2.2 --lib 180 | cd ./build/AIT; make blc 181 | mv ./build/AIT/blc ./bin/blc-ait 182 | 183 | .PHONY: UniObf 184 | UniObf: $(UNIOBF) 185 | $(UNIOBF): ./build/AIT ./build/AIT/UniObf.hs 186 | # Install Haskell dependencies 187 | $(CABAL) install dlist --lib 188 | $(CABAL) install mtl-2.2.2 --lib 189 | $(CABAL) install --lib parsec-3.1.14.0 190 | cd ./build/AIT; ghc -O UniObf.hs 191 | mv ./build/AIT/UniObf ./bin 192 | 193 | 194 | .PHONY: asc2bin 195 | asc2bin: $(ASC2BIN) 196 | $(ASC2BIN): ./src/asc2bin.c 197 | mkdir -p build 198 | cd build; $(CC) ../src/asc2bin.c -O2 -o asc2bin 199 | mv build/asc2bin ./bin 200 | chmod 755 $(ASC2BIN) 201 | 202 | .PHONY: asc2bit 203 | asc2bin: $(ASC2BIT) 204 | $(ASC2BIT): ./src/asc2bit.c 205 | mkdir -p build 206 | cd build; $(CC) ../src/asc2bit.c -O2 -o asc2bit 207 | mv build/asc2bit ./bin 208 | chmod 755 $@ 209 | 210 | .PHONY: bcl2ski 211 | bcl2ski: $(BCL2SKI) 212 | $(BCL2SKI): ./src/bcl2ski.c 213 | mkdir -p build 214 | cd build; $(CC) ../src/bcl2ski.c -O2 -o bcl2ski 215 | mv build/bcl2ski ./bin 216 | chmod 755 $(BCL2SKI) 217 | 218 | 219 | .PHONY: lam2bin 220 | lam2bin: $(LAM2BIN) 221 | 222 | build/lam2bin.c: 223 | mkdir -p ./build 224 | wget https://justine.lol/lambda/lam2bin.c 225 | mv lam2bin.c ./build 226 | 227 | build/lam2bin_ext.c: build/lam2bin.c 228 | # Extend the maximum term limit to execute large programs 229 | cd build; cat lam2bin.c | sed 's/int args\[1024\];/int args\[16777216\];/' > lam2bin_ext.c 230 | 231 | $(LAM2BIN): build/lam2bin_ext.c 232 | cd build; $(CC) -O2 -o lam2bin lam2bin_ext.c 233 | mv build/lam2bin ./bin 234 | chmod 755 $(LAM2BIN) 235 | 236 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lambda Calculus Development Toolkit 2 | 3 | This repo is a collection of tools for writing programs in lambda calculus and SKI combinator calculus, written by various authors. 4 | 5 | This repo is designed and intended to be used as a dependency manager for projects related to lambda calculus programming. 6 | 7 | This repo includes tools and interpreters for the following lambda-calculus-based languages: 8 | 9 | - [Binary Lambda Calculus](https://tromp.github.io/cl/cl.html) 10 | - [Universal Lambda](http://www.golfscript.com/lam/) 11 | - [Lazy K](https://tromp.github.io/cl/lazy-k.html) 12 | 13 | 14 | ## Dependency Graph 15 | ![Lambda calculus language dependency graph](./bin/graph.png) 16 | 17 | ## Supported Interpreters and Tools 18 | 19 | Interpreters 20 | 21 | - [Blc](https://justine.lol/lambda/): Written by [Justine Tunney](https://github.com/jart). SectorLambda, a [521-byte lambda calculus interpreter](https://justine.lol/lambda/) 22 | - [tromp](https://www.ioccc.org/2012/tromp/hint.html): Written by [John Tromp](https://github.com/tromp). The [IOCCC](https://www.ioccc.org/) 2012 ["Most functional"](https://www.ioccc.org/2012/tromp/hint.html) interpreter 23 | (its [source](https://www.ioccc.org/2012/tromp/tromp.c) is in the shape of a λ) 24 | - [uni](https://tromp.github.io/cl/cl.html): Written by [John Tromp](https://github.com/tromp). An unobfuscated version of `tromp` 25 | - [uni++](https://github.com/melvinzhang/binary-lambda-calculus): Written by [Melvin Zhang](https://github.com/melvinzhang). A fast binary lambda calculus interpreter written in C++, featuring many speed and memory optimizations. 26 | - A rewrite of `uni`. Originally named `uni`. Named `uni++` in this repo to distinguish from `uni` 27 | - [UniObf](https://github.com/tromp/AIT/blob/master/UniObf.hs): Written by [John Tromp](https://github.com/tromp). A bitwise BLC interpreter written in obfuscated-style Haskell 28 | - [lazyk](https://github.com/irori/lazyk): Written by [Kunihiko Sakamoto](https://github.com/irori). A fast [Lazy K](https://tromp.github.io/cl/lazy-k.html) interpreter 29 | - [clamb](https://github.com/irori/clamb): Written by [Kunihiko Sakamoto](https://github.com/irori). A fast [Universal Lambda](http://www.golfscript.com/lam/) interpreter 30 | 31 | Tools 32 | 33 | - [asc2bin](src/asc2bin.c): Written by [Hikaru Ikuta](https://github.com/woodrush). Packs 0/1 ASCII bit streams to byte streams. Used for BLC interpreters 34 | - [lam2bin](https://justine.lol/lambda/): Written by [Justine Tunney](https://github.com/jart). Parses plaintext lambda terms such as `\x.x` to BLC notation 35 | - [blc-ait](https://github.com/tromp/AIT): Written by [John Tromp](https://github.com/tromp). A multi-functional tool for binary lambda calculus, binary combinator calculus, etc. Includes a head normal form optimizer for lambda terms and many more features. 36 | - Originally named `blc`. Named `blc-ait` in this repo to distinguish between `Blc` 37 | 38 | ## Other Tools 39 | Not included in this repo, but related to lambda calculus programming: 40 | 41 | - [LambdaCraft](https://github.com/woodrush/lambdacraft): Written by Written by [Hikaru Ikuta](https://github.com/woodrush). A Common Lisp DSL for building untyped lambda calculus terms. Compilable with BLC notation and SKI combinator calculus notation, for programming in BLC, UL, and Lazy K. 42 | 43 | 44 | ## Lambda Calculus Interpreter Details 45 | Below is a summary of the supported lambda calculus interpreters. 46 | Each interpreter uses a slightly different I/O encoding, classified below as languages. 47 | 48 | 49 | | Language | Extension | Engine | Program Format | 50 | |----------------------------------------------------------------------|-----------------|-------------------------|------------------------------| 51 | | [Binary Lambda Calculus](https://tromp.github.io/cl/cl.html) | *.blc | Untyped Lambda Calculus | Binary (asc2bin can be used) | 52 | | [Bitwise Binary Lambda Calculus](https://tromp.github.io/cl/cl.html) | *.blc, *.bitblc | Untyped Lambda Calculus | ASCII | 53 | | [Universal Lambda](http://www.golfscript.com/lam/) | *.ulamb | Untyped Lambda Calculus | Binary (asc2bin can be used) | 54 | | [Lazy K](https://tromp.github.io/cl/lazy-k.html) | *.lazy | SKI Combinator Calculus | ASCII | 55 | 56 | | Interpreter | Language | Platforms | Build Command | Author | Notes | 57 | |-----------------------------------------------------------------|--------------------------------|--------------|---------------|------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 58 | | [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/) | 59 | | [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 λ | 60 | | [uni](https://tromp.github.io/cl/cl.html) | Binary Lambda Calculus | Any | `make uni` | [@tromp](https://github.com/tromp) | Unobfuscated version of `tromp` | 61 | | [uni++](https://github.com/melvinzhang/binary-lambda-calculus) | Binary Lambda Calculus | Any | `make uni++` | [@melvinzhang](https://github.com/melvinzhang) | Fast binary lambda calculus interpreter written in C++, featuring many speed and memory optimizations. A rewrite of `uni`. Originally named `uni` | 62 | | [UniObf](https://github.com/tromp/AIT/blob/master/UniObf.hs) | Bitwise Binary Lambda Calculus | Any | `make UniObf` | [@tromp](https://github.com/tromp) | Features optimizations included in `uni++`. Written in obfuscated-style Haskell | 63 | | [clamb](https://github.com/irori/clamb) | Universal Lambda | Any | `make clamb` | [@irori](https://github.com/irori) | Fast UL interpreter | 64 | | [lazyk](https://github.com/irori/lazyk) | Lazy K | Any | `make lazyk` | [@irori](https://github.com/irori) | Fast Lazy K interpreter | 65 | 66 | 67 | ## Building the Interpreters and Tools 68 | To build all interpreters: 69 | 70 | ```sh 71 | make blc tromp uni uni++ UniObf clamb lazyk 72 | ``` 73 | 74 | Several notes about the interpreters: 75 | 76 | - The BLC intepreter `Blc` runs only on x86-64-Linux systems. 77 | - 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. 78 | 79 | To build all tools: 80 | 81 | ```sh 82 | make asc2bin lam2bin blc-ait 83 | ``` 84 | 85 | ### Building `tromp` on a Mac 86 | Mac has `gcc` installed by default or via Xcode Command Line Tools. 87 | However, `gcc` is actually installed as an alias to `clang`, which is a different compiler that doesn't compile `tromp`. 88 | This is confirmable by running `gcc --version`. On my Mac, running it shows: 89 | 90 | ```sh 91 | $ gcc --version 92 | Configured 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 93 | Apple clang version 12.0.0 (clang-1200.0.32.29) 94 | Target: x86_64-apple-darwin19.6.0 95 | Thread model: posix 96 | InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin 97 | ``` 98 | 99 | A workaround for this is to use `uni` instead, which is an unobfuscated version of `tromp` compilable with clang. 100 | To build `tromp`, first install gcc via [Homebrew](https://brew.sh/): 101 | 102 | ```sh 103 | brew install gcc 104 | ``` 105 | 106 | Currently, this should install the command `gcc-11`. 107 | After installing gcc, check the command it has installed. 108 | 109 | Then, edit the `Makefile`'s `CC` configuration: 110 | 111 | ```diff 112 | - CC=cc 113 | + CC=gcc-11 114 | ``` 115 | 116 | Then, running 117 | ```sh 118 | make tromp 119 | ``` 120 | will compile `tromp`. 121 | 122 | 123 | ## Usage 124 | Please see the "Running LambdaLisp" section in my other project [LambdaLisp](https://github.com/woodrush/lambdalisp#running-lambdalisp) for details. 125 | --------------------------------------------------------------------------------