summaryrefslogtreecommitdiff
path: root/parsing/parser.mly
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2005-12-12 08:02:38 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2005-12-12 08:02:38 +0000
commit9b865efb2c279a54b5bf9561c3f8b5351a8ddd48 (patch)
tree7f0545f9cf173c371cbf5ebd24b48838b9b0c95e /parsing/parser.mly
parent2a13648d56564367ddd0843646a8389a9c910016 (diff)
downloadocaml-expoly.tar.gz
ajout de la quantification des variables de rangeeexpoly
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/expoly@7260 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'parsing/parser.mly')
-rw-r--r--parsing/parser.mly30
1 files changed, 16 insertions, 14 deletions
diff --git a/parsing/parser.mly b/parsing/parser.mly
index 5a04a62591..72e324badf 100644
--- a/parsing/parser.mly
+++ b/parsing/parser.mly
@@ -983,23 +983,27 @@ let_bindings:
| let_bindings AND let_binding { $3 :: $1 }
;
let_binding:
- typevar_list DOT let_val_binding
+ type_intro_list DOT let_val_binding
{ (List.rev $1, fst $3, snd $3) }
| let_val_binding
{ ([], fst $1, snd $1) }
;
+type_intro:
+ QUOTE LIDENT
+ { mktyp (Ptyp_var $2) }
+ | QUOTE LIDENT AS core_type2
+ { mktyp (Ptyp_alias ($4, $2)) }
+;
+type_intro_list:
+ type_intro { [$1] }
+ | type_intro_list type_intro { $2 :: $1 }
+;
let_val_binding:
- val_ident let_fun_binding
+ val_ident fun_binding
{ ({ppat_desc = Ppat_var $1; ppat_loc = rhs_loc 1}, $2) }
| pattern EQUAL seq_expr
{ ($1, $3) }
;
-let_fun_binding:
- fun_binding
- { $1}
- | COLON explicit_poly_type EQUAL seq_expr
- { ghexp(Pexp_constraint($4, Some $2, None)) }
-;
fun_binding:
strict_binding
{ $1 }
@@ -1247,13 +1251,11 @@ typevar_list:
QUOTE ident { [$2] }
| typevar_list QUOTE ident { $3 :: $1 }
;
-explicit_poly_type:
- typevar_list DOT core_type
- { mktyp(Ptyp_poly(List.rev $1, $3)) }
-;
poly_type:
- core_type { mktyp(Ptyp_poly([], $1)) }
- | explicit_poly_type { $1 }
+ core_type
+ { mktyp(Ptyp_poly([], $1)) }
+ | typevar_list DOT core_type
+ { mktyp(Ptyp_poly(List.rev $1, $3)) }
;
/* Core types */