| 12345678910111213141516171819202122232425262728293031323334353637 |
- #!/bin/bash
- # Build the Blaise Pascal syntax validator from blaise_pascal.atg.
- # Needs: CR (Coco/R V1.53), gm2 -fiso, parser/scanner frames, FileIO.
- # Note: link via the two-step module list; a single-step link trips
- # over pre-existing errors in this gm2 build's own ISO library .defs.
- set -e
- CR="${CR:-/home/eric/Projets/Projets-Modula2/MyWork/CocoGm2/CR}"
- GM2="${GM2:-/home/eric/bin/Modula2/Gm2/bin/gm2}"
- FRAMES="${CRFRAMES:-/home/eric/Projets/Projets-Modula2/MyWork/Theia/GNU-grammar/build}"
- M2LIB="${M2LIB:-/home/eric/Projets/Projets-Modula2/MyWork/Theia/GNU-grammar/build}"
- HERE="$(cd "$(dirname "$0")" && pwd)"
- B="$HERE/build"
- rm -rf "$B"
- mkdir -p "$B"
- cp "$HERE/blaise_pascal.atg" "$HERE/TextFilter.mod" "$B/"
- cp "$M2LIB/FileIO.def" "$M2LIB/FileIO.mod" "$B/"
- cd "$B"
- echo "=== CR ==="; CRFRAMES="$FRAMES" "$CR" -m -C blaise_pascal.atg
- echo "=== compile ==="
- for m in FileIO BlaiseS BlaiseP Blaise TextFilter; do "$GM2" -fiso -I . -c "$m.mod"; done
- echo "=== link ==="
- # NOTE: the gen step exits 1 on pre-existing errors in gm2's own
- # ISO library .defs, but still writes a usable modules.lst.
- "$GM2" -fiso -I . -fgen-module-list=modules.lst -o /dev/null FileIO.o BlaiseS.o BlaiseP.o Blaise.mod || true
- "$GM2" -fiso -I . -fuse-list=modules.lst -o BlaiseParse FileIO.o BlaiseS.o BlaiseP.o Blaise.mod
- rm -f TextFilter.o
- "$GM2" -fiso -I . -fgen-module-list=modules.lst -o /dev/null FileIO.o TextFilter.mod || true
- "$GM2" -fiso -I . -fuse-list=modules.lst -o BlaiseTF FileIO.o TextFilter.mod
- cp "$HERE/BlaiseV.sh" BlaiseV
- chmod +x BlaiseV
- echo "=== smoke ==="
- printf 'program Hello;\nbegin\n WriteLn('"'"'hi'"'"');\nend.\n' > Hello.pas
- ./BlaiseV Hello.pas
- printf 'program Tb;\nvar s: String;\nbegin\ns := %s\nend.\n' "'''$(printf '\ndon'"'"'t\n')''';" > Tb.pas
- ./BlaiseV Tb.pas
- ./BlaiseV "$HERE/tests/deep.pas"
- rm -f Hello.pas Hello.LST Tb.pas Tb.LST "$HERE/tests/deep.LST"
|