Trait ASTNode

Source
pub trait ASTNode {
    // Required methods
    fn compile<'a>(&'a self, state: &'a SymTable<'a>) -> CompileResult;
    fn print_level(&self, level: usize) -> String;

    // Provided method
    fn prettyprint(&self) -> String { ... }
}
Expand description

Trait for AST nodes.

Required Methods§

Source

fn compile<'a>(&'a self, state: &'a SymTable<'a>) -> CompileResult

Compile this node to a list of SVM expressions

Source

fn print_level(&self, level: usize) -> String

Pretty-print this node at the desired indent level

Provided Methods§

Source

fn prettyprint(&self) -> String

Pretty-print this node to a String.

This should start with this node indented zero spaces, and recursively walk the tree downward, increasing the indentation level by INDENT every step.

Trait Implementations§

Source§

impl Debug for dyn ASTNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§