[antlr-interest] Antlr grammar to parse Java classfile?

Andreas Rueckert a_rueckert at gmx.net
Tue Dec 4 04:43:43 PST 2001


On Die, 04 Dez 2001 Robert wrote:
> Greetings!
> First of all, I don't know about the existence of such a (n ANTLR) grammar.
> I know pretty much the java .class file format. As it is straighforward, I
> have built a package that reads and writes this file format.

What is it called? I studied some packages yesterday, but most of them are too
big or have the wrong license for my purpose.
> Based on that experience, I think the main problem of building such a
> grammar would be to apply a certain rule a specific number of times (for
> instance you read the number of methods the class file holds and based on
> this number, you iterate to read every method). This is the main
> characteristic of the .class format (as well as of many binary file format).

I know. I already thought about that problem and I guess it could be solved
within the production of such a rule.

> I know that predicates are one of the features ANTLR has. I think this could
> be the only salvation... However, if you manage to find an existing grammar,
> please let me know.
> Robert
> PS.: You may find the exact description of the .class format in the Java
> Virtual Machine Specification.

I studied the JVM specs before I wrote my posting. That's when I thought that
doing the parsing with Antlr should be easier than writing the parser myself.



Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list