From 8d32385b4151207fe6212cc1c21e2af2c09c7e46 Mon Sep 17 00:00:00 2001 From: Hydrazer Date: Sun, 28 Nov 2021 07:03:57 -0700 Subject: [PATCH] pkg(brachylog-1.0.0): added brachylog --- package-lock.json | 2 +- packages/brachylog/1.0.0/build.sh | 20 ++++++++++++++++++++ packages/brachylog/1.0.0/environment | 5 +++++ packages/brachylog/1.0.0/metadata.json | 5 +++++ packages/brachylog/1.0.0/run | 19 +++++++++++++++++++ packages/brachylog/1.0.0/test.brachylog | 1 + readme.md | 1 + 7 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 packages/brachylog/1.0.0/build.sh create mode 100644 packages/brachylog/1.0.0/environment create mode 100644 packages/brachylog/1.0.0/metadata.json create mode 100644 packages/brachylog/1.0.0/run create mode 100644 packages/brachylog/1.0.0/test.brachylog diff --git a/package-lock.json b/package-lock.json index 2966933..5c51a1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,4 +29,4 @@ "dev": true } } -} \ No newline at end of file +} diff --git a/packages/brachylog/1.0.0/build.sh b/packages/brachylog/1.0.0/build.sh new file mode 100644 index 0000000..8f35ef2 --- /dev/null +++ b/packages/brachylog/1.0.0/build.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# build prolog 8.2.4 as dependency +source ../../prolog/8.2.4/build.sh + +# curl brachylog 1.0.0 +curl -L "https://github.com/JCumin/Brachylog/archive/refs/tags/v1.0-ascii.tar.gz" -o brachylog.tar.gz +tar xzf brachylog.tar.gz --strip-components=1 +rm brachylog.tar.gz + +# move swi prolog to working directory +cp bin/swipl swipl + +# give execution permission to swipl +chmod +x swipl + +# add some code the branchylog.pl so we don't have to escape backslashes while using the interactive mode +echo ' + +:-feature(argv, [Code, Stdin]), run_from_atom(Code, Stdin, _), halt.' >> prolog_parser/brachylog.pl \ No newline at end of file diff --git a/packages/brachylog/1.0.0/environment b/packages/brachylog/1.0.0/environment new file mode 100644 index 0000000..7012c44 --- /dev/null +++ b/packages/brachylog/1.0.0/environment @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Put 'export' statements here for environment variables +export PATH=$PWD/bin:$PATH +export BRACHYLOG_PATH=$PWD \ No newline at end of file diff --git a/packages/brachylog/1.0.0/metadata.json b/packages/brachylog/1.0.0/metadata.json new file mode 100644 index 0000000..d5df839 --- /dev/null +++ b/packages/brachylog/1.0.0/metadata.json @@ -0,0 +1,5 @@ +{ + "language": "brachylog", + "version": "1.0.0", + "aliases": [] +} diff --git a/packages/brachylog/1.0.0/run b/packages/brachylog/1.0.0/run new file mode 100644 index 0000000..16ce3cd --- /dev/null +++ b/packages/brachylog/1.0.0/run @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# save the file for later +file="$1" + +# remove the file from $@ +shift + +# save stdin as $@ joined by newlines +stdin=`printf "%s\n" "$@"` + +# save code as the contents of $file +code=`cat "$file"` + +# go to the directory where brachylog.pl is so the imports work +cd "$BRACHYLOG_PATH"/prolog_parser + +# run swi prolog with code and stdin +swipl -f brachylog.pl "$code" "$stdin" \ No newline at end of file diff --git a/packages/brachylog/1.0.0/test.brachylog b/packages/brachylog/1.0.0/test.brachylog new file mode 100644 index 0000000..d90d668 --- /dev/null +++ b/packages/brachylog/1.0.0/test.brachylog @@ -0,0 +1 @@ +"OK"w \ No newline at end of file diff --git a/readme.md b/readme.md index ce66d22..135d7ac 100644 --- a/readme.md +++ b/readme.md @@ -325,6 +325,7 @@ Content-Type: application/json `awk`, `bash`, `befunge93`, +`brachylog`, `brainfuck`, `c`, `c++`,