Decaf Compiler
|
Compiler phase 3: static analysis. More...
#include "p3-analysis.h"
Classes | |
struct | AnalysisData |
State/data for static analysis visitor. More... | |
Macros | |
#define | ERROR_LIST (((AnalysisData*)visitor->data)->errors) |
Macro for more convenient access to the error list inside a visitor data structure. | |
#define | SET_INFERRED_TYPE(T) |
Macro for shorter storing of the inferred type attribute. More... | |
#define | GET_INFERRED_TYPE(N) (DecafType)ASTNode_get_attribute(N, "type") |
Macro for shorter retrieval of the inferred type attribute. | |
Typedefs | |
typedef struct AnalysisData | AnalysisData |
State/data for static analysis visitor. | |
Functions | |
AnalysisData * | AnalysisData_new () |
Allocate memory for analysis data. More... | |
void | AnalysisData_free (AnalysisData *data) |
Deallocate memory for analysis data. More... | |
Symbol * | lookup_symbol_with_reporting (NodeVisitor *visitor, ASTNode *node, const char *name) |
Wrapper for lookup_symbol that reports an error if the symbol isn't found. More... | |
ErrorList * | analyze (ASTNode *tree) |
Perform static analysis on an AST and return a list of errors. More... | |
Compiler phase 3: static analysis.
#define SET_INFERRED_TYPE | ( | T | ) |
Macro for shorter storing of the inferred type
attribute.
void AnalysisData_free | ( | AnalysisData * | data | ) |
Deallocate memory for analysis data.
data | Pointer to the structure to be deallocated |
AnalysisData* AnalysisData_new | ( | ) |
Allocate memory for analysis data.
Perform static analysis on an AST and return a list of errors.
tree | Root of AST |
Symbol* lookup_symbol_with_reporting | ( | NodeVisitor * | visitor, |
ASTNode * | node, | ||
const char * | name | ||
) |
Wrapper for lookup_symbol that reports an error if the symbol isn't found.
visitor | Visitor with the error list for reporting |
node | AST node to begin the search at |
name | Name of symbol to find |
NULL