Make more languages work

This commit is contained in:
Radon Rosborough 2021-01-09 15:36:14 -08:00
parent f50c177007
commit ac39b15e16
9 changed files with 204 additions and 50 deletions

View File

@ -20,15 +20,24 @@ function riju-exec {
}
function daemon {
has daemon && riju-exec "$(get daemon)"
if has daemon; then
echo "$(get daemon)"
riju-exec "$(get daemon)"
fi
}
function setup {
has setup && riju-exec "$(get setup)"
if has setup; then
echo "$(get setup)"
riju-exec "$(get setup)"
fi
}
function repl {
has repl && riju-exec "$(get repl)"
if has repl; then
echo "$(get repl)"
riju-exec "$(get repl)"
fi
}
function main {
@ -39,11 +48,17 @@ function main {
}
function compile {
has compile && echo "$(get compile)" && riju-exec "$(get compile)"
if has compile; then
echo "$(get compile)"
riju-exec "$(get compile)"
fi
}
function run-only {
has run && echo "$(get run)" && riju-exec "$(get run)"
if has run; then
echo "$(get run)"
riju-exec "$(get run)"
fi
}
function run {
@ -51,12 +66,21 @@ function run {
}
function format {
has format && echo "$(get format.run)" && riju-exec "( $(get format.run) ) < $(get main)"
if has format; then
echo "$(get format.run)"
riju-exec "( $(get format.run) ) < $(get main)"
fi
}
function lsp {
has lsp.setup && echo "$(get lsp.setup)" && riju-exec "$(get lsp.setup)"
has lsp && echo "$(get lsp.start)" && riju-exec "$(get lsp.start)"
if has lsp.setup; then
echo "$(get lsp.setup)"
riju-exec "$(get lsp.setup)"
fi
if has lsp; then
echo "$(get lsp.start)"
riju-exec "$(get lsp.start)"
fi
}
if [[ -z "$NS" ]]; then

View File

@ -30,9 +30,11 @@ less
make
man
nodejs
python3-pip
ripgrep
sudo
tmux
tree
unzip
vim
wget

View File

@ -1,15 +1,6 @@
id: "beatnik"
name: "Beatnik"
install:
apt:
- python2
manual: |
install -d "${pkg}/usr/local/bin"
git clone https://github.com/catseye/Beatnik.git
sed -i 's#env python#env python2#' Beatnik/script/beatnik.py
cp Beatnik/script/beatnik.py "${pkg}/usr/local/bin/beatnik"
info:
impl: "Cat's Eye Beatnik"
year: 2001
@ -28,6 +19,15 @@ info:
paradigm: stack
usage: []
install:
apt:
- python2
manual: |
install -d "${pkg}/usr/local/bin"
git clone https://github.com/catseye/Beatnik.git
sed -i 's#env python#env python2#' Beatnik/script/beatnik.py
cp Beatnik/script/beatnik.py "${pkg}/usr/local/bin/beatnik"
main: "main.beatnik"
template: |
Soars, larkspurs, rains.

View File

@ -3,6 +3,32 @@ 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
@ -36,32 +62,6 @@ install:
process.exit(1);
});
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: []
main: "main.be"
template: |
64+"!dlrow ,olleH">:#,_@

View File

@ -25,6 +25,31 @@ info:
paradigm: functional
usage: []
install:
prepare:
apt:
- clang
apt:
- python3
scripts:
binary-to-text: |
#!/usr/bin/env python3
import re
import sys
text = re.sub(r"[^01]", "", sys.stdin.read())
out = []
for m in re.finditer(r"([01]{8})", text):
out += chr(int(m.group(0), 2))
print("".join(out), end="")
manual: |
install -d "${pkg}/usr/local/bin"
wget https://www.ioccc.org/2012/tromp/tromp.c
clang tromp.c -Wno-everything -DInt=long -DX=8 -DA=500000 -o "${pkg}/usr/local/bin/tromp"
main: "main.blc"
template: |
001010100100100001100101011011000110110001101111001011000010

View File

@ -26,6 +26,19 @@ info:
- oo
usage: []
install:
apt:
- mono-runtime
- mono-devel
manual: |
install -d "${pkg}/usr/local/lib"
install -d "${pkg}/usr/local/bin"
wget https://github.com/boo-lang/boo/releases/download/unstable/boo-latest.zip
unzip boo-latest.zip
mv -T boo-latest "${pkg}/usr/local/lib/boo"
chmod +x "${pkg}/usr/local/lib/boo/booc" "${pkg}/usr/local/lib/boo/booish"
ln -s /usr/local/lib/boo/booc /usr/local/lib/boo/booish "${pkg}/usr/local/bin/"
setup: |
mkdir -p "$HOME/.local/share" && touch "$HOME/.local/share/booish_history"

View File

@ -27,9 +27,39 @@ info:
install:
apt:
- beef
- python3
scripts:
brainf: |
#!/usr/bin/env python3
import argparse
import readline
import subprocess
import tempfile
parser = argparse.ArgumentParser()
parser.add_argument("file", nargs="?")
args = parser.parse_args()
if args.file:
subprocess.run(["beef", args.file])
while True:
try:
code = input("bf> ")
except KeyboardInterrupt:
print("^C")
continue
except EOFError:
print("^D")
break
if not code:
continue
with tempfile.NamedTemporaryFile(mode="w") as f:
f.write(code)
f.flush()
subprocess.run(["beef", f.name])
repl: |
brainf-repl
brainf
input: |
>++>+[>++++[-<++++>]<<]> [>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<
output: |
@ -67,6 +97,6 @@ template: |
>++.
run: |
brainf-repl main.bf
brainf main.bf
hello: |
Hello World

View File

@ -17,8 +17,35 @@ info:
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: |
NODE_PATH=/opt/cat node /opt/cat/repl.js
cat-lang
input: |
123 234 mul
@ -27,6 +54,6 @@ template: |
72 101 108 108 111 44 32 119 111 114 108 100 33 10
run: |
NODE_PATH=/opt/cat node /opt/cat/repl.js main.cat
cat-lang main.cat
hello: |
72,101,108,108,111,44,32,119,111,114,108,100,33,10

View File

@ -38,18 +38,51 @@ sudo apt-get install -y ${apt.join(" ")}`);
}
}
if (npm) {
for (const fullname of npm) {
const basename = fullname.replace(/^[^\/]+\//g, "");
for (let fullname of npm) {
let arg;
if (typeof fullname === "string") {
arg = fullname;
} else {
arg = fullname.arg;
fullname = fullname.name;
}
let basename = fullname.replace(/^[^\/]+\//g, "");
parts.push(`\
install -d "\${pkg}/usr/local/bin"
install -d "\${pkg}/opt/${basename}/lib"
npm install ${fullname} -g --prefix "\${pkg}/opt/${basename}"
npm install ${arg} -g --prefix "\${pkg}/opt/${basename}"
if [[ -d "$\{pkg}/opt/${basename}/bin" ]]; then
ls "$\{pkg}/opt/${basename}/bin" | while read name; do
if readlink "\${pkg}/opt/${basename}/bin/\${name}" | grep -q '/${fullname}/'; then
ln -s "/opt/${basename}/bin/\${name}" "\${pkg}/usr/local/bin/\${name}"
fi
done
fi`);
}
}
if (pip) {
for (const basename of pip) {
parts.push(`\
install -d "\${pkg}/usr/local/bin"
pip3 install "${basename}" --prefix "\${pkg}/opt/${basename}"
if [[ -d "\${pkg}/opt/${basename}/bin" ]]; then
ls "\${pkg}/opt/${basename}/bin" | while read name; do
version="$(ls "\${pkg}/opt/${basename}/lib" | head -n1)"
cat <<EOF > "\${pkg}/usr/local/bin/\${name}"
#!/usr/bin/env bash
exec env PYTHONPATH="/opt/${basename}/lib/\${version}/site-packages" "/opt/${basename}/bin/\${name}" "\\\$@"
EOF
chmod +x "\${pkg}/usr/local/bin/\${name}"
done
fi
if [[ -d "\${pkg}/opt/${basename}/man" ]]; then
ls "\${pkg}/opt/${basename}/man" | while read dir; do
install -d "\${pkg}/usr/local/man/\${dir}"
ls "\${pkg}/opt/${basename}/man/\${dir}" | while read name; do
ln -s "/opt/${basename}/man/\${dir}/\${name}" "\${pkg}/usr/local/man/\${dir}/\${name}"
done
done
fi`);
}
}