Gyoji Compiler
|
Lowering for a function. More...
#include <function-resolver.hpp>
Public Member Functions | |
bool | resolve () |
Resolve a single function definition. | |
Lowering for a function.
This class is responsible for converting a FileStatementFunctionDefinition into an equivalent program in the MIR representation. This iterates the statements inside the function definition and emits MIR code that matches the intend. In addition, rules for the validity of the program are evaluated so that grossly invalid programs never make it to the MIR level. Semantic errors are reported through the CompilerContext in the form of context-aware messages that highlight where the error took place.
bool FunctionDefinitionResolver::resolve | ( | ) |
Resolve a single function definition.
Performs the bulk of the logic for reading a function definition and emitting equivalent MIR for it. The MIR will be in a form that can be used in the code-generation phase.
This method returns false if the MIR is unsuitable for code-generation due to semantic errors that were found. Note that not all errors will result in an invalid MIR, however, some constructs will make the resulting MIR unsuitible for code generation.