diff --git a/backend/src/langs.ts b/backend/src/langs.ts index fd1afe1..3b76f32 100644 --- a/backend/src/langs.ts +++ b/backend/src/langs.ts @@ -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", diff --git a/scripts/docker-install-phase6.bash b/scripts/docker-install-phase6.bash index eac280c..4c30a43 100755 --- a/scripts/docker-install-phase6.bash +++ b/scripts/docker-install-phase6.bash @@ -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 diff --git a/scripts/docker-install-phase7.bash b/scripts/docker-install-phase7.bash index 420214e..6a58887 100755 --- a/scripts/docker-install-phase7.bash +++ b/scripts/docker-install-phase7.bash @@ -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"