Files
LithosAnanake/src/word_source
Robert Allan JamesandClaude Sonnet 5 4485c3893b Fix riscv64 hosted acceptance-test doc; port 3 clang-surfaced bugs from punch list
Addresses items #1 (partial) and #2 of
docs/working/archive/session-logs/2026-07-24-punch-list.md.

docs/lithosananke/hosted-acceptance-test/README.md:
- riscv64 leg used riscv64-linux-gnu-gcc, which fails to build this tree
  (nanosleep visibility under -std=c99). Replaced with the working
  clang-18 --target=riscv64-linux-gnu --sysroot=/usr/riscv64-linux-gnu
  invocation, verified end-to-end.
- All three arch sections referenced a -c "<script>" flag that has never
  existed in cli.c/main.c. Corrected to the working
  `echo "..." | starforth -s` pattern, verified on all three architectures.
- Updated Prerequisites: qemu-user alone is sufficient (guest binaries are
  static; qemu-user-static provides static *emulators*, not required here).

Source fixes (ported from the old pre-split monorepo's master, commit
4db9946a, where they were made but never carried over to this line):
- src/math_portable.c: `-100LL << 16` is UB (shifting a negative value)
  under clang's -Wshift-negative-value; changed to `-(100LL << 16)`.
- src/physics_pipelining_metrics.c: removed dead q48_mul_q48()
  (-Wunused-function under clang; GCC doesn't flag this by default).
- src/word_source/editor_words.c: removed dead set_scr() (same reason).

These three were required just to get the documented clang build to
compile at all. The punch list's higher-severity item — a genuine
SIGSEGV-causing register-reuse hazard in vm_pop_asm/vm_rpop_asm
(include/vm_asm_opt_riscv64.h) — is intentionally NOT included here; it's
a separate, more careful change and isn't required for this build to
succeed (latent only under clang; this repo's kernel build uses GCC).

Verified: all three hosted builds compile and run correctly (amd64
native, aarch64 via qemu-aarch64, riscv64 via qemu-riscv64), each
printing "3 Goodbye!" for the piped `1 2 + . BYE` script. All three
Makefile.starkernel builds (amd64/aarch64/riscv64) still compile cleanly
with these shared vendored-source changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-02 07:25:40 -04:00
..

src/word_source/

FORTH-79 word implementations, one file per category, registered into the dictionary via include/word_registry.h. Each .c file here has a matching header in src/word_source/include/ and (for most categories) a matching test module in src/test_runner/modules/.

FORTH-79 core

  • arithmetic_words.c, mixed_arithmetic_words.c+ - * / MOD ABS MIN MAX and mixed-precision arithmetic.
  • stack_words.cDUP DROP SWAP ROT OVER NIP TUCK.
  • control_words.cIF ELSE THEN DO LOOP BEGIN UNTIL WHILE.
  • defining_words.c: ; CREATE DOES> VARIABLE CONSTANT.
  • memory_words.c@ ! C@ C! MOVE FILL.
  • return_stack_words.c>R R> R@ RDROP 2>R 2R@ 2R>.
  • double_words.c2DUP 2DROP 2SWAP 2@ 2! D+ D-.
  • logical_words.cAND OR XOR NOT INVERT LSHIFT RSHIFT.
  • io_words.cEMIT KEY TYPE CR TAB SPACE ACCEPT.
  • string_words.cS" SLITERAL and other string operations.
  • block_words.cBLOCK BUFFER LOAD THRU FLUSH.
  • format_words.c.( .R .S HEX DECIMAL BASE.
  • system_words.cBYE ABORT INCLUDE STATE.
  • dictionary_words.cFIND SEARCH-WORDLIST WORDS.
  • dictionary_manipulation_words.c — dictionary entry manipulation words.
  • vocabulary_words.cVOCABULARY DEFINITIONS FORTH-WORDLIST.
  • editor_words.c — block editor words.
  • defer_words.cDEFER/IS deferred-word mechanism, used by the Tripod message-dispatch shim (see tools/hermes_tripod_smoke.sh).

StarForth-specific extensions

  • q48_16_words.c, q48_words.c — Q48.16 fixed-point word bindings.
  • starforth_words.c — StarForth-specific extensions.
  • acl_words.c — word-level ACL system's FORTH-callable primitives (see docs/03-architecture/word-acl/).
  • lifecycle_words_hosted.c — hosted-build VM lifecycle words (birth/run primitives on the hosted side; kernel-only primitives live in src/starkernel/capsule/mama_forth_words.c).
  • log_words.c — FORTH-callable logging primitives.
  • inference_words.c — FORTH-callable bindings for the statistical inference engine (Loops #5/#6).
  • physics_benchmark_words.c — benchmark harness for the 7 physics feedback loops.
  • physics_diagnostic_words.c — physics diagnostics (WORD-ENTROPY).
  • physics_freeze_words.cPHYSICS-FREEZE / PHYSICS-THAW.
  • physics_pipelining_diagnostic_words.c — Loop #4 pipelining diagnostics.
  • dictionary_heat_diagnostic_words.c — Loop #1 heat diagnostics.

See src/word_source/include/ for the matching headers (also includes mama_forth_words.h, whose .c implementation lives under src/starkernel/capsule/ since it's kernel-only).