[antlr-interest] 'any order' operator in ANTLR?

Marc Bischof atlan at gmx.li
Wed Aug 6 05:49:26 PDT 2008


Hello List,

I question if an 'any order' operator makes sense in grammar development.
Do you already considered this?

I will explain what I mean in a short example:

You want to model a rule S with 3 optional nonterminals (call them A B and C) 
where the order of occurrence is not relevant.

So far without too much overhead you will model that like this (forcing a 
fixed order):

S : A? B? C?

To omit overhead, I think that for such cases it might be more clear to have 
an 'any order' operator (called  '~' here).
With that operator one can say:

S : (A? B? C?)~

What do you think? Did I miss s.th.? Is it already possible with ANTLR?

Cheers Marc


More information about the antlr-interest mailing list