Expand description
The MVP tree-walking interpreter.
The interpreter is an ordinary evaluator over cove_syntax::ast plus the
five rules that make Cove Cove:
- assignment and ordinary argument passing clone a
Value, andClonealready encodes field-wise shallow copy, so there is no deep-copy path; - mutation resolves an lvalue down to a slot the caller owns. Which
lvalues source may write —
letbinds a read-only place andvara mutable one — is checked before the run, bycove-sema, since ADR 0021; var selfandvarparameters bind the caller’s place instead of a copy;- Host API calls go through
HostRegistry::call, which enforces grants; - concurrent work belongs to a task scope, and leaving the scope waits for or cancels the tasks spawned into it.
Static checking (types, exhaustiveness, uniqueness) is future work; the
interpreter enforces the same rules dynamically and says which rule it
enforced. Two families of rule are no longer among them, because
cove check decides them from the source and a program it refuses never
reaches here: which places source may write, and whether a labelled
argument stands in declaration order. ADR 0021 says why they went, and
what is left in their place is a guard rather than a diagnostic —
var_self_needs_place and Interpreter::resolve_place’s last arm are
this evaluator saying it was handed something it cannot address, not the
language saying a program is wrong.
Structs§
- Interpreter
- Executes a resolved program.
Constants§
- SAFEPOINT_
FUEL - Fuel charged at every safepoint: a loop back edge, a function call, or an
await. - STACK_
SIZE - How much stack the runtime gives every thread it runs Cove on.
Functions§
- on_
cove_ stack - Runs
bodyon a thread the runtime sized, and hands back what it produced.