Gyoji Compiler
|
#include <parser.hpp>
Static Public Member Functions | |
static Gyoji::owned< ParseResult > | parse (Gyoji::context::CompilerContext &_compiler_context, Gyoji::misc::InputSource &_input_source) |
static Gyoji::owned< Gyoji::mir::MIR > | parse_to_mir (Gyoji::context::CompilerContext &_compiler_context, Gyoji::misc::InputSource &_input_source) |
This is the main interface to the front-end parsing system. It contains only static methods to invoke the parser and retrieve the syntax tree. No state is held by this class and it exists only to organize the namespace of the interface.
|
static |
This is the main interface to the front-end for the parser. The purpose is to wrap all of the lex/parse/syntax tree components of the front-end into a common and simple to use interface.
The parser is responsible for reading data from the input and passing it to the tokenizer (Flex-based lexical analyzer) and then to the parser (Bison-based LALR(1) parser). From there, the resulting data is built into a syntax tree and is available in the parse result.
Once the parse result is returned, the caller takes ownership of all of the resulting data and the parser itself is free to leave scope having done its job.
_namespace_context | This is the namespace context containing the initial set of primitive types. |
_input_source | This is the source from which to read data. |
|
static |
This function parses the input code and produces an MIR representation of the result that can be passed directly to the analysis and later, the code-generation systems to generate code. This is the ultimate result of the front-end. Any alternative front-end syntax layers should also parse using the context and produce an MIR as a result. The caller will take ownership of the resulting MIR and make it available to downstream consumers.