output the generated assembler code

This commit is contained in:
2019-11-26 08:08:06 +01:00
parent 7d17accad5
commit 2c2696207f

View File

@@ -34,6 +34,14 @@ public class Klang {
node.welcome(printVisitor); node.welcome(printVisitor);
System.out.println(w.toString()); System.out.println(w.toString());
// Generate assembler code
System.out.println("\nPrinting the assembler code");
StringWriter wAsm = new StringWriter();
GenASM.ExWriter exAsm = new GenASM.ExWriter(wAsm);
GenASM genasm = new GenASM(exAsm);
node.welcome(genasm);
System.out.println(wAsm.toString());
// Evaluate the sourcecode and print the result // Evaluate the sourcecode and print the result
System.out.println("\nEvaluating the source code:"); System.out.println("\nEvaluating the source code:");
EvalVisitor evalVisitor = new EvalVisitor(); EvalVisitor evalVisitor = new EvalVisitor();