This commit is contained in:
Mylloon 2023-10-21 12:54:58 +02:00
parent 48a9b8b23d
commit 8604834fe0
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -61,8 +61,10 @@ definition_typevariablelist:
tdefinition: tdefinition:
/* Type sommes */ /* Type sommes */
/* la définition étant assez compliqué, on va utilisé d'autre terme pour réduire la taille */ /* la définition étant assez compliqué,
| option(PIPE) l=separated_nonempty_list(PIPE, list_constructor_and_their_ty) { * on va utilisé d'autre terme pour réduire la taille */
| option(PIPE)
l=separated_nonempty_list(PIPE, list_constructor_and_their_ty) {
DefineSumType(l) DefineSumType(l)
} }
/* Type produit étiqueté */ /* Type produit étiqueté */
@ -89,7 +91,8 @@ label_with_type:
vdefinition: vdefinition:
/* Valeur simple */ /* Valeur simple */
| LET i=located(identifier) ts=option(vdef_type_scheme) EQUAL e=located(expression) { | LET i=located(identifier) ts=option(vdef_type_scheme)
EQUAL e=located(expression) {
SimpleValue(i, ts, e) SimpleValue(i, ts, e)
} }
/* Fonction(s) /* Fonction(s)
@ -225,7 +228,8 @@ ty:
TyArrow(ty1, ty2) TyArrow(ty1, ty2)
} }
/* N-uplets (N > 1) */ /* N-uplets (N > 1) */
| th=located(simple_ty) STAR tt=separated_nonempty_list(STAR, located(simple_ty)) { | th=located(simple_ty)
STAR tt=separated_nonempty_list(STAR, located(simple_ty)) {
TyTuple(th :: tt) TyTuple(th :: tt)
} }
@ -377,13 +381,15 @@ expression:
} }
/* Do while - Boucle non bornée et non vide /* Do while - Boucle non bornée et non vide
* do { expr } until ( expr ) */ * do { expr } until ( expr ) */
| DO LBRACE e1=located(expression) RBRACE UNTIL LPAREN e2=located(expression) RPAREN { | DO LBRACE e1=located(expression) RBRACE
UNTIL LPAREN e2=located(expression) RPAREN {
Sequence([e2 ; Position.unknown_pos (While(e1, e2))]) Sequence([e2 ; Position.unknown_pos (While(e1, e2))])
} }
/* Boucle for - Boucle bornée /* Boucle for - Boucle bornée
* for x in (e1 to e2) { expr } */ * for x in (e1 to e2) { expr } */
| FOR var=located(identifier) | FOR var=located(identifier)
FROM LPAREN e1=located(expression) RPAREN TO LPAREN e2=located(expression) RPAREN FROM LPAREN e1=located(expression) RPAREN
TO LPAREN e2=located(expression) RPAREN
LBRACE e3=located(expression) RBRACE { LBRACE e3=located(expression) RBRACE {
For(var, e1, e2, e3) For(var, e1, e2, e3)
} }