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

View File

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

View File

@ -1,15 +1,6 @@
id: "beatnik" id: "beatnik"
name: "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: info:
impl: "Cat's Eye Beatnik" impl: "Cat's Eye Beatnik"
year: 2001 year: 2001
@ -28,6 +19,15 @@ info:
paradigm: stack paradigm: stack
usage: [] 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" main: "main.beatnik"
template: | template: |
Soars, larkspurs, rains. Soars, larkspurs, rains.

View File

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

View File

@ -25,6 +25,31 @@ info:
paradigm: functional paradigm: functional
usage: [] 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" main: "main.blc"
template: | template: |
001010100100100001100101011011000110110001101111001011000010 001010100100100001100101011011000110110001101111001011000010

View File

@ -26,6 +26,19 @@ info:
- oo - oo
usage: [] 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: | setup: |
mkdir -p "$HOME/.local/share" && touch "$HOME/.local/share/booish_history" mkdir -p "$HOME/.local/share" && touch "$HOME/.local/share/booish_history"

View File

@ -27,9 +27,39 @@ info:
install: install:
apt: apt:
- beef - 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: | repl: |
brainf-repl brainf
input: | input: |
>++>+[>++++[-<++++>]<<]> [>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]< >++>+[>++++[-<++++>]<<]> [>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<
output: | output: |
@ -67,6 +97,6 @@ template: |
>++. >++.
run: | run: |
brainf-repl main.bf brainf main.bf
hello: | hello: |
Hello World Hello World

View File

@ -17,8 +17,35 @@ info:
paradigm: stack paradigm: stack
usage: [] 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: | repl: |
NODE_PATH=/opt/cat node /opt/cat/repl.js cat-lang
input: | input: |
123 234 mul 123 234 mul
@ -27,6 +54,6 @@ template: |
72 101 108 108 111 44 32 119 111 114 108 100 33 10 72 101 108 108 111 44 32 119 111 114 108 100 33 10
run: | run: |
NODE_PATH=/opt/cat node /opt/cat/repl.js main.cat cat-lang main.cat
hello: | hello: |
72,101,108,108,111,44,32,119,111,114,108,100,33,10 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) { if (npm) {
for (const fullname of npm) { for (let fullname of npm) {
const basename = fullname.replace(/^[^\/]+\//g, ""); let arg;
if (typeof fullname === "string") {
arg = fullname;
} else {
arg = fullname.arg;
fullname = fullname.name;
}
let basename = fullname.replace(/^[^\/]+\//g, "");
parts.push(`\ parts.push(`\
install -d "\${pkg}/usr/local/bin" install -d "\${pkg}/usr/local/bin"
install -d "\${pkg}/opt/${basename}/lib" 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 if [[ -d "$\{pkg}/opt/${basename}/bin" ]]; then
ls "$\{pkg}/opt/${basename}/bin" | while read name; do ls "$\{pkg}/opt/${basename}/bin" | while read name; do
if readlink "\${pkg}/opt/${basename}/bin/\${name}" | grep -q '/${fullname}/'; then if readlink "\${pkg}/opt/${basename}/bin/\${name}" | grep -q '/${fullname}/'; then
ln -s "/opt/${basename}/bin/\${name}" "\${pkg}/usr/local/bin/\${name}" ln -s "/opt/${basename}/bin/\${name}" "\${pkg}/usr/local/bin/\${name}"
fi fi
done 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`); fi`);
} }
} }