This commit is contained in:
Nicolas PENELOUX 2023-10-24 12:39:14 +02:00
parent 144b0bdc75
commit 17d2b0d370

View file

@ -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(