Skip to content

Commit

Permalink
Print AST and fix while
Browse files Browse the repository at this point in the history
  • Loading branch information
boozec committed Jul 13, 2024
1 parent 51ed338 commit e03777b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public static void main(String[] args) {
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(800, 600);
frame.setVisible(true);

System.out.println(ast.printAST(""));
}

if (execute) {
Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/WhileStmtNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public String codeGeneration() {

@Override
public String printAST(String prefix) {
return prefix + "While\n" + expr.toPrint(prefix + " ") + block.toPrint(prefix + " ");
return prefix + "While\n" + expr.printAST(prefix + " ") + block.printAST(prefix + " ");
}

@Override
Expand Down

0 comments on commit e03777b

Please sign in to comment.