FlycatcherFrontend

Struct FlycatcherFrontend 

Source
pub struct FlycatcherFrontend<'a> {
    pub filename: &'a str,
    pub source: &'a str,
    pub diagnostics: Vec<Diagnostic<()>>,
    pub hir: Vec<HirMeta<'a>>,
    pub symbols: HashMap<String, VariableType>,
    /* private fields */
}
Expand description

Flycatcher’s front end for it’s compiler. This struct takes an input AST tree and converts it to a slightly lower level representation, the HIR. The HIR removes the abstractions of preprocessors and such, and it’s easier to compile directly to another lower level intermediate representation, or just directly to machine code.

Fields§

§filename: &'a str

The name of the file that the compiler frontend is converting into an HIR tree. This is used for diagnostic messages.

§source: &'a str

The source that relates to the provided filename. This is also used for diagnostic messages emitted by the compiler.

§diagnostics: Vec<Diagnostic<()>>

A list of diagnostics that the frontend emitted while converting an AST tree to an HIR tree.

§hir: Vec<HirMeta<'a>>

A list of generated HIR objects. This should not be used if self::successful is equal to false.

§symbols: HashMap<String, VariableType>

A list of variables defined in the provided AST tree. These are used to resolve what variable names are valid and what variable names aren’t.

Implementations§

Source§

impl<'a> FlycatcherFrontend<'a>

Source

pub fn new(filename: &'a str, source: &'a str) -> Self

Creates a new Flycatcher compiler front end. After initialization, to use this struct, you’ll need to pass an AST tree to convert to Flycatcher MIR.

Source

pub fn convert(&mut self, ast: Vec<AstMeta>)

Converts all of the items in the provided AST tree into a tree of Flycatcher HIR.

Source

pub fn successful(&self) -> bool

Returns whether or not the compilation process was a success.

Auto Trait Implementations§

§

impl<'a> Freeze for FlycatcherFrontend<'a>

§

impl<'a> RefUnwindSafe for FlycatcherFrontend<'a>

§

impl<'a> Send for FlycatcherFrontend<'a>

§

impl<'a> Sync for FlycatcherFrontend<'a>

§

impl<'a> Unpin for FlycatcherFrontend<'a>

§

impl<'a> UnwindSafe for FlycatcherFrontend<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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.

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.