Tests, Structure, More #10
@ -29,7 +29,7 @@ public class Main {
|
|||||||
|
|
||||||
|
|
||||||
static void parsefile(CharStream codeCharStream) {
|
static void parsefile(CharStream codeCharStream) {
|
||||||
/* ------------------------- Scanner -> tokens ------------------------- */
|
/*------------------------- Scanner -> tokens -------------------------*/
|
||||||
SimpleJavaLexer lexer = new SimpleJavaLexer(codeCharStream);
|
SimpleJavaLexer lexer = new SimpleJavaLexer(codeCharStream);
|
||||||
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
|
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
/* ------------------------- Parser -> Parsetree ------------------------- */
|
/*------------------------- Parser -> Parsetree -------------------------*/
|
||||||
SimpleJavaParser parser = new SimpleJavaParser(tokenStream);
|
SimpleJavaParser parser = new SimpleJavaParser(tokenStream);
|
||||||
ParseTree parseTree = parser.program(); // parse the input
|
ParseTree parseTree = parser.program(); // parse the input
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ public class Main {
|
|||||||
printTree(parseTree, parser, 0);
|
printTree(parseTree, parser, 0);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
/* ------------------------- AST builder -> AST ------------------------- */
|
/*------------------------- AST builder -> AST -------------------------*/
|
||||||
ASTBuilder astBuilder = new ASTBuilder();
|
ASTBuilder astBuilder = new ASTBuilder();
|
||||||
ProgramNode abstractSyntaxTree = (ProgramNode) astBuilder.visit(parseTree);
|
ProgramNode abstractSyntaxTree = (ProgramNode) astBuilder.visit(parseTree);
|
||||||
|
|
||||||
@ -66,19 +66,14 @@ public class Main {
|
|||||||
printAST(abstractSyntaxTree, 0);
|
printAST(abstractSyntaxTree, 0);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
/*
|
/*------------------------- Semantic Analyzer -> Tast -------------------------*/
|
||||||
* ------------------------- Semantic Analyzer -> Tast -------------------------
|
|
||||||
*/
|
|
||||||
SemanticAnalyzer.generateTast(abstractSyntaxTree);
|
SemanticAnalyzer.generateTast(abstractSyntaxTree);
|
||||||
ProgramNode typedAst = (ProgramNode) SemanticAnalyzer.generateTast(abstractSyntaxTree);
|
ProgramNode typedAst = (ProgramNode) SemanticAnalyzer.generateTast(abstractSyntaxTree);
|
||||||
i22011 marked this conversation as resolved
Outdated
|
|||||||
|
|
||||||
// Printing the Tast
|
// Printing the Tast
|
||||||
System.out.println("Tast generated");
|
System.out.println("Tast generated");
|
||||||
|
|
||||||
/*
|
/*------------------------- Bytecode Generator -> Bytecode -------------------------*/
|
||||||
* ------------------------- Bytecode Generator -> Bytecode
|
|
||||||
* -------------------------
|
|
||||||
*/
|
|
||||||
ByteCodeGenerator byteCodeGenerator = new ByteCodeGenerator();
|
ByteCodeGenerator byteCodeGenerator = new ByteCodeGenerator();
|
||||||
//byteCodeGenerator.generateByteCode(abstractSyntaxTree);
|
//byteCodeGenerator.generateByteCode(abstractSyntaxTree);
|
||||||
byteCodeGenerator.visit(typedAst);
|
byteCodeGenerator.visit(typedAst);
|
||||||
|
Binary file not shown.
@ -5,7 +5,7 @@ public class Tester {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// java -jar pfadtocompiler.jar EmptyClass.java
|
// java -jar pfadtocompiler.jar EmptyClass.java
|
||||||
//mit bash scipt ode rmakefile test automatisieren
|
// mit bash scipt ode rmakefile test automatisieren
|
||||||
//mvn package
|
// mvn package
|
||||||
// javac tester // tester compilen
|
// javac tester // tester compilen
|
||||||
// java tester // tester ausführen
|
// java tester // tester ausführen
|
Loading…
Reference in New Issue
Block a user
Same Here