How do I create a family tree form online?

ANTLR: Which is the best parserĀ  for Java to create AST (Abstract Syntax tree?

  • I want to create AST(Abstract Syntax Tree) form java source.I am thinking of using Antlr what are its pros and cons

  • Answer:

    You can leverage the javac compiler's API to get an AST and walk the tree nodes. Sun released the http://docs.oracle.com/javase/6/docs/jdk/api/javac/tree/ in Java 6 that lets you hook Annotation Parsers, which run after the parsing phase of the Java compiler (which can also be invoked programatically rather than through the command-line). Although this API was intended to pre-process annotations and modify the source code... it can also be used for general AST analysis since you can basically visit every node of the AST.

Rohan Padhye at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.