From 0411ae52679471953f5bae476c8bf2f5cd4ddf60 Mon Sep 17 00:00:00 2001 From: Cori Barker Date: Thu, 5 Mar 2026 22:22:53 +0000 Subject: started implementing the semantic analyzer methods --- src/semantic_analyzer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') 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 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 -- cgit v1.2.3