pub struct Compiler<'i> { /* private fields */ }Implementations§
Source§impl<'i> Compiler<'i>
impl<'i> Compiler<'i>
Sourcepub fn compile(
stmts: &[Stmt<'_>],
interner: &'i Interner,
) -> Result<CompiledProgram, String>
pub fn compile( stmts: &[Stmt<'_>], interner: &'i Interner, ) -> Result<CompiledProgram, String>
Compile a statement block to a runnable program.
Sourcepub fn compile_with_types(
stmts: &[Stmt<'_>],
interner: &'i Interner,
types: Option<&TypeRegistry>,
) -> Result<CompiledProgram, String>
pub fn compile_with_types( stmts: &[Stmt<'_>], interner: &'i Interner, types: Option<&TypeRegistry>, ) -> Result<CompiledProgram, String>
Compile with the discovery-pass type registry (struct definitions that
never appear as Stmt::StructDef).
Sourcepub fn compile_with_oracle(
stmts: &[Stmt<'_>],
interner: &'i Interner,
types: Option<&TypeRegistry>,
oracle: Option<OracleFacts>,
) -> Result<CompiledProgram, String>
pub fn compile_with_oracle( stmts: &[Stmt<'_>], interner: &'i Interner, types: Option<&TypeRegistry>, oracle: Option<OracleFacts>, ) -> Result<CompiledProgram, String>
Like compile_with_types, plus the Oracle’s range-analysis facts
(M9) for bounds-check elimination. The live run path computes these
on the exact (optimized) snapshot it then compiles, so an Index
proven in-bounds becomes IndexUnchecked. None ⇒ every index
stays checked (the codegen / test paths).
Sourcepub fn compile_with_oracle_located(
stmts: &[Stmt<'_>],
interner: &'i Interner,
types: Option<&TypeRegistry>,
oracle: Option<OracleFacts>,
) -> Result<CompiledProgram, Refusal>
pub fn compile_with_oracle_located( stmts: &[Stmt<'_>], interner: &'i Interner, types: Option<&TypeRegistry>, oracle: Option<OracleFacts>, ) -> Result<CompiledProgram, Refusal>
Self::compile_with_oracle, keeping WHERE a refusal happened — the entry a surface that
points at the author’s source (the browser build, its dev overlay, an editor) compiles
through. The text-only entries are this, with the location dropped.
Sourcepub fn compile_for_chip(
stmts: &[Stmt<'_>],
interner: &'i Interner,
types: Option<&TypeRegistry>,
oracle: Option<OracleFacts>,
) -> Result<CompiledProgram, String>
pub fn compile_for_chip( stmts: &[Stmt<'_>], interner: &'i Interner, types: Option<&TypeRegistry>, oracle: Option<OracleFacts>, ) -> Result<CompiledProgram, String>
Compile for the soft-core CHIP backend: identical to compile_with_oracle except division /
modulo by a constant is NOT strength-reduced (no DivPow2/MagicDivU — the chip issues plain
Div/Mod to its sequential shared_divider, and a 64-bit magic constant cannot ride the
32-bit chip instruction word). Results are bit-identical to compile_with_oracle (strength
reduction is exact), so the VM and the chip agree.
Sourcepub fn compile_for_debug(
stmts: &[Stmt<'_>],
interner: &'i Interner,
types: Option<&TypeRegistry>,
) -> Result<CompiledProgram, String>
pub fn compile_for_debug( stmts: &[Stmt<'_>], interner: &'i Interner, types: Option<&TypeRegistry>, ) -> Result<CompiledProgram, String>
Like compile_with_types but also captures source variable names into
CompiledProgram::reg_names for the Studio debugger. Used only by the
debugger’s compile path; production callers pay nothing for it.
Sourcepub fn compile_observed(
stmts: &[Stmt<'_>],
interner: &'i Interner,
types: Option<&TypeRegistry>,
) -> Result<CompiledProgram, String>
pub fn compile_observed( stmts: &[Stmt<'_>], interner: &'i Interner, types: Option<&TypeRegistry>, ) -> Result<CompiledProgram, String>
Compile in the OBSERVED profile (Wave 13): Note/Warn/Record/During
lower to Op::Obs, so the VM emits the same observation event stream the
tree-walker does. The dev/test tier — the compiled/release tiers keep the
elided profile (this op never reaches them).
Sourcepub fn compile_observed_located(
stmts: &[Stmt<'_>],
interner: &'i Interner,
types: Option<&TypeRegistry>,
) -> Result<CompiledProgram, Refusal>
pub fn compile_observed_located( stmts: &[Stmt<'_>], interner: &'i Interner, types: Option<&TypeRegistry>, ) -> Result<CompiledProgram, Refusal>
Self::compile_observed, keeping where a refusal happened.
Sourcepub fn compile_tiers(
stmts: &[Stmt<'_>],
interner: &'i Interner,
types: Option<&TypeRegistry>,
) -> Result<CompiledProgram, String>
pub fn compile_tiers( stmts: &[Stmt<'_>], interner: &'i Interner, types: Option<&TypeRegistry>, ) -> Result<CompiledProgram, String>
Compile a ## Test body for the --tiers all differential (Wave 13):
test-only statements (Expect/ForAll/…) compile as NO-OPS so the VM can
run the test’s computation and confirm it agrees with the tree-walker.
Auto Trait Implementations§
impl<'i> Freeze for Compiler<'i>
impl<'i> RefUnwindSafe for Compiler<'i>
impl<'i> Send for Compiler<'i>
impl<'i> Sync for Compiler<'i>
impl<'i> Unpin for Compiler<'i>
impl<'i> UnsafeUnpin for Compiler<'i>
impl<'i> UnwindSafe for Compiler<'i>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.