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
|
||||
%left ASSIGN
|
||||
%left LPAREN
|
||||
%left BACKSLASH
|
||||
|
||||
|
||||
|
||||
|
@ -44,6 +45,9 @@
|
|||
%left PLUS MINUS
|
||||
%left SLASH STAR
|
||||
|
||||
%left let1
|
||||
%left fun1
|
||||
|
||||
|
||||
%%
|
||||
|
||||
|
@ -118,8 +122,8 @@ label_with_type:
|
|||
vdefinition:
|
||||
/* Valeur simple */
|
||||
| LET i=located(identifier) ts=option(vdef_type_scheme)
|
||||
EQUAL e=located(expression) {
|
||||
SimpleValue(i, ts, e)
|
||||
EQUAL e=located(expression) %prec let1 {
|
||||
SimpleValue(i, ts, e)
|
||||
}
|
||||
/* Fonction(s)
|
||||
* Exemple :
|
||||
|
@ -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 } */
|
||||
|
|
Reference in a new issue