diff options
| author | Cori Barker <coribarker2@gmail.com> | 2026-03-05 22:22:53 +0000 |
|---|---|---|
| committer | Cori Barker <coribarker2@gmail.com> | 2026-03-05 22:22:53 +0000 |
| commit | 0411ae52679471953f5bae476c8bf2f5cd4ddf60 (patch) | |
| tree | 974831d834f41c4b88405d1d2a96e3e8cb6af3a9 /src/semantic_analyzer.cpp | |
| parent | 1e371553e253a3f57fff7ba5a22331cabbd7faf4 (diff) | |
started implementing the semantic analyzer methods
Diffstat (limited to 'src/semantic_analyzer.cpp')
| -rw-r--r-- | src/semantic_analyzer.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/semantic_analyzer.cpp b/src/semantic_analyzer.cpp index e097e4f..f6d3d2a 100644 --- a/src/semantic_analyzer.cpp +++ b/src/semantic_analyzer.cpp @@ -95,9 +95,13 @@ std::string visitProgram(ProgramNode* node){ // visit each function // return + std::vector<FunctionDeclarationNode*> functions = node->function_declarations; + for (auto element : functions) { + visitFunctionDeclaration(element); + }; } -std::string visitFunctionDecl(FunctionDeclNode* node){ +std::string visitFunctionDeclaration(FunctionDeclarationNode* node){ // check for dupe name // create function symbol and insert into global scope // check if main function @@ -107,6 +111,7 @@ std::string visitFunctionDecl(FunctionDeclNode* node){ // verify non-void functions have return statements // exit function scope and clear context // return + } @@ -119,7 +124,7 @@ std::string visitParameter(ParameterNode*){ } -std::string visitVarDeclaration(VarDeclNode* node){ +std::string visitVariableDeclaration(VariableDeclarationNode* node){ // get variable information // check for dupes // if initializer exists, check type @@ -177,7 +182,7 @@ std::string visitReturnStatement(ReturnStatementNode* node){ } -std::String visitExpressionStatement(ExpressionStatementNode* node){ +std::string visitExpressionStatement(ExpressionStatementNode* node){ // get the expression // analyze expression // return |
