Skip to content

Commit

Permalink
Semantic analysis with visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
PATH242 committed Apr 11, 2023
1 parent 4b04b82 commit faa13ec
Show file tree
Hide file tree
Showing 5 changed files with 411 additions and 323 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ full_lexer:
full_parser:
flex -o lexer.cpp -i lexer.l
bison -d parser.ypp -o parser.cpp
g++ -g main.cpp lexer.cpp parser.cpp driver.cpp astPrinter.cpp prettyPrinter.cpp -o output.out
g++ -g main.cpp lexer.cpp parser.cpp driver.cpp astPrinter.cpp prettyPrinter.cpp semantic.cpp -o output.out
./output.out < test.crbc

# Tests
test:
bash test.sh
Expand Down
10 changes: 5 additions & 5 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "ast.hpp"
#include "astPrinter.hpp"
#include "prettyPrinter.hpp"

#include "semantic.hpp"
extern ast::Program *program;

int main(int argc, char **argv)
Expand All @@ -17,9 +17,9 @@ int main(int argc, char **argv)
std::cout << std::endl;
// analyzer::AstPrinter printer;
// program->accept(&printer);
// analyzer::Semantic analyzer;
// program->accept(&analyzer);
prettyPrinter::codePrinter printer;
program->accept(&printer);
analyzer::Semantic analyzer;
program->accept(&analyzer);
//prettyPrinter::codePrinter printer;
//program->accept(&printer);
return 0;
}
Loading

0 comments on commit faa13ec

Please sign in to comment.