fix do while

This commit is contained in:
Nicolas PENELOUX 2023-10-23 17:28:56 +02:00
parent bfbcc60c5d
commit 144b0bdc75

View file

@ -31,6 +31,7 @@
%right SEMICOLON
%left ASSIGN
%left LPAREN
%left BACKSLASH
@ -44,6 +45,9 @@
%left PLUS MINUS
%left SLASH STAR
%left let1
%left fun1
%%
@ -118,7 +122,7 @@ label_with_type:
vdefinition:
/* Valeur simple */
| LET i=located(identifier) ts=option(vdef_type_scheme)
EQUAL e=located(expression) {
EQUAL e=located(expression) %prec let1 {
SimpleValue(i, ts, e)
}
/* Fonction(s)
@ -137,7 +141,7 @@ vdef_type_scheme:
fundef:
| COLON t=option(located(type_scheme)) i=located(identifier) p=located(pattern)
EQUAL e=located(expression) {
EQUAL e=located(expression) %prec fun1 {
i, t, FunctionDefinition(p, e)
}
| i=located(identifier) p=located(pattern) EQUAL e=located(expression) {
@ -414,7 +418,7 @@ expression:
* do { expr } until ( expr ) */
| DO LBRACE e1=located(expression) RBRACE
UNTIL LPAREN e2=located(expression) RPAREN {
Sequence([e2 ; Position.unknown_pos (While(e1, e2))])
Sequence([e1 ; Position.unknown_pos (While(e2, e1))])
}
/* Boucle for - Boucle bornée
* for x in (e1 to e2) { expr } */