[#24] New language: Tabloid
This commit is contained in:
parent
8222937a06
commit
28029e045d
|
@ -2385,6 +2385,15 @@ END
|
||||||
`,
|
`,
|
||||||
skip: ["lsp"],
|
skip: ["lsp"],
|
||||||
},
|
},
|
||||||
|
tabloid: {
|
||||||
|
name: "Tabloid",
|
||||||
|
main: "main.tabloid",
|
||||||
|
run: "node /opt/tabloid/run.js main.tabloid",
|
||||||
|
hello: "HELLO, WORLD!",
|
||||||
|
template: `YOU WON'T WANT TO MISS "Hello, world"
|
||||||
|
PLEASE LIKE AND SUBSCRIBE
|
||||||
|
`,
|
||||||
|
},
|
||||||
tcl: {
|
tcl: {
|
||||||
aliases: ["tclsh", "tclshrc"],
|
aliases: ["tclsh", "tclshrc"],
|
||||||
name: "Tcl",
|
name: "Tcl",
|
||||||
|
|
|
@ -104,6 +104,15 @@ mv snobol4 /usr/local/bin/snobol4
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
rm -rf snobol4-*
|
rm -rf snobol4-*
|
||||||
|
|
||||||
|
# Tabloid
|
||||||
|
mkdir /opt/tabloid
|
||||||
|
pushd /opt/tabloid >/dev/null
|
||||||
|
wget -nv https://github.com/thesephist/tabloid/raw/master/static/js/lang.js
|
||||||
|
cat <<"EOF" >> lang.js
|
||||||
|
module.exports = { tokenize, Parser, Environment };
|
||||||
|
EOF
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
# Thue
|
# Thue
|
||||||
wget -nv "$(curl -sSL https://catseye.tc/distribution/Thue_distribution | grep -Eo 'https://catseye.tc/distfiles/thue-[^"]+\.zip' | head -n1)"
|
wget -nv "$(curl -sSL https://catseye.tc/distribution/Thue_distribution | grep -Eo 'https://catseye.tc/distfiles/thue-[^"]+\.zip' | head -n1)"
|
||||||
unzip thue-*.zip
|
unzip thue-*.zip
|
||||||
|
|
|
@ -216,6 +216,27 @@ if (program !== null) {
|
||||||
repl.start({prompt: "قلب> ", eval: (cmd, context, filename, callback) => callback(null, Qlb.execute(cmd))});
|
repl.start({prompt: "قلب> ", eval: (cmd, context, filename, callback) => callback(null, Qlb.execute(cmd))});
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Tabloid
|
||||||
|
tee /opt/tabloid/run.js >/dev/null <<"EOF"
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
if (args.length !== 1) {
|
||||||
|
console.error("usage: run.js FILE");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const lang = require("./lang");
|
||||||
|
|
||||||
|
const program = fs.readFileSync(args[0], "utf-8");
|
||||||
|
const tokens = lang.tokenize(program);
|
||||||
|
const parser = new lang.Parser(tokens);
|
||||||
|
const ast = parser.parse();
|
||||||
|
const runtime = { print: (s) => console.log(s.toString().toUpperCase() + "!") };
|
||||||
|
const env = new lang.Environment(runtime);
|
||||||
|
env.run(ast);
|
||||||
|
EOF
|
||||||
|
|
||||||
# Unlambda
|
# Unlambda
|
||||||
tee /usr/local/bin/unlambda-repl >/dev/null <<"EOF"
|
tee /usr/local/bin/unlambda-repl >/dev/null <<"EOF"
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
Loading…
Reference in New Issue