[antlr-interest] newbie problem
Vaclav Barta
vbar at comp.cz
Sat Jun 30 05:37:25 PDT 2007
On Saturday 30 June 2007 14:24, ali azimi wrote:
> How can I modify the following antlr grammar to add a ',' ,whenever it
> matches more than one instance of 'variable':='expression' or
> 'informaltext'? In another word how can I modify the grammar to seperate
> the instances of for example 'infromaltext' by a comma?(so when there is
> just one 'informaltext', it does not add a comma).
>
> taskbody:(variable':='expression)+
> |informaltext+
> ;
AFAIK the normal way is to specify
taskbody: taskitem ( ',' taskitem )*
;
taskitem: ( variable ':=' expression )
| informaltext
;
(This supposes you do want to mix assignments with informal text in a single
taskbody.)
Bye
Vasek
More information about the antlr-interest
mailing list