I am trying to do some style-check/translation work for Java programs.
First I would like a library (preferably in Java) so I can use it in my program.
Second I expect it can do the following:
- scan a whole program (multiple source files)
- provide APIs to access AST for single files
- provide APIs to access call graph, e.g. know all references of a variable, all callers of a method, etc.
In limited time, I briefly examined several tools, such as eclipse, pmd, antlr, soot:
- PMD and ANTLR: lexers/parsers, they are able to get ASTs, but no call graphs since they do not process multiple files
- Eclipse: it seems they provide APIs but only usable within its plugin framework, or binded with its RCP (does not serve as a common use library used in a stand-alone program)
- Soot: seems very close to my requirements. I am reading documents about it.
Correct me if I have misunderstanding for the above.
It is should be possible to use Eclipse Java compiler and its data structures as a library without RCP, etc. You may want to explore how eclipsec.exe handles this feat. That’s the Eclipse equivalent to javac.exe for cases where a command-line compilation is desired.