New language: Cat

This commit is contained in:
Radon Rosborough 2020-08-22 23:03:27 -06:00
parent a17c80ae8c
commit 55186a016f
3 changed files with 40 additions and 0 deletions

View File

@ -395,6 +395,17 @@ int main() {
`,
skip: ["lsp"],
},
cat: {
aliases: ["cat-language"],
name: "Cat",
repl: "NODE_PATH=/opt/cat node /opt/cat/repl.js",
input: "123 234 mul",
main: "main.cat",
run: "NODE_PATH=/opt/cat node /opt/cat/repl.js main.cat",
hello: "72,101,108,108,111,44,32,119,111,114,108,100,33,10",
template: `72 101 108 108 111 44 32 119 111 114 108 100 33 10
`,
},
ceylon: {
name: "Ceylon",
main: "source/main.ceylon",

View File

@ -25,6 +25,12 @@ wget -nv https://www.ioccc.org/2012/tromp/tromp.c
clang tromp.c -Wno-everything -DInt=long -DX=8 -DA=500000 -o /usr/local/bin/tromp
rm tromp.c
# Cat
git clone https://github.com/cdiggins/cat-language.git /opt/cat
pushd /opt/cat >/dev/null
npm install
popd >/dev/null
# Erlang
git clone https://github.com/erlang-ls/erlang_ls.git
pushd erlang_ls >/dev/null

View File

@ -130,6 +130,29 @@ while True:
EOF
chmod +x /usr/local/bin/brainf-repl
# Cat
tee /opt/cat/repl.js >/dev/null <<"EOF"
const fs = require("fs");
const repl = require("repl");
const args = process.argv.slice(2);
if (args.length > 1) {
console.error("usage: repl.js [FILE]");
process.exit(1);
}
const program = args.length === 1 ? fs.readFileSync(args[0], "utf-8") : null;
const cat = require("cat");
const ce = new cat.CatLanguage.CatEvaluator();
if (program !== null) {
ce.eval(program);
}
repl.start({prompt: "cat> ", eval: (cmd, context, filename, callback) => callback(null, ce.eval(cmd))});
EOF
# Haskell
mkdir -p /opt/haskell
tee /opt/haskell/hie.yaml >/dev/null <<"EOF"