anonymous-param.opp.exp 871 Bytes
Newer Older
1 2 3
%{ type ('a, 'b) either = Left of 'a | Right of 'b %}
%start phrase
%token <int> A
4 5 6 7
%token <int> B
%token <int> C
%token <int> D
%token <int> EOF
8 9 10
%type <(int, int) either> phrase
%%

11
list___anonymous_0_A_B__:
12 13
  
    {    ( [] )}
14 15
| x = A xs = list___anonymous_0_A_B__
    {let x =           ( Left  x ) in
16
    ( x :: xs )}
17
| y = B xs = list___anonymous_0_A_B__
18
    {let x =           ( Right y ) in
19 20
    ( x :: xs )}

21
list___anonymous_0_C_D__:
22 23
  
    {    ( [] )}
24 25
| x = C xs = list___anonymous_0_C_D__
    {let x =           ( Left  x ) in
26
    ( x :: xs )}
27
| y = D xs = list___anonymous_0_C_D__
28
    {let x =           ( Right y ) in
29 30
    ( x :: xs )}

31 32 33 34 35 36 37 38 39 40 41 42
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 )}

43 44 45
%%