Creating a Parser in Java for Java

Hi there,
I have just 6 months familiarity with JAVA so excuse me if I am being foolish sometimes. ..
My objective is to create an application in Java which should be able to create a flow chart of a Java program once its source code is given as input to the application. It should also be able to generate a basic class hierarchy or functional hierarchy (If there is one) by reading the source code of the application. Now my problem is that I am researching on this since two weeks but didn't get anything significant.......My approach to do this would be

1. Parse the Java Program..extract as much info as I can
2. Use tis info to generate the flow chart and all

now problem with the first is I need to write grammars to parse the java program...and it may complicate the project....so Can you people suggest any other solution or a more elegant approach....

To generate gramars I am thinking of using Antlr is it the right choice or Is there something better??...and even better can anyone guide me on ow to write full fledged grammar to parse a Java Program So that the stated objectives can be achieved???...
hanks in advance.....plz help

To generate gramars I am thinking of using Antlr is it the right choice or Is there something better??

While Antlr is a great tool, it is a detour here; Java 1.6 comes with a complete API for javac, the bundled Java compiler. After parsing you get a complete AST (Abstract Syntax Tree) which you can traverse and collect all your information from. When you go to the start page of the API documentation you'll find a 'brick' in the top row, second from the left, labeled 'javac'; that's where it all starts.

kind regards,

Jos

I have the stamina of a seal; I lie on the beach instead of running on it.