60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
id: "blc"
|
|
aliases:
|
|
- "binarylambdacalculus"
|
|
- "lc"
|
|
- "binary"
|
|
- "lambdacalculus"
|
|
- "lambda"
|
|
name: "Binary Lambda Calculus"
|
|
|
|
info:
|
|
year: 2004
|
|
desc: "Minimal, pure functional programming language invented by John Tromp in 2004, based on a binary encoding of the untyped lambda calculus in De Bruijn index notation"
|
|
ext: blc
|
|
web:
|
|
wiki: "https://en.wikipedia.org/wiki/Binary_combinatory_logic"
|
|
esolang: "https://esolangs.org/wiki/Binary_lambda_calculus"
|
|
home: "https://tromp.github.io/cl/Binary_lambda_calculus.html"
|
|
impl: "https://www.ioccc.org/2012/tromp/hint.html"
|
|
source: "https://www.ioccc.org/2012/tromp/tromp.c"
|
|
category: esoteric
|
|
mode: interpreted
|
|
platform: []
|
|
syntax: []
|
|
typing: lambda
|
|
paradigm: functional
|
|
usage: []
|
|
|
|
install:
|
|
prepare:
|
|
apt:
|
|
- clang
|
|
apt:
|
|
- python3
|
|
scripts:
|
|
binary-to-text: |
|
|
#!/usr/bin/env python3
|
|
|
|
import re
|
|
import sys
|
|
|
|
text = re.sub(r"[^01]", "", sys.stdin.read())
|
|
out = []
|
|
|
|
for m in re.finditer(r"([01]{8})", text):
|
|
out += chr(int(m.group(0), 2))
|
|
|
|
print("".join(out), end="")
|
|
manual: |
|
|
install -d "${pkg}/usr/local/bin"
|
|
wget https://www.ioccc.org/2012/tromp/tromp.c
|
|
clang tromp.c -Wno-everything -DInt=long -DX=8 -DA=500000 -o "${pkg}/usr/local/bin/tromp"
|
|
|
|
main: "main.blc"
|
|
template: |
|
|
001010100100100001100101011011000110110001101111001011000010
|
|
000001110111011011110111001001101100011001000010000100001010
|
|
|
|
run: |
|
|
cat main.blc | binary-to-text | tromp
|