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 strThe name of the file that the compiler frontend is converting into an HIR tree. This is used for diagnostic messages.
source: &'a strThe 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>
impl<'a> FlycatcherFrontend<'a>
Sourcepub fn new(filename: &'a str, source: &'a str) -> Self
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.
Sourcepub fn convert(&mut self, ast: Vec<AstMeta>)
pub fn convert(&mut self, ast: Vec<AstMeta>)
Converts all of the items in the provided AST tree into a tree of Flycatcher HIR.
Sourcepub fn successful(&self) -> bool
pub fn successful(&self) -> bool
Returns whether or not the compilation process was a success.