diff --git a/flap/src/hopix/hopixParser.mly b/flap/src/hopix/hopixParser.mly index c36d05c..fcdb551 100644 --- a/flap/src/hopix/hopixParser.mly +++ b/flap/src/hopix/hopixParser.mly @@ -71,6 +71,7 @@ definition: DefineType (tc, tvl, td) } // La tdefinition peut être optionnel, dans ce cas on utilise c'est abstrait + | TYPE tc=located(type_constructor) tvl=optionlist(definition_typevariablelist) { DefineType (tc, tvl, Abstract) } @@ -238,6 +239,11 @@ simple_ty: INFERIOR liste_ty=separated_nonempty_list(COMMA, located(ty)) SUPERIOR { TyCon(tc, liste_ty) } + | tc=type_constructor + INFERIOR SUPERIOR { + TyCon(tc, []) + } + /* Variables de type */ | type_var=type_variable { TyVar(type_var) @@ -266,11 +272,11 @@ ty: type_scheme: /* Il faut peut être modifié le séparateur */ -| LBRACK liste_typevar=separated_list(COMMA, located(type_variable)) +| COLON LBRACK liste_typevar=separated_list(COMMA, located(type_variable)) RBRACK ty=located(ty) { ForallTy(liste_typevar, ty) } -| ty=located(ty) { +| COLON ty=located(ty) { ForallTy([], ty) } @@ -354,6 +360,7 @@ expression: | e1=located(expression) e2=located(expression) { Apply(e1, e2) } + /* Operateurs binaires - Application infixe */ | e1=located(expression) b=binop e2=located(expression) { Apply(