summary_invoke-toto.md 1.3 KB

Summary — toto.mod test build (invoke.sh)

A tiny end-to-end smoke build of a user program, added on top of step 8.3 (suite 106/106).

Files

  • compiler/toto.mod — MODULE toto;, imports FROM TestIO IMPORT WriteString, WriteLn; and prints Hello world, I'm coming to life!.
  • compiler/TestIO.def / compiler/TestIO.mod — minimal WriteString
    • WriteLn, bound to the runtime shim externals (m2write, m2writeln), same approach as stdlib/SysIO. (No TestIO existed in the tree before.)
  • compiler/invoke.sh — the build pipeline, executable.

Pipeline

./M2 TestIO.def TestIO.mod toto.mod        # module `toto` -> gen_ssa/toto.ssa
qbe -o gen_ssa/toto.s gen_ssa/toto.ssa
cc gen_ssa/toto.s ../runtime/syslib/shim.c -o gen_ssa/toto -lm
./gen_ssa/toto

The output name is the module name (toto, as written in the source), not the file name. Session files: definitions/implementations first, the program module last.

Verification

./invoke.sh (from compiler/):

Parsed correctly
--- running gen_ssa/toto ---
Hello world, I'm coming to life!
exit=0

Notes

  • /*.LST added to compiler/.gitignore (driver listings at the compiler root are build artifacts, like src/*.LST and tests/*.LST).
  • invoke.sh is toto-specific; adapt PROG/the ./M2 file list for other programs.