[#24] New language: TECO

This commit is contained in:
Radon Rosborough 2020-10-03 13:21:40 -07:00
parent 967ea0f22e
commit d0919686d5
3 changed files with 40 additions and 0 deletions

View File

@ -3238,6 +3238,22 @@ PLEASE LIKE AND SUBSCRIBE
input: `echo "$x"`,
},
template: `echo "Hello, world!"
`,
},
teco: {
aliases: ["mung"],
name: "TECO",
repl: "teco",
input: `123*234=\x1b\x1b`,
main: "main.txt",
compile: "cat main.txt | teco-encode > main.teco",
run: "mung main.teco",
scope: {
code: `123*234UX$$`,
input: `QX=\x1b\x1b`,
},
template: `IHello, world!
$HT$$
`,
},
tex: {

View File

@ -147,6 +147,16 @@ module.exports = { tokenize, Parser, Environment };
EOF
popd >/dev/null
# TECO
git clone https://github.com/blakemcbride/TECOC.git
pushd TECOC/src >/dev/null
make -f makefile.linux
mv tecoc /usr/local/bin/tecoc
ln -s /usr/local/bin/tecoc /usr/local/bin/teco
ln -s /usr/local/bin/tecoc /usr/local/bin/mung
popd >/dev/null
rm -rf TECOC
# Thue
wget -nv "$(curl -sSL https://catseye.tc/distribution/Thue_distribution | grep -Eo 'https://catseye.tc/distfiles/thue-[^"]+\.zip' | head -n1)"
unzip thue-*.zip

View File

@ -237,6 +237,20 @@ const env = new lang.Environment(runtime);
env.run(ast);
EOF
# TECO
tee /usr/local/bin/teco-encode >/dev/null <<"EOF"
#!/usr/bin/env -S python3 -u
import re
import sys
for line in sys.stdin:
line = re.sub(r"\^(.)", lambda m: chr(ord(m.group(1)) ^ 0b1000000), line)
line = line.replace("$", chr(27))
print(line, end="")
EOF
chmod +x /usr/local/bin/teco-encode
# Unlambda
tee /usr/local/bin/unlambda-repl >/dev/null <<"EOF"
#!/usr/bin/env python3