pub struct MinimalCodeGen;Expand description
Minimal code generator for self-hosting
Implementations§
Source§impl MinimalCodeGen
impl MinimalCodeGen
Sourcepub fn gen_expr(expr: &Expr) -> Result<String>
pub fn gen_expr(expr: &Expr) -> Result<String>
Generate Rust code directly from AST with no optimization
§Examples
use ruchy::backend::transpiler::codegen_minimal::MinimalCodeGen;
use ruchy::frontend::ast::Expr;
let expr = Expr::literal(42.into());
let result = MinimalCodeGen::gen_expr(&expr);
assert!(result.is_ok());Sourcepub fn gen_program(expr: &Expr) -> Result<String>
pub fn gen_program(expr: &Expr) -> Result<String>
Generate complete Rust program for self-hosting
§Examples
use ruchy::backend::transpiler::codegen_minimal::MinimalCodeGen;
use ruchy::frontend::ast::Expr;
let expr = Expr::literal(42.into());
let result = MinimalCodeGen::gen_program(&expr);
assert!(result.is_ok());Auto Trait Implementations§
impl Freeze for MinimalCodeGen
impl RefUnwindSafe for MinimalCodeGen
impl Send for MinimalCodeGen
impl Sync for MinimalCodeGen
impl Unpin for MinimalCodeGen
impl UnwindSafe for MinimalCodeGen
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more