plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


a269f58 — Peter John 2026-11-04T19:50:23+05:30
docs: phase 3a T1 split
docs/plans/2026-11-04-compiler-cleanup-phase3a.md CHANGED
@@ -29,9 +29,11 @@ flowchart LR
29
29
  T2[codegen state]
30
30
  T3[core counters]
31
31
  T4[fusion globals out]
32
+ T6[checker unions traits]
32
33
  T5[verify 3a]
33
34
  %% taskgraph
34
- T1 --> T4
35
+ T1 --> T6
36
+ T6 --> T4
35
37
  T2 --> T4
36
38
  T1 --> T5
37
39
  T2 --> T5
@@ -43,10 +45,10 @@ Ruling: sequential - T4 edits checker and codegen lib.rs after T1/T2 - cost: one
43
45
  ## Package A: state
44
46
  **Probe entry:** run=bash scripts/wasm-hashes.sh
45
47
 
46
- ### T1 checker state value · Complexity 5 · Est. context 55k
48
+ ### T1 checker state value · Complexity 5 · Est. context 50k
47
- **Owns:** plum-checker/src/lib.rs, plum-checker/src/unions.rs, plum-checker/src/traits.rs, plum-checker/src/state.rs
49
+ **Owns:** plum-checker/src/lib.rs, plum-checker/src/state.rs
48
50
  **Components:** 1
49
- **LOC owned:** 140
51
+ **LOC owned:** 100
50
52
  **Tests:** slow
51
53
  **Model:** sonnet
52
54
  **Produces:** state::CheckState (all former thread-local fields) · state::withCheck<R>(f: impl FnOnce(&mut CheckState) -> R) -> R · state::resetCheck()
@@ -54,7 +56,19 @@ e.g. resetCheck(); withCheck(|s| s.fresh) -> 0
54
56
  e.g. two typedSource calls on the same source -> identical TypedInfo and identical generated names
55
57
  **Review Focus:** `reset_complete`: every field the old `checkSourceOnce` reset by hand is reset by `resetCheck`, and every save/restore pair (union plan in adoptPre/recheckKeep) keeps its semantics; `reentrancy`: no `withCheck` borrow is held across a call that re-enters `withCheck` (use short borrows / Cell-like fields; a RefCell double borrow panics — run the full checker suite to prove none).
56
58
  **Test code:** a `#[cfg(test)]` test for the two e.g. lines; all checker, plum-core and codegen test binaries pass; hashes identical.
57
- **Steps:** move lib.rs 17-58 thread-locals, ALLOW_BARE_TOP, unions.rs IN_WRAP/DEPTH/INLINE/NARROW_TOP and traits.rs TRAITS/TRAIT_FIELDS into `CheckState`; keep FUSION_OPTIONS for T4; COVER_WILDCARD is a constant, leave it.
59
+ **Steps:** move lib.rs 17-58 thread-locals and ALLOW_BARE_TOP into `CheckState`; keep FUSION_OPTIONS for T4; COVER_WILDCARD is a constant, leave it.
60
+
61
+ ### T6 checker unions/traits state · Complexity 3 · Est. context 35k
62
+ **Owns:** plum-checker/src/unions.rs, plum-checker/src/traits.rs, plum-checker/src/state.rs
63
+ **Components:** 1
64
+ **LOC owned:** 50
65
+ **Tests:** slow
66
+ **Model:** sonnet
67
+ **Consumes:** state::withCheck<R>(f: impl FnOnce(&mut CheckState) -> R) -> R (T1) · state::resetCheck() (T1)
68
+ **Produces:** none
69
+ **Review Focus:** `reentrancy` as in T1; TRAITS/TRAIT_FIELDS are filled once per program — reset with the rest, refilled where they are filled today.
70
+ **Test code:** checker traits/unions/trait_fields test binaries pass; hashes identical.
71
+ **Steps:** unions.rs IN_WRAP/DEPTH/INLINE/NARROW_TOP and traits.rs TRAITS/TRAIT_FIELDS → fields of `CheckState`.
58
72
 
59
73
  ### T2 codegen state value · Complexity 4 · Est. context 50k
60
74
  **Owns:** plum-wasm-codegen/src/lib.rs