|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
A newbie question?Hi there...I'm
trying to construct an abstract syntax tree production that takes
three productions in any order, but they cant be repeated, nor can they be
left out. How does one construct such a production with SableCC, short of
expressing all of the different permutations of the three production
names?
For
example:
precedence =
defaults rows columns
|
rows columns defaults
|
columns rows defaults
|
columns defaults rows
|
rows defaults columns
;
I thought of
this:
precedence = token
token token;
token = row | column
| default;
but that
permits row row row, etc, which are invalid.
I suppose this could
be handled in a semantic step, but is there a better
way?
_______________________________________________ SableCC-Discussion mailing list SableCC-Discussion@... http://lists.sablecc.org/listinfo/sablecc-discussion |
|
|
RE: A newbie question?I think handling this in a semantic step is preferable, that way you can give the user a good message if they make a mistake. _______________________________________________ SableCC-Discussion mailing list SableCC-Discussion@... http://lists.sablecc.org/listinfo/sablecc-discussion |
|
|
RE: A newbie question?I agree with Alastair; just do: precedence = token token token; token = row | column | default; ...and then catch errors like "each token must be used once and only once" in your parser. But it's up to you. -->Seth ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ _______________________________________________ SableCC-Discussion mailing list SableCC-Discussion@... http://lists.sablecc.org/listinfo/sablecc-discussion |
| Free Forum Powered by Nabble | Forum Help |