@top A { (X | Y)+ } @tokens { X { "x" } Y { "x" @eof } @precedence { Y, X } } # Matches EOF markers xxx ==> A(X, X, Y)