tipc
A TIP to LLVM compiler
Public Member Functions | Static Public Member Functions | List of all members
SemanticAnalysis Class Reference

Stores the results of semantic analysis passes. More...

#include <SemanticAnalysis.h>

Public Member Functions

 SemanticAnalysis (std::shared_ptr< SymbolTable > s, std::shared_ptr< TypeInference > t, std::shared_ptr< CallGraph > cg)
 
SymbolTablegetSymbolTable ()
 Returns the symbol table computed for the program. More...
 
TypeInferencegetTypeResults ()
 Returns the type inference results. More...
 
CallGraphgetCallGraph ()
 Returns the call graph for the program. More...
 

Static Public Member Functions

static std::shared_ptr< SemanticAnalysisanalyze (ASTProgram *ast, bool polyInf)
 Perform semantic analysis on program AST. More...
 

Detailed Description

Stores the results of semantic analysis passes.

This class provides the analyze method to run a set of semantic analyses, including l-value checking for assignment statements, proper use of symbols, and type checking and control flow analysis

See also
SymbolTable
TypeInference
CallGraph

Constructor & Destructor Documentation

◆ SemanticAnalysis()

SemanticAnalysis::SemanticAnalysis ( std::shared_ptr< SymbolTable s,
std::shared_ptr< TypeInference t,
std::shared_ptr< CallGraph cg 
)
inline

Member Function Documentation

◆ analyze()

SemanticAnalysis::analyze ( ASTProgram ast,
bool  polyInf 
)
static

Perform semantic analysis on program AST.

Run weeding, symbol, and type checking and control flow analysis. Errors in any of these result in a SemanticError. If no errors then ownership of semantic analysis results are transferred to caller.

See also
SemanticError
Parameters
astThe program AST
polyInfIndicate whether polymorphic type inference should be performed.
Returns
The unique pointer to the semantic analysis structure.

◆ getCallGraph()

SemanticAnalysis::getCallGraph ( )

Returns the call graph for the program.

See also
CallGraph

◆ getSymbolTable()

SemanticAnalysis::getSymbolTable ( )

Returns the symbol table computed for the program.

See also
SymbolTable

◆ getTypeResults()

SemanticAnalysis::getTypeResults ( )

Returns the type inference results.

See also
TypeInference

The documentation for this class was generated from the following files: