[antlr-interest] getting data from a grammar
Brian Nelson
brian at neuesoftware.com
Mon May 4 12:08:50 PDT 2009
So I have been working on this for about a week, and I even bought the
ANTLR book, but I can't seem to find how to get what seems like simple
data out of the grammar.
Here's a very, very limited example. I am merely trying to get data out
of CSS files. I guess the questions I have are:
1) Should I be using an AST? I assumes I would, since CSS can br broken
down to a tree very simply, but upon further reading, it may not
actually be beneficial since I am not trying to solve a really complex
language issue...
2) How would one, in speudo code, get the actual data out of the following:
The input would be "aa, bb, cc" and I simply want a list of
['aa','bb','cc']. I am not trying to process it, just get the list out
of it, ignoring the commas, in a variable I can use.
prog : rone (COMMA rone)*
;
rone : IDENT;
IDENT: 'a'..'z' ('a'..'z')*;
COMMA: ',';
Thanks in advance,
Brian
--
Brian Nelson
Software Engineer, Neue Software
e. brian at neuesoftware.com
c. +1 408 373 8310
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090504/ce27d737/attachment.html
More information about the antlr-interest
mailing list