Eclipse indeed has this, ofcourse, in the JDT Core project.
JDT Core is the Java infrastructure of the Java IDE. It includes:
A Java Model that provides API for navigating the Java element tree. The Java element tree defines a Java centric view of a project. It surfaces elements like package fragments, compilation units, binary classes, types, methods, fields.
Maybe it's worth to take a closer look if this is something you really need to do.
You could also have a look at JavaCC, a Java parser generator. It includes a Java grammar as one of the examples (but only for Java 1.0 and 1.1...).
If you search a little with Google, you'll find some other things like this one: JParse (I have no idea how useful or complete this is). [ August 02, 2006: Message edited by: Jesper Young ]