Results 1 to 3 of 3
  1. #1
    sudh is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Exclamation 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

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,513
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by sudh View Post
    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
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,956
    Rep Power
    8

Similar Threads

  1. help on java mozilla html parser.....
    By nijil in forum New To Java
    Replies: 7
    Last Post: 03-01-2010, 06:49 PM
  2. DOM Parser for xml file in java
    By Ms.Ranjan in forum XML
    Replies: 2
    Last Post: 09-18-2009, 04:21 PM
  3. creating image using java
    By mmahesh_mca in forum New To Java
    Replies: 1
    Last Post: 04-26-2008, 11:23 PM
  4. Developing HTML Parser in JAVA
    By shinojkk in forum Advanced Java
    Replies: 1
    Last Post: 01-18-2008, 08:07 PM
  5. Java Mozilla Html Parser 0.1.7
    By levent in forum Java Software
    Replies: 0
    Last Post: 07-30-2007, 04:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •