[antlr-interest] Use each token Once -- All required

Joan Pujol joanpujol at gmail.com
Tue Sep 21 09:59:03 PDT 2004

If it is posible you can define a more general token that matches the
four tokens. And do the check at semantic level.

Remember that you can use semantic predicates in the parser.


On Tue, 21 Sep 2004 15:15:38 -0000, georgehernando
<georgehernando at hotmail.com> wrote:
> How can I specify a compact syntax for the parser that will define a
> list of token types from the lexer where each type must appear, but
> only one time?
> XXX :  (TokenType1 | TokenType2 | TokenType3 | TokenType4)+;
> doesn't limit the token types to appearing only one time.
> Do I have to specify all permutations?
> XXX :  ( (TokenType1 TokenType2 TokenType3 TokenType4) |
>          (TokenType1 TokenType2 TokenType4 TokenType3) |
>          (TokenType1 TokenType4 TokenType3 TokenType2) |
>          (TokenType4 TokenType2 TokenType3 TokenType1) |
>          (TokenType2 TokenType1 TokenType3 TokenType4) |
>          ....
>         )

Joan Jesús Pujol Espinar

Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

More information about the antlr-interest mailing list