Skip to content

Feat/wasm frontend - #1

Merged
hiett merged 3 commits into
masterfrom
feat/wasm-frontend
Aug 16, 2026
Merged

hiett merged 3 commits into
masterfrom
feat/wasm-frontend

Conversation

@hiett

@hiett hiett commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

No description provided.

hiett added 3 commits August 16, 2026 20:40
scribbler owns the WebAssembly binary and text formats: it decodes a .wasm,
validates it, canonicalises and lowers it into carder's IR, and stops there.
carder (scarletindustries/carder) owns everything from the IR down — the
policy pass, the optimizer, Core Erlang codegen, linking, the BEAM runtime and
the run ABI — and is consumed here as an ordinary Gleam package dependency.

This is the same shape as the arc JavaScript frontend's relationship to
carder: a frontend produces carder IR, carder turns that IR into a running
BEAM module. No wasm code remains in carder, and no backend code lives here.

What moved in:
  - src/scribbler/wasm/{ast,canon,decode,validate,lower,wat} — the frontend
  - src/scribbler/pipeline — the wasm-entry driver plus WasmError, whose
    Backend variant wraps carder's PipelineError and whose describe/1
    delegates to carder's, so a diagnostic reads byte-identically to before
  - src/scribbler — the CLI: decode / validate / to-ir|lower|ir / to-core /
    run / build|to-beam (was to-beam-wasm) / exec / help
  - src/scribbler/embed — the wasm-bytes front door over carder/embed.compile_ir
  - src/scribbler/host/{spectest,teavm} and src/scribbler/porffor/* — the
    wasm-producer host runtimes, re-homed as carder link.Provider.Namespace
    values. carder hard-codes no host module by name any more, so a harness
    must now PASS spectest.provider() rather than inherit it ambiently.
  - the full WebAssembly spec-test suite, smoke/, scripts/, and the wasm
    surface docs

The CLI imports carder/cli for every posture flag and splices cli.axes_usage()
into its own help text, so the two binaries can never drift on what --unsafe,
--tier or --cap mean, and resolve_binding — the fail-closed Binding -> Instance
gate — has exactly one implementation.

Verified against the pre-split tree:
  - 717 tests pass; gleam build --warnings-as-errors and gleam format clean
  - conformance 47,736 pass / 681 skip / 0 fail, Safe and Unsafe identical.
    That is +2 pass / -2 skip against the pre-split Safe baseline of
    47,734/683/0, and the gain is accounted for exactly: the two return_call
    asserts that tail-call into spectest.print* used to be SKIPPED under Safe
    because carder resolved spectest through the deny-all HostPolicy. They now
    resolve through this repo's Namespace provider and execute — matching what
    the pre-split Unsafe run (47,736/681/0) already proved. Nothing weakened.
  - cross-repo byte identity over the whole 32-program corpus: the .beam from
    `scribbler build <x>.wasm` is byte-identical to the .beam from
    `carder to-beam <x>.ir` for all 32, differ=0 errors=0 — so the extraction
    changed no compiler output.

NOTE: the carder dependency points at github main. It resolves once carder's
feat/extract-wasm-frontend branch lands there; until then build with a local
path dep (see the comment in gleam.toml). manifest.toml is gitignored for now
and should be committed as soon as `gleam deps download` can record the
resolved carder SHA — that pin is what makes CI reproducible.
Points the carder dependency at the extraction branch on GitHub and commits
the lockfile, so a fresh clone and CI both build without a sibling checkout.

The ref is intent; manifest.toml is the pin — it records the resolved commit
faf5b849 ("Extract the WebAssembly frontend into the scribbler repo"), which
is what actually gets built. When the split lands on carder's main, change
`ref` to "main" and re-run `gleam deps download`; the pin moves, nothing else.

Verified against the git dependency rather than the local path dep:
gleam build --warnings-as-errors clean, 717 tests pass, conformance
47,736 / 681 / 0, and `run add.wasm add 3 5` prints 8.
The extraction merged as carder 4d437d8, so the dependency no longer needs to
follow the feature branch. `ref` becomes "main"; the lockfile moves from
faf5b849 (the branch tip) to 4d437d8 (the merge commit) — same tree, and the
lockfile is what a fresh clone and CI actually build.

Re-verified against carder main rather than assuming the merge was a no-op:
gleam build --warnings-as-errors clean, gleam format clean, 717 tests pass,
conformance 47,736 / 681 / 0 on both Safe and Unsafe, and
`run add.wasm add 3 5` prints 8.
@hiett
hiett merged commit c37d869 into master Aug 16, 2026
1 check passed
@hiett
hiett deleted the feat/wasm-frontend branch August 16, 2026 20:50
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