add context analysis and custom visitors
This commit is contained in:
@@ -4,6 +4,9 @@ package de.hsrm.compiler.Klang;
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.tree.*;
|
||||
|
||||
import de.hsrm.compiler.Klang.nodes.Node;
|
||||
import de.hsrm.compiler.Klang.visitors.EvalVisitor;
|
||||
|
||||
public class Klang {
|
||||
public static void main(String[] args) throws Exception {
|
||||
// create a CharStream that reads from standard input
|
||||
@@ -19,9 +22,11 @@ public class Klang {
|
||||
KlangParser parser = new KlangParser(tokens);
|
||||
|
||||
ParseTree tree = parser.parse(); // begin parsing at init rule
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
Visitor visitor = new Visitor();
|
||||
visitor.visit(tree);
|
||||
// System.out.println(sb.toString());
|
||||
ContextAnalysis ctxAnal = new ContextAnalysis();
|
||||
Node node = ctxAnal.visit(tree); // this gets us the DAST
|
||||
|
||||
// This
|
||||
EvalVisitor visitor = new EvalVisitor();
|
||||
node.welcome(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user