riju/langs/befunge.yaml

71 lines
1.6 KiB
YAML

id: "befunge"
aliases:
- "be"
name: "Befunge"
info:
impl: "amicloud Befunge-93"
version: "Befunge-93"
year: 1993
desc: "Two-dimensional esoteric programming language invented in 1993 by Chris Pressey with the goal of being as difficult to compile as possible"
ext:
- be
- bf
- b93
- b98
- befunge
web:
wiki: "https://en.wikipedia.org/wiki/Befunge"
esolang: "https://esolangs.org/wiki/Befunge"
home: "https://catseye.tc/article/Languages.md#befunge-93"
source: "https://github.com/amicloud/befunge93"
category: esoteric
mode: interpreted
platform: []
syntax:
- golf
- 2d
typing: integer
paradigm: stack
usage: []
install:
npm:
- befunge93
- prompt-sync
scripts:
befunge: |
#!/usr/bin/env -S NODE_PATH=/opt/befunge93/lib/node_modules:/opt/prompt-sync/lib/node_modules node
const fs = require("fs");
const Befunge = require("befunge93");
const prompt = require("prompt-sync")();
const befunge = new Befunge();
befunge.onInput = prompt;
befunge.onOutput = (output) => {
if (typeof output === "string") {
process.stdout.write(output);
} else {
process.stdout.write(output + " ");
}
};
const args = process.argv.slice(2);
if (args.length !== 1) {
console.error("usage: befunge FILE");
process.exit(1);
}
befunge.run(fs.readFileSync(args[0], { encoding: "utf-8" })).catch((err) => {
console.error(err);
process.exit(1);
});
main: "main.be"
template: |
64+"!dlrow ,olleH">:#,_@
run: |
befunge main.be