public void loadProgramFromString(String progStr) { IntlyLexer lexer = new IntlyLexer(new ANTLRInputStream(progStr)); IntlyParser parser = new IntlyParser(new CommonTokenStream(lexer)); parser.setBuildParseTree(true); ParseTree tree = parser.program(); ProgramBuilder builder = new ProgramBuilder(); ParseTreeWalker.DEFAULT.walk(builder, tree); program = builder.getProg(); }
public void loadProgramFromFile(String filename) throws IOException { IntlyLexer lexer = new IntlyLexer(new ANTLRFileStream(filename)); IntlyParser parser = new IntlyParser(new CommonTokenStream(lexer)); parser.setBuildParseTree(true); ParseTree tree = parser.program(); ProgramBuilder builder = new ProgramBuilder(); ParseTreeWalker.DEFAULT.walk(builder, tree); program = builder.getProg(); }