Files
zen/core/expression/tests/spec/standard/01-syntax.csv
T
stefan-gorules 4a378bafc4 feat(expression): lane VM and typed-mask engine for batch and columna evaluation (#553)
* feat(expression): lane VM and typed-mask engine for batch and columnar evaluation

Adds a register-based lane VM (core/expression/src/lane) and a typed-mask
engine (core/expression/src/typed) that evaluate ZEN expressions over
batches and columns, matching the stack VM's results. zen-types gains
shape-backed objects and dot-path helpers; existing public APIs only grow.

The lane VM has no expression size limit: deep and wide expressions are
compiled and run with the same stack growth the parser uses.

ZEN_EXPRESSION_CONFIG.lane (off by default) switches Isolate::run_standard
and run_unary to the lane VM at runtime. Lane internals and the typed
module are doc(hidden); the documented entry points are LaneProgram,
LaneRunner, Session, Columns and Output.

Includes an executable specification of the expression language
(core/expression/tests/spec, 28,852 cases) with differential tests that
run every lane path against the stack VM.

zen-expression and zen-types now declare rust-version 1.88.

* refactor(types): remove the shape transition cap

Shapes are freed when nothing uses them, so the 4,096-children cap per
shape no longer bounds memory. Shape::with, Shape::of and Shape::without
now always return a shape; objects only switch to a hash map past
SPILL_AT keys, as on master.

* fix(expression): debug-profile stack safety and Windows test build

CI runs tests in the debug profile, where frames are larger and tail
recursion is not optimised. Recursive lane, typed and parser helpers now
grow the stack like the rest (Const::number, the kernel builder, typed
lowering and lookup, lane compile helpers, Node::member_key).

The parser's closure depth counter is u32 instead of u8, so 256 nested
closures no longer wrap. median([]) and empty templates no longer
overflow in debug builds; release results are unchanged.

The deep/wide test runs on a 256 KiB stack so unprotected recursion
fails quickly in any profile. The conformance helper compares with
as_str(), which is unambiguous on Windows.

* fix(expression): stack checks in the lane executor, LF test data on Windows

In x86-64 debug builds Executor::cold has a ~93 KB frame, so nested
closures (execute -> cold -> body) could use more stack between two
checks than the stack-growth margin and overflow. execute and cold now
check the stack themselves; both run per instruction batch, not per row.

The expression test data is checked out with LF on every platform.
Windows runners converted it to CRLF, which broke multi-line spec cases.
2026-10-28 11:39:54 +01:00

3.2 KiB

1expression (string)input (json 5)output (json 5)note
2# Identifiers: ASCII letters, digits, _ and $
3x{x: 1}1
4_{_: 2}2
5_a{_a: 3}3
6a_b_1{a_b_1: 4}4
7a1{a1: 5}5
8abc123def{abc123def: 6}6
9$${$$: 7}7
10a$b{a$b: 8}8
11camelCase{camelCase: 9}9
12UPPER{UPPER: 10}10
13x{X: 1}null
14X{x: 1}null
15# Keyword prefixes are ordinary identifiers
16android{android: 1}1
17order{order: 2}2
18index{index: 3}3
19notx{notx: 4}4
20nothing{nothing: 5}5
21truex{truex: 6}6
22inx{inx: 7}7
23# Identifiers must not start with a digit or use non-ASCII letters
241a{}!error
251_a{}!error
26é{}!errorquestion: identifiers are ASCII-only
27café{}!errorquestion: identifiers are ASCII-only
28日本{}!errorquestion: identifiers are ASCII-only
29# Unknown characters are lexer errors
30@!error
31a @ b{a: 1, b: 2}!error
32~1!error
331 & 2!error
341 | 2!error
35a\b{}!error
36'a' ` !error
37# Missing and present identifiers
38xnull
39x{}null
40x{x: null}null
41x{x: 0}0
42x{x: ''}''
43x{x: false}false
44x{x: []}[]
45x{x: {}}{}
46x{x: [1, [2]]}[1, [2]]
47x{x: {a: {b: 1}}}{a: {b: 1}}
48x.y{x: {y: 2}}2
49x.y{x: {}}null
50x.y{x: null}null
51x.y{}null
52x.y{x: 'str'}null
53x.y{x: 1}null
54x['y']{x: {y: 2}}2
55x['y']{x: {}}null
56x['y']{x: null}null
57x['y']{}null
58x["y"]{x: {y: 2}}2
59x['a b']{x: {'a b': 3}}3
60x['é']{x: {'é': 4}}4
61x['😀']{x: {'😀': 5}}5
62x.😀{x: {'😀': 5}}!error
63x.1{x: {'1': 6}}!error
64x[1]{x: [5, 6]}6
65x.and{x: {and: 1}}1
66x.in{x: {in: 2}}2
67x.true{x: {true: 1}}1bug: true/false cannot follow a dot although and/in/null can
68x.null{x: {null: 1}}1
69x['and']{x: {and: 1}}1
70# Whitespace: spaces, tabs and newlines
711+23
721 + 23
731 + 2 3
741 + 23
7511
761 + 23
77 1 1
78[ 1, 2, ][1, 2]
79{ a: 1, b: [ 2 ] }{a: 1, b: [2]}
80[1, 2][1, 2]
81{a : 1}{a: 1}
82x . y{x: {y: 2}}2
83x .y{x: {y: 2}}2
84x. y{x: {y: 2}}2
85x [ 'y' ]{x: {y: 2}}2
86x .y{x: {y: 2}}2
87x .y{x: null}null
88x .y{}null
89x .y{x: {y: [1]}}[1]
90# Parentheses
91(1)1
92((1))1
93((((((1))))))1
94# nested parentheses around a closure call over an interval: parse time grows about 4x per level (10 levels take ~1 s, 11 take ~4 s) in the shared parser
95((((((map([0..3], [])))))))[[], [], [], []]
96((((((((map([0..3], [])))))))))[[], [], [], []]
97((((((((flatMap([0..3], [#])))))))))[0, 1, 2, 3]
98((((((((map([0, 3], [])))))))))[[], []]
99( 1 )1
100('a')'a'
101(true)true
102(null)null
103([1])[1]
104({a: 1}){a: 1}
105([1..2])'[1..2]'
106(`t`)'t'
107type((1))'number'
108(1 + 2) * 39
1091 + (2 * 3)7
110(x){x: 1}1
111(x){x: null}null
112(x){}null
113(x){x: 'a'}'a'
114(x).y{x: {y: 1}}1
115(x).y{x: null}null
116(x).y{}null
117(x).y{x: 3}null
118# Unbalanced and empty parentheses
119()!error
120(!error
121)!error
122(1!error
1231)!error
124((1)!error
125(1))!error
126(1)(2)!error
127(1 2)!error
128( )!error
129# Dangling and misplaced operators
1301 +!error
1311 -!error
1321 *!error
133* 1!error
134/ 1!error
1351 * * 2!error
1361 ==!error
137== 1!error
1381 and!error
139and 1!error
1401 ? 2!error
141? 1 : 2!error
1421 ? : 2!error
1431 ??!error
144.!error
145..!error
146x.{x: {}}!error
147.x{x: 1}!error
148x..y{x: {y: 1}}!error
149,!error
1501, 2!error
151:!error
1521 = 2{}!error
153# Juxtaposed values
1541 2!error
155'a' 'b'!error
156x y{x: 1, y: 2}!error
157[1] [2]null
158[1, 2] [1]2
159{} {}!error
160true false!error
161null null!error