| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/bin/sh
- # Builds the TopSpeed-V3 sidecar front-end (TSM2) from
- # compiler/src/TopSpeed-V3-M2.atg.
- #
- # The sidecar is a *grammar* deliverable: it parses the historical
- # TopSpeed/JPI V3 dialect (pragmas, H/C/B literals, ::=, address
- # constructors, CLASS/IS/VIRTUAL, manifest constants, tagless variant
- # records, ...). It reuses the V3 frontend frame (scanner/parser/
- # compiler .frm) and the V3 SymTab/QbeGen/FileIO modules, so it tracks
- # the V3 API -- a small drift patch is applied here if a call site has
- # moved on (see the sed lines below).
- #
- # Output: build/TSM2 (build/ is git-ignored)
- set -e
- cd "$(dirname "$0")"
- ROOT=../..
- SRC="$ROOT/compiler/src"
- CR="${CR:-$HOME/Projets/Projets-Modula2/MyWork/CocoGm2/CR}"
- B=build
- rm -rf "$B"; mkdir -p "$B"
- cp "$SRC/TopSpeed-V3-M2.atg" "$B/M2.atg"
- # The sidecar uses its OWN scanner frame: it adds TopSpeed conditional
- # compilation ((*%T cond*) / (*%F cond*) / (*%E*)). V3's own scanner
- # (compiler/src/scanner.frm) is left untouched.
- cp "$(pwd)/scanner.frm" "$B/scanner.frm"
- cp "$SRC/parser.frm" "$SRC/compiler.frm" "$B/"
- cp "$SRC/SymTab.def" "$SRC/SymTab.mod" "$SRC/QbeGen.def" "$SRC/QbeGen.mod" \
- "$SRC/FileIO.def" "$SRC/FileIO.mod" "$B/"
- cd "$B"
- echo "=== CR ==="; CRFRAMES="$(pwd)" "$CR" -m -C M2.atg
- echo "=== compile ==="
- for m in FileIO SymTab QbeGen M2S M2P M2; do
- gm2 -fiso -I . -c "$m.mod"
- done
- echo "=== link ==="
- gm2 -fiso -I . -fgen-module-list=modules.lst -o /dev/null \
- M2S.o M2P.o FileIO.o SymTab.o QbeGen.o M2.mod
- gm2 -fiso -I . -fuse-list=modules.lst -o TSM2 \
- M2S.o M2P.o FileIO.o SymTab.o QbeGen.o M2.mod
- echo "=== build/TSM2 built ==="
|