/** * Run with source as a string object. * * @param codeSource */ public void compile(final String codeSource) { this.input = codeSource; final Compiler compiler = new Compiler(this); try { if (this.verbose) { System.out.println("Running : " + APP + "-" + VERSION); } final AbstractSyntaxTree programAst = this.parser(); compiler.openWriter(); final IProgramVisitor programVisitor = new ProgramVisitor(globalMemory, this, compiler); programVisitor.visit((ProgramRootNode) programAst); } catch (Exception e) { System.out.println(">>>> Error during interpret <<<<"); e.printStackTrace(); } finally { compiler.closeWriter(); } // End of the try - catch // }
@Override public Object visit(final IProgramVisitor visitor) { return visitor.visit(this); }