fix do while
This commit is contained in:
parent
bfbcc60c5d
commit
144b0bdc75
1 changed files with 8 additions and 4 deletions
|
@ -31,6 +31,7 @@
|
||||||
%right SEMICOLON
|
%right SEMICOLON
|
||||||
%left ASSIGN
|
%left ASSIGN
|
||||||
%left LPAREN
|
%left LPAREN
|
||||||
|
%left BACKSLASH
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,6 +45,9 @@
|
||||||
%left PLUS MINUS
|
%left PLUS MINUS
|
||||||
%left SLASH STAR
|
%left SLASH STAR
|
||||||
|
|
||||||
|
%left let1
|
||||||
|
%left fun1
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
@ -118,7 +122,7 @@ label_with_type:
|
||||||
vdefinition:
|
vdefinition:
|
||||||
/* Valeur simple */
|
/* Valeur simple */
|
||||||
| LET i=located(identifier) ts=option(vdef_type_scheme)
|
| LET i=located(identifier) ts=option(vdef_type_scheme)
|
||||||
EQUAL e=located(expression) {
|
EQUAL e=located(expression) %prec let1 {
|
||||||
SimpleValue(i, ts, e)
|
SimpleValue(i, ts, e)
|
||||||
}
|
}
|
||||||
/* Fonction(s)
|
/* Fonction(s)
|
||||||
|
@ -137,7 +141,7 @@ vdef_type_scheme:
|
||||||
|
|
||||||
fundef:
|
fundef:
|
||||||
| COLON t=option(located(type_scheme)) i=located(identifier) p=located(pattern)
|
| 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, t, FunctionDefinition(p, e)
|
||||||
}
|
}
|
||||||
| i=located(identifier) p=located(pattern) EQUAL e=located(expression) {
|
| i=located(identifier) p=located(pattern) EQUAL e=located(expression) {
|
||||||
|
@ -414,7 +418,7 @@ expression:
|
||||||
* do { expr } until ( expr ) */
|
* do { expr } until ( expr ) */
|
||||||
| DO LBRACE e1=located(expression) RBRACE
|
| DO LBRACE e1=located(expression) RBRACE
|
||||||
UNTIL LPAREN e2=located(expression) RPAREN {
|
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
|
/* Boucle for - Boucle bornée
|
||||||
* for x in (e1 to e2) { expr } */
|
* for x in (e1 to e2) { expr } */
|
||||||
|
|
Reference in a new issue