Struct leo_compiler::Compiler
source · pub struct Compiler<'a> {
pub program_name: String,
pub network: String,
pub ast: Ast,
pub input_ast: Option<InputAst>,
/* private fields */
}
Expand description
The primary entry point of the Leo compiler.
Fields
program_name: String
The program name,
network: String
The network name,
ast: Ast
The AST for the program.
input_ast: Option<InputAst>
The input ast for the program if it exists.
Implementations
sourceimpl<'a> Compiler<'a>
impl<'a> Compiler<'a>
sourcepub fn new(
program_name: String,
network: String,
handler: &'a Handler,
main_file_path: PathBuf,
output_directory: PathBuf,
output_options: Option<OutputOptions>
) -> Self
pub fn new(
program_name: String,
network: String,
handler: &'a Handler,
main_file_path: PathBuf,
output_directory: PathBuf,
output_options: Option<OutputOptions>
) -> Self
Returns a new Leo compiler.
sourcepub fn parse_program_from_string(
&mut self,
program_string: &str,
name: FileName
) -> Result<()>
pub fn parse_program_from_string(
&mut self,
program_string: &str,
name: FileName
) -> Result<()>
Parses and stores a program file content from a string, constructs a syntax tree, and generates a program.
sourcepub fn parse_program(&mut self) -> Result<()>
pub fn parse_program(&mut self) -> Result<()>
Parses and stores the main program file, constructs a syntax tree, and generates a program.
sourcepub fn parse_input(&mut self, input_file_path: PathBuf) -> Result<()>
pub fn parse_input(&mut self, input_file_path: PathBuf) -> Result<()>
Parses and stores the input file, constructs a syntax tree, and generates a program input.
sourcepub fn symbol_table_pass(&self) -> Result<SymbolTable>
pub fn symbol_table_pass(&self) -> Result<SymbolTable>
Runs the symbol table pass.
sourcepub fn type_checker_pass(
&'a self,
symbol_table: SymbolTable
) -> Result<SymbolTable>
pub fn type_checker_pass(
&'a self,
symbol_table: SymbolTable
) -> Result<SymbolTable>
Runs the type checker pass.
sourcepub fn loop_unrolling_pass(
&mut self,
symbol_table: SymbolTable
) -> Result<SymbolTable>
pub fn loop_unrolling_pass(
&mut self,
symbol_table: SymbolTable
) -> Result<SymbolTable>
Runs the loop unrolling pass.
sourcepub fn static_single_assignment_pass(
&mut self,
symbol_table: &SymbolTable
) -> Result<Assigner>
pub fn static_single_assignment_pass(
&mut self,
symbol_table: &SymbolTable
) -> Result<Assigner>
Runs the static single assignment pass.
sourcepub fn flattening_pass(
&mut self,
symbol_table: &SymbolTable,
assigner: Assigner
) -> Result<()>
pub fn flattening_pass(
&mut self,
symbol_table: &SymbolTable,
assigner: Assigner
) -> Result<()>
Runs the flattening pass.
sourcepub fn compiler_stages(&mut self) -> Result<SymbolTable>
pub fn compiler_stages(&mut self) -> Result<SymbolTable>
Runs the compiler stages.
sourcepub fn compile_and_generate_instructions(
&mut self
) -> Result<(SymbolTable, String)>
pub fn compile_and_generate_instructions(
&mut self
) -> Result<(SymbolTable, String)>
Returns a compiled Leo program and prints the resulting bytecode.
sourcepub fn compile(&mut self) -> Result<SymbolTable>
pub fn compile(&mut self) -> Result<SymbolTable>
Returns a compiled Leo program.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Compiler<'a>
impl<'a> !Send for Compiler<'a>
impl<'a> !Sync for Compiler<'a>
impl<'a> Unpin for Compiler<'a>
impl<'a> !UnwindSafe for Compiler<'a>
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