pub struct CBackend { /* private fields */ }Expand description
The C code generation backend.
Translates an LCNF module into C99 source code with Lean-compatible runtime support.
Implementations§
Source§impl CBackend
impl CBackend
Sourcepub fn new(config: CEmitConfig) -> Self
pub fn new(config: CEmitConfig) -> Self
Create a new C backend with the given configuration.
Sourcepub fn default_backend() -> Self
pub fn default_backend() -> Self
Create a C backend with default configuration.
Sourcepub fn emit_module(&mut self, module: &LcnfModule) -> COutput
pub fn emit_module(&mut self, module: &LcnfModule) -> COutput
Emit a complete LCNF module to C code.
Sourcepub fn emit_fun_decl(&mut self, decl: &LcnfFunDecl) -> CDecl
pub fn emit_fun_decl(&mut self, decl: &LcnfFunDecl) -> CDecl
Emit an LCNF function declaration as a C function.
Sourcepub fn emit_type(&self, ty: &LcnfType) -> CType
pub fn emit_type(&self, ty: &LcnfType) -> CType
Map an LCNF type to a C type (public interface).
Sourcepub fn emit_expr(&mut self, expr: &LcnfExpr, ret_ty: &LcnfType) -> Vec<CStmt>
pub fn emit_expr(&mut self, expr: &LcnfExpr, ret_ty: &LcnfType) -> Vec<CStmt>
Emit C statements for an LCNF expression.
Sourcepub fn stats(&self) -> &CEmitStats
pub fn stats(&self) -> &CEmitStats
Get the accumulated statistics.
Auto Trait Implementations§
impl Freeze for CBackend
impl RefUnwindSafe for CBackend
impl Send for CBackend
impl Sync for CBackend
impl Unpin for CBackend
impl UnsafeUnpin for CBackend
impl UnwindSafe for CBackend
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