Implement AHEAD, CS-PICK, CS-ROLL (Programming-Tools word set)

Three compile-time words for unstructured control flow:
- AHEAD: unconditional forward branch (code to THEN skipped)
- CS-PICK: duplicate control-flow stack entries (enables multi-exit loops)
- CS-ROLL: rotate control-flow stack entries (reorder IF/THEN resolution)

Also adds POSTPONE support for compile-time keywords (IF, UNTIL, etc.)
via a __CTRL__ host function and unified pending_actions queue.

Key design:
- LoopRestartIfFalse IR op desugars into nested If nodes for CS-PICK'd
  BEGIN+UNTIL patterns (multiple backward branches in one loop)
- Flat Block/BranchIfFalse/EndBlock IR ops for CS-ROLL'd IF/THEN
  patterns where structured If nesting would consume wrong flags
- First-iteration flag local for AHEAD-into-BEGIN patterns (PT8)

Enables 12th compliance test (compliance_tools): all 11+1 now pass.
This commit is contained in:
2026-04-12 18:11:19 +02:00
parent 6118ddc53c
commit 2cb47dc7cf
4 changed files with 516 additions and 17 deletions
-1
View File
@@ -177,7 +177,6 @@ fn compliance_string() {
}
#[test]
#[ignore = "Programming-Tools: 1 error remaining (CS-PICK/CS-ROLL)"]
fn compliance_tools() {
let mut vm = boot_with_prerequisites();
let errors = run_suite(&mut vm, "toolstest.fth");