diff options
Diffstat (limited to 'bfc.sh')
| -rwxr-xr-x | bfc.sh | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -0,0 +1,24 @@ +#!/usr/bin/env sh + +set -e + +BFC="./build/bfc" +SRC="$1" + +if [ -z "$SRC" ]; then + echo "usage: $0 <file.bf>" >&2 + exit 1 +fi + +# silently build compiler if missing +if [ ! -f "$BFC" ]; then + make -s || { + echo "build failed" >&2 + exit 1 + } +fi + +# compile pipeline +OUT=$(cat "$SRC" | "$BFC") + +echo "$OUT" | gcc -o ./bf.out -x c - |
