[antlr-interest] Nubie: How to approach multiple "required" subrules in any order
garym at oedata.com
Fri Nov 6 07:41:10 PST 2009
I'm new to antlr and learning as I'm writing a parser to an ast tree. I'm
not sure how to approach this problem ( I think its simple) and was hoping
someone could help me out.
I have a input stream with a token followed by 3 other rules. Each of the 3
"rules" occurs only once for the parse to be correct, but they can arrive in
any order. If it fails, it should continue on the next characters after
token_big. How do I write the "big_rule" ?
big_rule : token_big ( rule1 | rule2 | rule3 ) -> " also, what do I put
not right >>> ^ ^ ^
rule1: token1 '=' STRING -> ^('=' token1 STRING);
rule2: token2 '=' STRING -> ^('=' token2 STRING);
rule3: token3 '=' STRING -> ^('=' token3 STRING);
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest