Expand description
Runtime lowering of parsed QCode text into qcode IR.
The qcode! proc-macro parses QCode and emits Rust code that builds the IR
at the call site — it cannot run at runtime. This module is the runtime twin:
it walks the same wazabin_qcode_parser AST and drives the Builder directly, so
tools (a CLI, the macro itself) share a single lowering implementation.
It lives in qcode core (not a separate crate) so the qcode! macro can
route through it from core’s own tests without creating a second copy of
qcode via a dev-dependency cycle.
lower_str returns a Symbols table mapping each source name to the id
it produced, so callers can look declarations back up after lowering.
Structs§
- Symbols
- Names produced while lowering a program, so callers can recover the ids by the identifier that appeared in the source. Block/param/ssa/varnode names are last-write-wins across functions, matching the macro’s shared-name behavior.
Functions§
- lower_
program - Lower an already-parsed program into
ctx. - lower_
program_ with_ externals - Lower a parsed program, resolving
{name}capture atoms viaexternals. - lower_
str - Parse and lower QCode source text into
ctx. - lower_
str_ with_ externals - Like
lower_str, butexternalssupplies values for{name}capture atoms — used by theqcode!macro to inject in-scope Rust values into the program.