Skip to main content

Module lower

Module lower 

Source
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 via externals.
lower_str
Parse and lower QCode source text into ctx.
lower_str_with_externals
Like lower_str, but externals supplies values for {name} capture atoms — used by the qcode! macro to inject in-scope Rust values into the program.