diff --git a/langs/cat.yaml b/langs/cat.yaml index 2fad37d..a3446a0 100644 --- a/langs/cat.yaml +++ b/langs/cat.yaml @@ -26,7 +26,7 @@ install: const args = process.argv.slice(2); if (args.length > 1) { - console.error("usage: repl.js [FILE]"); + console.error("usage: cat-lang [FILE]"); process.exit(1); } diff --git a/langs/yoptascript.yaml b/langs/yoptascript.yaml new file mode 100644 index 0000000..c9a0cc9 --- /dev/null +++ b/langs/yoptascript.yaml @@ -0,0 +1,63 @@ +id: "yoptascript" +aliases: + - "yopta" +name: "YoptaScript" + +info: + year: 2016 + desc: "The world's first scripting programming language for gopniks and real boys" + ext: yopta + web: + home: "https://yopta.space/" + source: "https://github.com/samgozman/YoptaScript" + category: general + mode: interpreted + platform: nodejs + syntax: c + typing: dynamic + paradigm: + - functional + - imperative + - oo + usage: [] + +install: + npm: + - yopta + scripts: + yopta: | + #!/usr/bin/env -S NODE_PATH=/opt/yopta/lib/node_modules node + const fs = require("fs"); + const repl = require("repl"); + + const args = process.argv.slice(2); + if (args.length > 1) { + console.error("usage: yopta [FILE]"); + process.exit(1); + } + + const program = args.length === 1 ? fs.readFileSync(args[0], "utf-8") : null; + + require("yopta"); + + if (program !== null) { + eval(yopta(program)); + } + + repl.start({prompt: yopta> ", eval: (cmd, context, filename, callback) => callback(null, eval(yopta(cmd)))}); + +repl: | + yopta + +main: "main.yopta" +template: | + красноглазое.чмо("Привет мир!") нах +hello: | + Привет мир! + +run: | + yopta main.yopta + +scope: + code: | + x = 123 * 234