plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
8ced458
— Peter John
2026-11-04T23:04:33+05:30
docs: run B T2 split
docs/plans/2026-11-04-language-simplification-b.md
CHANGED
|
@@ -18,14 +18,16 @@
|
|
|
18
18
|
```mermaid
|
|
19
19
|
flowchart LR
|
|
20
20
|
T1[grammar accepts struct for both]
|
|
21
|
+
T2[layout fn]
|
|
21
|
-
|
|
22
|
+
T7[one AST kind]
|
|
22
23
|
T3[codegen uses layout fn]
|
|
23
24
|
T4[rename record to struct]
|
|
24
25
|
T5[remove record keyword]
|
|
25
26
|
T6[verify run B]
|
|
26
27
|
%% taskgraph
|
|
27
28
|
T1 --> T2
|
|
28
|
-
T2 -->
|
|
29
|
+
T2 --> T7
|
|
30
|
+
T7 --> T3
|
|
29
31
|
T3 --> T4
|
|
30
32
|
T4 --> T5
|
|
31
33
|
T5 --> T6
|
|
@@ -46,19 +48,29 @@ e.g. `struct Box[T](value: T)` parses (generic struct)
|
|
|
46
48
|
e.g. `struct H(Actor, k: Int)` parses (embedding)
|
|
47
49
|
**Test code:** corpus cases for both e.g. lines; existing corpus and parser tests green.
|
|
48
50
|
|
|
49
|
-
### T2
|
|
50
|
-
**Owns:** plum-core/src/
|
|
51
|
-
**Components:**
|
|
52
|
-
**LOC owned:**
|
|
53
|
-
**Tests:**
|
|
51
|
+
### T2 layout function · Complexity 3 · Est. context 35k
|
|
52
|
+
**Owns:** plum-core/src/layout.rs, plum-core/src/lib.rs, plum-core/tests/layout_test.rs
|
|
53
|
+
**Components:** 1
|
|
54
|
+
**LOC owned:** 60
|
|
55
|
+
**Tests:** fast
|
|
54
56
|
**Model:** sonnet
|
|
55
57
|
**Consumes:** `struct` accepts everything `record` accepts today (generics `struct Box[T](..)`, embedding, methods block, `mut` fields); `record` still parses as an alias (T1)
|
|
56
|
-
**Produces:**
|
|
58
|
+
**Produces:** layout::structLayout(e: &Enum, all: &[Enum]) -> Layout { Flat, Boxed }
|
|
57
59
|
e.g. `struct Vec2(x: Float, y: Float)` -> Flat
|
|
58
60
|
e.g. `struct Node(kids: List[Node])` -> Boxed (recursive)
|
|
59
61
|
e.g. `struct Walker(Actor, speed: Float)` -> Boxed (embedding)
|
|
60
|
-
**
|
|
61
|
-
|
|
62
|
+
**Test code:** layout_test for the e.g. lines + a struct with a `mut` field -> Boxed. Reads today's AST (isValue/isRecord) — it must return Flat for exactly today's `struct` types and Boxed for today's `record` types on std + examples.
|
|
63
|
+
|
|
64
|
+
### T7 one AST kind · Complexity 4 · Est. context 45k
|
|
65
|
+
**Owns:** plum-core/src/ast.rs, plum-core/src/parser.rs, plum-core/src/embeds.rs, plum-core/src/ctors.rs, plum-core/src/traits.rs, plum-core/src/layout.rs, plum-checker/src/lib.rs, plum-checker/src/unions.rs
|
|
66
|
+
**Components:** 1
|
|
67
|
+
**LOC owned:** 70
|
|
68
|
+
**Tests:** slow
|
|
69
|
+
**Model:** sonnet
|
|
70
|
+
**Consumes:** layout::structLayout(e: &Enum, all: &[Enum]) -> Layout { Flat, Boxed } (T2)
|
|
71
|
+
**Produces:** ast::Enum gets one `isStruct: bool` replacing `isValue` + `isRecord`
|
|
72
|
+
**Review Focus:** every former `isValue` site asks `structLayout(..) == Flat`, every former `isRecord` site asks `isStruct` (or `Boxed` where layout matters); no behaviour change for existing programs.
|
|
73
|
+
**Test code:** gates pass.
|
|
62
74
|
|
|
63
75
|
### T3 codegen uses the layout function · Complexity 4 · Est. context 45k
|
|
64
76
|
**Owns:** plum-wasm-codegen/src/lib.rs, plum-cli/src/main.rs
|