forked from HaventSlept/Compilerbau24
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParserMain.java
More file actions
19 lines (16 loc) · 806 Bytes
/
ParserMain.java
File metadata and controls
19 lines (16 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.io.OutputStreamWriter;
public class ParserMain {
public static void main(String[] args) throws Exception {
compiler.Lexer lexer = new compiler.Lexer();
compiler.Parser parser = new compiler.Parser(lexer, new compiler.SymbolTable(), null);
//compiler.ast.ASTExprNode rootExpr = parser.parseExpression("2^3 < 7");
compiler.ast.ASTStmtNode printStmt = parser.parseStmt("{DECLARE a;\n DECLARE b\n; a = 1 + 2;\nb = 5;\nPRINT 2+2?5+b:0;\n}");
printStmt.execute();
//OutputStreamWriter outputWriter = new OutputStreamWriter(System.out);
//rootExpr.print(outputWriter, " ");
//printStmt.print(outputWriter, "");
//outputWriter.flush();
//int result = rootExpr.eval();
//System.out.println(result);
}
}