diff options
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -4,27 +4,27 @@ set -e function log { - >&2 echo "-> $@" + echo "-> $@" "$@" } function cc { mkdir -p bin - [ -n "$3" ] && NAME=$3 || NAME=$(basename $1) - log gcc -Wall -Wextra -Wpedantic -I. -g $2 $1.c -o "bin/$NAME" + [ -n "$3" ] && NAME="$3" || NAME=$(basename "$1") + log gcc -Wall -Wextra -Wpedantic -I. -g $2 "$1.c" -o "bin/$NAME" } function shared { mkdir -p bin - [ -n "$3" ] && NAME=$3 || NAME=$(basename $1) - log gcc -Wall -Wextra -Wpedantic -I. -g -shared -fPIC $2 $1.c -o "bin/$NAME.so" + [ -n "$3" ] && NAME="$3" || NAME=$(basename "$1") + log gcc -Wall -Wextra -Wpedantic -I. -g -shared -fPIC $2 "$1.c" -o "bin/$NAME.so" } function leak { - log valgrind --leak-check=full --show-leak-kinds=all -s bin/$1 "$2" + log valgrind --leak-check=full --show-leak-kinds=all -s bin/"$1" $2 } # cc util/dict -D_DICT_STANDALONE @@ -67,7 +67,15 @@ shared clr-table -D_LAZY_LALR lalr-table shared demos/sample-files/lalr-defs # --- Calc example --- -shared demos/sample-files/calc-defs -leak "generate-parser -t lalr-table bin/calc-defs.so" -cc demos/sample-files/calc-skeleton "" parser -leak parser "13*10+9 - (54*(10+8))" +# shared demos/sample-files/calc-defs +# leak generate-parser "-o bin/calc -t lalr-table bin/calc-defs.so" +# cc demos/sample-files/calc-skeleton "" parser +# leak parser "13*10+9 - (54*(10+8))" # wrong answer +# leak parser "-13 + 20" +# leak parser "1 > 52 ? 2 + 3 : 53" + +# --- Grammar Definitino example --- +shared demos/sample-files/gram-defs +leak generate-parser "-o bin/gram -t lalr-table bin/gram-defs.so" +cc demos/sample-files/gram-skeleton "" parser +leak parser |
