Bond 0.9
C++ Bond Runtime Library API Documentation
|
A compiler front end for the Bond scripting language. More...
#include <bond/compiler/frontend.h>
Public Member Functions | |
FrontEnd (Allocator &allocator, TokenCollectionStore &tokenCollectionStore, Lexer &lexer, Parser &parser, SemanticAnalyzer &semanticAnalyzer, StreamFactory &streamFactory) | |
Constructs a FrontEnd object. More... | |
FrontEnd (const FrontEnd &other)=delete | |
FrontEnd & | operator= (const FrontEnd &other)=delete |
void | AddInputFile (const StringView &inputFileName) |
Adds the name of a Bond source file to the input file list. More... | |
bool | ContainsInputFile (const StringView &inputFileName) |
Returns whether the given file name exists in the input file list.. More... | |
TranslationUnit * | Analyze () |
Performs loading, parsing and semantic analysis of all source files in the input file list, as well as those files referenced via include directives. returns A parse tree of ParseNodes rooted with a list of TranslationUnits. More... | |
bool | HasErrors () const |
Returns whether any errors occurred whilst analyzing the source code. More... | |
A compiler front end for the Bond scripting language.
The FrontEnd manages the interactions between the compiler's front end components, namely a Lexer, a Parser and a SemanticAnalyzer.
The FrontEnd also manages an input file list, a list of Bond source files that are required to be loaded, parsed and analyzed. Files can be explicitly added to the input file list via the AddInputFile method. Files are also implicitly added to the list when include directives in the Bond source files are parsed. A source file is never added to the input file list more than once, so encountering an include directive for a file that already exists in the list has no effect. One parse tree, rooted with a TranslationUnit, is generated for each Bond source file. Only the TranslationUnits for the files that were explicitly added to the input file list are flagged as requiring code generation.
When analysis is complete, the list of generated TranslationUnits is returned.
File loading is delegated to an object that implements the StreamFactory interface so that no assumptions about where the source files reside are made (e.g. disk, network, database, proprietary asset store, etc).
|
inline |
Constructs a FrontEnd object.
allocator | The allocator used for the FrontEnd's internal data structures. |
tokenCollectionStore | Storage for the generated TokenCollections.. |
lexer | The Lexer used to scan the Bond source files. |
parser | The Parser used to parse the Bond source files. |
semanticAnalyzer | The SemanticAnalyzer used to analyze the Bond source files. |
streamFactory | The StreamFactory responsible for loading the Bond source files. |
|
delete |
void Bond::FrontEnd::AddInputFile | ( | const StringView & | inputFileName | ) |
TranslationUnit * Bond::FrontEnd::Analyze | ( | ) |
Performs loading, parsing and semantic analysis of all source files in the input file list, as well as those files referenced via include directives. returns A parse tree of ParseNodes rooted with a list of TranslationUnits.
bool Bond::FrontEnd::ContainsInputFile | ( | const StringView & | inputFileName | ) |
Returns whether the given file name exists in the input file list..
inputFileName | The name of the file to be tested. |
bool Bond::FrontEnd::HasErrors | ( | ) | const |
Returns whether any errors occurred whilst analyzing the source code.