Yes, any of the following would work also:
(1) test -> "XY" "A" | "XY" "B";
(2) test -> "X" "Y" "A" | "X" "Y" "B";
(3) test -> "X" "Y" ("A" | "B");
It all depends on what your tokens are, and whether the differences
are significant between "XY" prior to an "A" and "XY" prior to a "B".
For example, your proposed alternate grammar and my grammar (3)
consider "XY" the same whether it's followed by an "A" or a "B". So
if you feed it just "XY", it will fully parse those two characters,
yield them as tokens, and assign them slot number (which I don't
describe in the manual very well yet).
On the other hand, my alternate grammars (1) and (2) consider "XY"
preceding an "A" to be something totally different from an "XY"
preceding a "B". So if you just feed it "XY" it won't know which of
the two alternatives to choose yet since it hasn't seen a character or
token that would distinguish them. So not until it sees "A" or "B"
will it yield anything.
> Thanks for the detailed response!
Thanks for the good questions!
Josh