[antlr-interest] Re: Antlr grammar to parse Java classfile?
J. Stephen Riley Silber
jsrs701 at yahoo.com
Tue Dec 4 15:08:53 PST 2001
--- In antlr-interest at y..., "Robert" <renyedi at y...> wrote:
> Greetings!
>
> First of all, I don't know about the existence of such a (n ANTLR)
grammar.
Terry's been trying to get someone to write a .class file parser in
ANTLR ever since the binary file support came out. He harassed me
about it at JavaOne in 1998. (No really, Terry, I just haven't got
around to it yet!)
> 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
Yup, when I was designing such a beast in my head, this was indeed
the problem. However...
> I know that predicates are one of the features ANTLR has. I think
this could
> be the only salvation...
Symantic predicates would indeed handle the "match n-times" problem.
The thing is, and sorry Terry--nothing personal, I just don't think
ANTLR is really the right tool for this kind of thing.
Building the .class file parser in any language with decent byte and
bit analysis constructs is gonna be easy--tedious, definitely, but
pretty easy.
The real advantage of building a parser in ANTLR is when you have to
*change* the parser. And in this case, for something so binary, I
think changing the ANTLR parser vs. changing a C parser (for example)
would end up being a wash.
Of course, I might be way off base here. :-)
In any event, I still think ANTLR is the best thing going in the
parser-generator world, by far!
JSRS
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list