[antlr-interest] Beginer's question, not fitting in subject

Alexandre antlr at alxp.gr
Sat Apr 9 08:22:45 PDT 2005


Hello,

I have a classic, I guess, question. The language I am trying to define cannot
be represented by a grammar, as it is of the form (a)n(b)n. What my file must
do is something like defining tuples, that is series of elements. Suppose that
the syntax to define a serie of values a serie of variables can have is
something like :
(X1, X2, X3)
(1, 2, 3)
(4, 5, 6)

Of course the number of variables is totally arbitrary, but for a given number,
the number the values in each following tuple of values must be the same. How
can I make that with antlr ? I thought about not having antlr detecting it,
that is to accept any list of the form (..,..) for the values, and then treat
(in Java) the result of each, and throwing if necessary an exception. But that
isn't pretty beautiful.

Do you have any suggestion ?

Thank you,

Alexandre


More information about the antlr-interest mailing list