Java Parser

hi All,

i generated a parser using javacc parser generator and i want to use this parser for parsing java programs , fine till now everything is ok. i could generate the parser and it is parsing my code very well...and is also generating errors when it encounters them....but the problem is if it encounters any error it throws an exception which inturn generates the error and stops .....what i want exactly it to do is ...to generate all the errors of the program all at once....not to stop just after one error....is it possible?...i want it to generate errors as a compiler does all at once...is it possible ...if so?..what exactly should i do?..

hmmm...i don't know if u really did understand my problem..if yes..then please...do reply ...

thx in advance...

Pushpa

[801 byte] By [Pushpa.Reddya] at [2007-10-3 12:01:31]
# 1

I suggest that you use javac to parse Java programs, here are some examples I'm using for the compiler guide:

https://openjdk.dev.java.net/nonav/compiler/staging-area/guides/examples/GetTrees.java

https://openjdk.dev.java.net/nonav/compiler/staging-area/guides/examples/Options.java

Use them like so:

javac -cp /usr/java/jdk1.6.0/lib/tools.jar GetTrees.java Options.java

java -cp /usr/java/jdk1.6.0/lib/tools.jar:. GetTrees Options.java

Alternatively, read up on parsers and error recovery. It is not light reading but I do have some suggestions:

http://blogs.sun.com/ahe/entry/good_books_on_compiler_design

PeterAhea at 2007-7-15 14:38:10 > top of Java-index,Developer Tools,Java Compiler...