60 lines
1.3 KiB
YAML
60 lines
1.3 KiB
YAML
id: "cat"
|
|
aliases:
|
|
- "cat-language"
|
|
name: "Cat"
|
|
|
|
info:
|
|
year: 2006
|
|
desc: "Statically typed stack-based programming language in C#"
|
|
ext: cat
|
|
web:
|
|
source: "https://github.com/cdiggins/cat-language"
|
|
category: pure
|
|
mode: interpreted
|
|
platform: []
|
|
syntax: tokens
|
|
typing: static
|
|
paradigm: stack
|
|
usage: []
|
|
|
|
install:
|
|
scripts:
|
|
cat-lang: |
|
|
#!/usr/bin/env -S NODE_PATH=/opt/cat node
|
|
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))});
|
|
manual:
|
|
- |
|
|
git clone https://github.com/cdiggins/cat-language "${pkg}/opt/cat"
|
|
|
|
repl: |
|
|
cat-lang
|
|
input: |
|
|
123 234 mul
|
|
|
|
main: "main.cat"
|
|
template: |
|
|
72 101 108 108 111 44 32 119 111 114 108 100 33 10
|
|
|
|
run: |
|
|
cat-lang main.cat
|
|
hello: |
|
|
72,101,108,108,111,44,32,119,111,114,108,100,33,10
|