[antlr-interest] Iteration and token comparison?

Jones, Keith kpj1 at wustl.edu
Sun Feb 26 21:23:44 PST 2012


Hello,

I'm new to ANTLR and I'm still trying to get a feel for exactly what it can do. There's two things I need to do with it, but I'm not sure how and I haven't been able to find information online about them...

1) Suppose I have a grammar rule COLUMN, and another rule MAX that has the format "COLUMN COLUMN+", i.e. it takes a series of two or more COLUMNs. How would I iterate over the columns of MAX and extract properties from each?

2) I have a grammar rule for NAMEs, each consisting of a series of LETTERs ('a' . . . 'z'). Is there any way to compare values of LETTERs in the NAMEs to do things such as sort items alphabetically?

Thanks!


More information about the antlr-interest mailing list