

Ask HN: Parser for Java - live_to_code

I've done google searches, and generally get back Parser Generators in Java / how to write Parsers in Java.<p>What I want instead, is just a single industrial parser that can parse Java source code (like anything that the jvm can run). (Doing some really simple static analysis stuff).<p>Is there anything "official" that's easy to modify, like a parser from Sun or IBM or eclipse?<p>Thanks!
======
scotth
I believe that one of the ANTLR examples (as provided in the source download),
is a Java parser. <http://www.antlr.org/>

------
robdimarco
Are you looking for JavaCC? <https://javacc.dev.java.net/>

------
JimmyL
>> industrial parser that can parse Java source code (like anything that the
jvm can run)

Do you mean a parser for Java source code or bytecode? I would guess the
former, but the reference to "anything that the jvm can run" suggests you may
be looking for bytecode...

~~~
live_to_code
Java source code.

------
adatta02
Eclipse has the JDT package which gives you access to the parser that Eclipse
uses internally.

~~~
live_to_code
Ah; this is closest to what I want; though if I can use the Sun one Sun uses
for javac, it'd be even better.

~~~
skybrian
Yes, Javac is open source. You can't get any more official than that.
<http://openjdk.java.net/groups/compiler/>

