Expand description
The seam between Core and something that can execute it.
§Why this exists
docs/05-tier-lowering.md §5.2 says the Core → Target seam is what lets a backend slot in
later, and docs/04-compiler-architecture.md §4.8 names a differential test between backends
as a thing the project will need. Neither is possible while the host calls a particular
evaluator by name.
Until this module existed, beck-rt constructed Interp directly in four places. That is not a
narrow Phase 1 — it is a Phase 1 whose successor is a refactor rather than an addition. The trait
below is the whole interface a host needs, so a native backend is a new crate that implements it
and a line that chooses it, and the two can be run against each other on the same program.
§The shape, and why it is this small
A host needs exactly two things from an executor: turn a closed Core expression into a value
(the fold’s initial state), and turn one denoting a function into something callable
(validate, the fold, the view). Everything else — environments, closures, fuel — is a detail
of how a backend executes, and a tree-walker and a JIT do not agree on any of it.
So Backend::function returns a Callable rather than a backend-specific handle. There is
no call(handle, args) method to downcast through, and no Value::Closure in the interface —
that variant is the tree-walker’s representation and a compiled backend would not produce one.
Structs§
- Exec
Error - A failure while executing
Core.
Traits§
- Backend
- A way to execute
Core. - Interceptor
- Something that answers a call instead of the definition it names.
Type Aliases§
- Callable
- A function a host can call, however the backend made it.