I have a language in which one expression may immediately follow another. I am 
trying to construct an AST with an imaginary node representing the 
"concatenation" operator. I want the moral equivalent of
expr: term (SP^ term)*;
except that SP does *not* actually appear in the token stream.
When i try
expr: term (term->(^SP $expr term))*;
i get RewriteEmptyStreamException in that rule on input like
a b c
Here is a tiny grammar that demonstrates the problem:
grammar Test;
options {output=AST;}
prog:   expr NL! EOF!;
expr:   term (term->^(SP $expr term))*;
term:   ID;
fragment
SP      :       ' '|'\t';
ID      :       SP*
                ('a'..'z'|'A'..'Z'|'_'|'\u0080'..'\uFFFE')
                ('0'..'9'|'a'..'z'|'A'..'Z'|'_'|'\u0080'..'\uFFFE')*
        ;
NL      :       ('\r'|'\n')+;

I would appreciate anyone pointing out what i am doing wrong.
--
Trevor John Thompson    net: ti...@mac.com

Quidquid Latine dictum sit, altum videtur.


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to