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

jsrs701 jsrs701 at yahoo.com
Wed Dec 5 13:25:54 PST 2001


--- In antlr-interest at y..., Terence Parr <parrt at j...> wrote:
> Nice discussion of what's best to use and thanks for supporting 
ANTLR!  

<obsequiousness>
Ye flipping gods, man, don't you just wake up in the morning full of 
pride at the amazing critter you have invented?  I wouldn't be able 
to get through doorways my head would be so big!  You deserve mucho 
kudos.
</obsequiousness>

> One thing that you might also consider is simply using Java 
reflection 
> to pull apart the class files...

Er, um, duh...  :-)  Never would have thought of that.  When I think 
about problems involving bit scanning, I automatically think in terms 
of C or assembly.

> Anyway, concerning the "match n times" thing.  You're right...it 
would 
> be pretty useful.  What syntax is appropriate and how to do you say 
> 0...n vs 1..n? 

I'd vote for Perl's RE syntax...

{n}    Match exactly n times
{n,}   Match at least n times
{n,m}  Match at least n, at most m times

...but I know the curly braces are gonna wreak havoc with the 
existing ANTLR syntax.

> Perhaps, for uniformity, we use my "element modifier 
> syntax (e.g., "INT<AST=INTNode>"):

Um, that just doesn't look quite right, but since I don't have a 
better solution, I won't press the point.  :-)

JSRS



 

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



More information about the antlr-interest mailing list