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
Related Q & A:
- Where To Get Best AntiVirus For Java Mobile?Best solution by antivirus.com
- how to create a new syntax in java?Best solution by Stack Overflow
- Which are the best search engines which give only few site names relevant to the subject?Best solution by pandia.com
- Which acoustic guitar should I buy? Which is the best?Best solution by Yahoo! Answers
- Which has more scope in future: Java or .Net?Best solution by Quora
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.