%{ type ('a, 'b) either = Left of 'a | Right of 'b %}
%start phrase
%token A
%token B
%token C
%token D
%token EOF
%type <(int, int) either> phrase
%%
list___anonymous_0_A_B__:
{ ( [] )}
| x = A xs = list___anonymous_0_A_B__
{let x = ( Left x ) in
( x :: xs )}
| y = B xs = list___anonymous_0_A_B__
{let x = ( Right y ) in
( x :: xs )}
list___anonymous_0_C_D__:
{ ( [] )}
| x = C xs = list___anonymous_0_C_D__
{let x = ( Left x ) in
( x :: xs )}
| y = D xs = list___anonymous_0_C_D__
{let x = ( Right y ) in
( x :: xs )}
mixed_list_A_B_:
_1 = list___anonymous_0_A_B__
{ ( _1 )}
mixed_list_C_D_:
_1 = list___anonymous_0_C_D__
{ ( _1 )}
phrase:
xs = mixed_list_A_B_ ys = mixed_list_C_D_ _3 = EOF
{ ( xs @ ys )}
%%