final List<String> ruleNames = new ArrayList<String>();
try {
final Reader reader = new BufferedReader(new FileReader(grammarFile));
final ANTLRv3Lexer lexer = new ANTLRv3Lexer(new ANTLRReaderStream(reader));
final CommonTokenStream tokens = new CommonTokenStream(lexer);
final ANTLRv3Parser parser = new ANTLRv3Parser(tokens);
parser.rules = ruleNames;
parser.grammarDef();
reader.close();
} catch (Exception e) {
e.printStackTrace();
}