Skip to content

host plan executor - #99

Draft
Nic-Polumeyv wants to merge 14 commits into
mainfrom
executor
Draft

host plan executor#99
Nic-Polumeyv wants to merge 14 commits into
mainfrom
executor

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Before this, a host described its template syntax in a small language of our own and a walker in Rust filled the gaps with special cases: which attribute meant a shadow root, where a let: binding was visible, which branch of a choice to take from its first token, which scope a name belonged to from field order. Every new syntax added a keyword, and the parser quietly knew Svelte.

Now the host hands over a plan built from four things that compose and nothing else: rules that build records, forms that say what to read in order, regions that say which scope covers which fields, and one declare. Rust validates it at load and this executor runs it. Choices that can be told apart by their first token dispatch directly; the rest back out cleanly. Scopes come from what the plan states, not from position. The old grammar reader and both .grammar files are gone.

Why it is better: a new framework writes a plan and gets what Svelte gets, with no change to the parser; the concepts are few enough to learn once; and the cases the old walker guessed wrong are now right by construction (<Comp let:x p={x}>, Vue's v-for source and v-slot props). Svelte's suite passes on it at parity.

One public change to state: the JSON and CLI entry no longer detects TypeScript from <script lang="ts">; the caller says which dialect a document is, as the plan model requires. Svelte's phase 1 does that in stage E.

Draft until the host benchmark is within 10% of main. Where it stands, pins byte-identical throughout: 200 each blocks, main 490 µs, this branch 820 µs (from 2,769 µs at the first executor); a 6.8 KB real component, main 150 to 244 µs across runs, this branch 260 µs. Allocations are at zero per node. What is left is the executor's per-record cost (about 1,800 records for that document, 165 ns each of form execution and 160 ns per region), spread over form dispatch, region resolution and the header pre-scan, with nothing dominant; the next step is specializing region evaluation and flattening forms into an instruction array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant