[antlr-interest] Please help with grammar tweak

Brian Krahmer brian at krahmer.com
Mon Nov 30 14:05:18 PST 2009


Hello,
  I have a small issue with a grammar file, and really don't know what 
I'm doing.  :)  Can anyone help me please?

Applicable part of my grammar:

const_array : lb:LBRACK list_array_data RBRACK! ;
list_array_data : array_data (COMMA! array_data)? ;
array_data  : atom  |  (STRING1 | STRING2) ARROW^ atom ;

"foo = [1, 2];" works.  However, I need to be able to have 1..n 
array_data elements, such as "foo = [1, 2, 3, 4];"

I'm sure this is probably a small tweak, but I'm not sure how to fix 
it.  Thanks in advance!



More information about the antlr-interest mailing list