pub struct Generator { /* private fields */ }
Expand description
Generates VM instructions from parsed code.
Implementations
sourceimpl Generator
impl Generator
sourcepub fn gen_copy_stack_into_variable(
&self,
variable: &Variable,
segment: Segment,
offset: u16
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_copy_stack_into_variable(
&self,
variable: &Variable,
segment: Segment,
offset: u16
) -> Result<Vec<VmInstruction>, CalError>
Generates VM instructions to copy the stack backwards into the memory segment representing a certain variable
pub fn gen_assign_expression_to_variable(
&self,
name: &str,
rhs: &Expression
) -> Result<Vec<VmInstruction>, CalError>
sourcepub fn gen_copy_stack_into_index(
&self,
entry: &SymbolEntry,
index_expr: &Expression
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_copy_stack_into_index(
&self,
entry: &SymbolEntry,
index_expr: &Expression
) -> Result<Vec<VmInstruction>, CalError>
Generates VM instructions to copy the stack backwards into the memory segment representing a certain index term
pub fn gen_assign_expression_to_index(
&self,
name: &str,
index_expr: &Expression,
rhs: &Expression
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_assign_expression(
&self,
term: &Term,
rhs: &Expression
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_expression(
&self,
expr: &Expression
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_return(
&mut self,
expr: &Option<Expression>
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_let(
&mut self,
variable: &Variable,
assign_expression: &Expression
) -> Result<Vec<VmInstruction>, CalError>
sourcepub fn gen_if(
&mut self,
if_stat: &IfStatement
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_if(
&mut self,
if_stat: &IfStatement
) -> Result<Vec<VmInstruction>, CalError>
Generates VM instructions for an if statement
sourcepub fn gen_while(
&mut self,
while_stat: &WhileStatement
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_while(
&mut self,
while_stat: &WhileStatement
) -> Result<Vec<VmInstruction>, CalError>
Generates VM instructions for a while statement
pub fn gen_statement(
&mut self,
statement: &Statement
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_statements(
&mut self,
statements: &[Statement]
) -> Result<Vec<VmInstruction>, CalError>
sourcepub fn gen_function(
&mut self,
function: &Function
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_function(
&mut self,
function: &Function
) -> Result<Vec<VmInstruction>, CalError>
Generates VM instructions for a function
sourcepub fn gen_module(
&mut self,
module: &Module
) -> Result<Vec<VmInstruction>, CalError>
pub fn gen_module(
&mut self,
module: &Module
) -> Result<Vec<VmInstruction>, CalError>
Generates VM instructions for a module
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Generator
impl Send for Generator
impl Sync for Generator
impl Unpin for Generator
impl UnwindSafe for Generator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more