duplicated_prec.opp.exp 783 Bytes
Newer Older
1 2
%start expr_eoi
%token Colon
3 4
%token Eoi
%token Ident
5
%token Lparen
6 7
%token Rparen
%token Typevar
8 9
%left type_
%left Lparen
10 11 12 13
%type <unit> expr_eoi
%%

expr_eoi:
14
  _1 = expr _2 = Eoi
15 16 17
    {                   ()}

type_expr:
18
  _1 = Ident %prec type_
19 20 21 22
    {let _2 =
      ( None )
in
                                                      ()}
23
| _1 = Ident _1' = Lparen x' = type_expr _3 = Rparen %prec type_
24
    {let _2 =
25
  let _1 = _1' in
26
  let x =
27
    let x = x' in
28 29 30 31 32 33 34 35 36
        ( x )
  in
      ( Some x )
in
                                                      ()}
| _1 = Typevar
    {          ()}

expr:
37
  _1 = Ident
38 39 40 41 42 43 44 45 46
    {        ()}
| _1 = expr _2 = Colon _3 = type_expr
    {                       ()}
| _1 = expr _2 = Lparen _3 = expr _4 = Rparen
    {                          ()}

%%