Forth 2012 compliance: 3→10 word sets passing (44→1 errors)
Major compliance push bringing WAFER from 3 to 10 passing Forth 2012
compliance test suites (Core, Core Extensions, Core Plus, Double,
Exception, Facility, Locals, Memory, Search Order, String).
Compiler/runtime fixes:
- DEFER: host function via pending_define, works inside colon defs
- COMPILE,: handle_pending_compile in execute_word for [...] sequences
- MARKER: full save/restore with pending_marker_restore mechanism
- IMMEDIATE: changed from XOR toggle to OR set per Forth 2012 spec
- ABORT": throw -2 via THROW, no message display when caught
- M*/: symmetric division to match WAFER's / behavior
- pending_define: single i32 flag → Vec<i32> queue for multi-action words
- Optimizer: prevent inlining words containing EXIT or ForthLocal ops
- +LOOP: corrected boundary check formula with AND step comparison
- REPEAT: accept bare BEGIN (unstructured IF...BEGIN...REPEAT)
- Auto-close unclosed IFs at ; for unstructured control flow
- _create_part_: use reserve_fn_index to preserve dictionary.latest()
Memory layout:
- Separate PICT_BUF and WORD_BUF regions to prevent PAD overlap
- Updated DEPTH hardcoded DATA_STACK_TOP in boot.fth
New word sets:
- [IF]/[ELSE]/[THEN]/[DEFINED]/[UNDEFINED]: conditional compilation
- UNESCAPE/SUBSTITUTE/REPLACES: string substitution (host functions)
- Locals {: syntax: parser, ForthLocalGet/Set IR ops, WASM local codegen
- ENVIRONMENT? support for #LOCALS (returns 16)
- N>R/NR>/SYNONYM: programming-tools extensions
- Search Order: ONLY, ALSO, PREVIOUS, DEFINITIONS, FORTH,
FORTH-WORDLIST, GET-ORDER, SET-ORDER, GET-CURRENT, SET-CURRENT,
WORDLIST, SEARCH-WORDLIST with full multi-wordlist dictionary support
via Arc<Mutex> shared state for immediate effect from compiled code
Remaining: 1 cascade error in Programming-Tools from CS-PICK/CS-ROLL
(unstructured control-flow stack manipulation, requires flat IR).
This commit is contained in:
@@ -31,9 +31,21 @@ pub const PAD_BASE: u32 = INPUT_BUFFER_BASE + INPUT_BUFFER_SIZE; // 0x0440
|
||||
/// Size of PAD.
|
||||
pub const PAD_SIZE: u32 = 256;
|
||||
|
||||
/// Pictured numeric output buffer (<# ... #>). Grows downward from top.
|
||||
pub const PICT_BUF_BASE: u32 = PAD_BASE + PAD_SIZE; // 0x0540
|
||||
/// Size of pictured output buffer (2*BITS_PER_CELL + 2 = 66 min, 128 for margin).
|
||||
pub const PICT_BUF_SIZE: u32 = 128;
|
||||
/// Top of pictured output buffer (HLD starts here, grows down).
|
||||
pub const PICT_BUF_TOP: u32 = PICT_BUF_BASE + PICT_BUF_SIZE;
|
||||
|
||||
/// WORD buffer — transient counted-string area for WORD output.
|
||||
pub const WORD_BUF_BASE: u32 = PICT_BUF_TOP; // 0x05C0
|
||||
/// Size of WORD buffer (max name 31 + 1 length + padding).
|
||||
pub const WORD_BUF_SIZE: u32 = 64;
|
||||
|
||||
/// Data stack region (fallback when types are unknown).
|
||||
/// Grows downward from the top of this region.
|
||||
pub const DATA_STACK_BASE: u32 = PAD_BASE + PAD_SIZE; // 0x0540
|
||||
pub const DATA_STACK_BASE: u32 = WORD_BUF_BASE + WORD_BUF_SIZE; // 0x0600
|
||||
/// Size of data stack region.
|
||||
pub const DATA_STACK_SIZE: u32 = 4096; // 1024 cells
|
||||
|
||||
|
||||
Reference in New Issue
Block a user