5

I need a standalone Java parser (program which "reads" .java source files and generates AST [ie objects representing the contents of source]).

  • There's https://code.google.com/p/javaparser/ but it supports only Java 1.5
  • I know how to run Eclipse Java parser in "standalone" mode, but this parser uses too many Eclipse JARs, is too complex, and uses EPL license, which is GPL-incompatible
  • other IDEs (IntelliJ, NetBeans, JDeveloper) and javac compiler also must have some Java parsers, but I can't find any documentation how to use them in "standalone" applications

Any help? Maybe somebody of You also tried to do some standalone Java parsing?

iirekm
  • 8,890
  • 5
  • 36
  • 46

2 Answers2

0

Our DMS Software Reengineering Toolkit has a full Java 1.7 parser. But a parser isn't enough, if you intend to anything serious; check out Life After Parsing. DMS has the support you need beyond that to process Java interestingly, such as , attribute grammars, symbol tables, transformation rules, etc, plus good documentation for all of that. DMS is designed to support the construction of custom langauge analysis tools. It isn't GPL-compatible, though.

Community
  • 1
  • 1
Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
0

JavaCC has a Java 1.5 grammar.

user207421
  • 305,947
  • 44
  • 307
  • 483