subiso.opp.exp 1.91 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
File "subiso.mly", line 34, characters 10-17:
Warning: the token ASSIGNS is unused.
File "subiso.mly", line 24, characters 7-11:
Warning: the token PLUS is unused.
File "subiso.mly", line 23, characters 16-20:
Warning: the token TVAR is unused.
%{
(***********************************************************************)
(*                                                                     *)
(*                          SubIso                                     *)
(*                                                                     *)
(*                   Projet Cristal, INRIA Rocquencourt                *)
(*                                                                     *)
(*  Copyright 2002 Institut National de Recherche en Informatique et   *)
(*  en Automatique.  All rights reserved.  This file is distributed    *)
(*  under the terms of the GNU Lesser General Public License.          *)
(*                                                                     *)
(*  Roberto Di Cosmo                                                   *)
(***********************************************************************)

(*
 $Id: tparser.mly,v 1.1 2002/03/11 16:03:27 dicosmo Exp $                                                               
*)

open Types
%}
%start main
%token TYPE
%token <string> TVAR
%token RPAR
%token PLUS
%token LPAR
%token <string> IDENT
%token Eof
%token AND
%token EQ
%token ARROW
%token TIMES
%right PRECTYDEF 
%left AND 
%nonassoc EQ 
%right ARROW 
%right TIMES 
%nonassoc ASSIGNS 
%type <Types.ptype> main
%%

main:
| texpr Eof
    { $1 }

texpr:
| IDENT
    { TBase $1}
| LPAR texpr RPAR
    { $2 }
| texpr ARROW texpr
    { TArrow($1,$3) }
| texpr TIMES texpr
    { TProduct($1,$3) }
| TYPE type_binding_list %prec PRECTYDEF
    { Trec(List.rev $2) }

type_binding_list:
| type_binding
    {[$1]}
| type_binding_list AND type_binding
    {$3 :: $1}

type_binding:
| IDENT EQ texpr
    {($1,$3)}

%%