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§

source§

impl<'a> Compiler<'a>

source

pub fn new( program_name: String, network: String, handler: &'a Handler, main_file_path: PathBuf, output_directory: PathBuf, compiler_options: Option<CompilerOptions> ) -> Self

Returns a new Leo compiler.

source

pub fn checksum(&self) -> Result<String>

Returns a SHA256 checksum of the program file.

source

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.

source

pub fn parse_program(&mut self) -> Result<()>

Parses and stores the main program file, constructs a syntax tree, and generates a program.

source

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.

source

pub fn symbol_table_pass(&self) -> Result<SymbolTable>

Runs the symbol table pass.

source

pub fn type_checker_pass( &'a self, symbol_table: SymbolTable ) -> Result<(SymbolTable, StructGraph, CallGraph)>

Runs the type checker pass.

source

pub fn loop_unrolling_pass( &mut self, symbol_table: SymbolTable ) -> Result<SymbolTable>

Runs the loop unrolling pass.

source

pub fn static_single_assignment_pass( &mut self, symbol_table: &SymbolTable ) -> Result<Assigner>

Runs the static single assignment pass.

source

pub fn flattening_pass( &mut self, symbol_table: &SymbolTable, assigner: Assigner ) -> Result<Assigner>

Runs the flattening pass.

source

pub fn function_inlining_pass( &mut self, call_graph: &CallGraph, assigner: Assigner ) -> Result<Assigner>

Runs the function inlining pass.

source

pub fn dead_code_elimination_pass(&mut self) -> Result<()>

Runs the dead code elimination pass.

source

pub fn code_generation_pass( &mut self, symbol_table: &SymbolTable, struct_graph: &StructGraph, call_graph: &CallGraph ) -> Result<String>

Runs the code generation pass.

source

pub fn compiler_stages( &mut self ) -> Result<(SymbolTable, StructGraph, CallGraph)>

Runs the compiler stages.

source

pub fn compile(&mut self) -> Result<(SymbolTable, String)>

Returns a compiled Leo program.

Trait Implementations§

source§

impl<'a> Clone for Compiler<'a>

source§

fn clone(&self) -> Compiler<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V