pub struct LuaBackend { /* private fields */ }Expand description
Lua code generation backend.
Implementations§
Source§impl LuaBackend
impl LuaBackend
Sourcepub fn mangle_name(&mut self, name: &str) -> String
pub fn mangle_name(&mut self, name: &str) -> String
Mangle an OxiLean name to a valid Lua identifier.
Sourcepub fn lcnf_to_lua_type(ty: &LcnfType) -> LuaType
pub fn lcnf_to_lua_type(ty: &LcnfType) -> LuaType
Map an LCNF type to a Lua type hint.
Sourcepub fn compile_lit(lit: &LcnfLit) -> LuaExpr
pub fn compile_lit(lit: &LcnfLit) -> LuaExpr
Compile an LCNF literal to a Lua expression.
Sourcepub fn compile_let_value(&mut self, value: &LcnfLetValue) -> LuaExpr
pub fn compile_let_value(&mut self, value: &LcnfLetValue) -> LuaExpr
Compile an LCNF literal value to a Lua expression.
Sourcepub fn compile_arg(&mut self, arg: &LcnfArg) -> LuaExpr
pub fn compile_arg(&mut self, arg: &LcnfArg) -> LuaExpr
Compile an LCNF argument to a Lua expression.
Sourcepub fn compile_expr(
&mut self,
expr: &LcnfExpr,
stmts: &mut Vec<LuaStmt>,
) -> LuaExpr
pub fn compile_expr( &mut self, expr: &LcnfExpr, stmts: &mut Vec<LuaStmt>, ) -> LuaExpr
Compile an LCNF expression into a list of Lua statements, returning the result expression.
Sourcepub fn compile_decl(
&mut self,
decl: &LcnfFunDecl,
) -> Result<LuaFunction, String>
pub fn compile_decl( &mut self, decl: &LcnfFunDecl, ) -> Result<LuaFunction, String>
Compile an LCNF function declaration to a LuaFunction.
Sourcepub fn emit_module(&mut self, decls: &[LcnfFunDecl]) -> LuaModule
pub fn emit_module(&mut self, decls: &[LcnfFunDecl]) -> LuaModule
Compile a list of declarations and emit a LuaModule.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LuaBackend
impl RefUnwindSafe for LuaBackend
impl Send for LuaBackend
impl Sync for LuaBackend
impl Unpin for LuaBackend
impl UnsafeUnpin for LuaBackend
impl UnwindSafe for LuaBackend
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