refactor doing nothing
This commit is contained in:
parent
88efc86649
commit
485c2cd15c
1 changed files with 41 additions and 48 deletions
|
@ -24,7 +24,6 @@
|
|||
%left ID
|
||||
%right ARROW
|
||||
%right SEMICOLON
|
||||
%left DOT
|
||||
%left ASSIGN
|
||||
%left LBRACE
|
||||
|
||||
|
@ -275,7 +274,6 @@ colon_type_scheme:
|
|||
|
||||
|
||||
/********************************* EXPRESSION *********************************/
|
||||
|
||||
simple_expression:
|
||||
/* Simple litteral */
|
||||
| l=located(literal) {
|
||||
|
@ -285,20 +283,29 @@ simple_expression:
|
|||
| i=located(var_identifier) tl=option(type_list) {
|
||||
Variable(i, tl)
|
||||
}
|
||||
/* Annotation de type
|
||||
* ( expr : type ) */
|
||||
| LPAREN e=located(expression) COLON t=located(ty) RPAREN {
|
||||
TypeAnnotation(e, t)
|
||||
}
|
||||
/* Tuple n = 0 - Construction d'un 0-uplet */
|
||||
| LPAREN RPAREN {
|
||||
Tuple([])
|
||||
}
|
||||
/* Tuple n > 1 - Construction d'un n-uplet (n > 1) */
|
||||
| el=expr_list {
|
||||
(* S'il y a qu'1 élément, alors c'est juste une expression *)
|
||||
match el with | [alone] -> Position.value alone | _ -> Tuple(el)
|
||||
}
|
||||
|
||||
mid_expression:
|
||||
| e=simple_expression {
|
||||
e
|
||||
}
|
||||
/* Tagged Value - Construction d'une donnée */
|
||||
| const=located(constructor) tl=option(type_list) el=optionlist(expr_list) {
|
||||
Tagged(const, tl, el)
|
||||
}
|
||||
/* Application */
|
||||
| e1=located(mid_expression) e2=located(mid_expression) %prec app1 {
|
||||
Apply(e1, e2)
|
||||
}
|
||||
/* Lecture de variable
|
||||
* !expr */
|
||||
| EXCLA e=located(simple_expression) {
|
||||
Read(e)
|
||||
}
|
||||
/* Record - Construction d'un enregistrement */
|
||||
| LBRACE l=separated_nonempty_list(
|
||||
COMMA,
|
||||
|
@ -306,47 +313,20 @@ simple_expression:
|
|||
) RBRACE tl=option(type_list) {
|
||||
Record(l, tl)
|
||||
}
|
||||
/* Lecture de variable
|
||||
* !expr */
|
||||
| EXCLA e=located(simple_expression) {
|
||||
Read(e)
|
||||
}
|
||||
|
||||
|
||||
type_list:
|
||||
| INFERIOR tl=separated_list(COMMA, located(ty)) SUPERIOR {
|
||||
tl
|
||||
}
|
||||
|
||||
expr_list:
|
||||
| LPAREN el=separated_nonempty_list(COMMA, located(expression)) RPAREN {
|
||||
el
|
||||
}
|
||||
|
||||
|
||||
mid_expression:
|
||||
| e=simple_expression {
|
||||
e
|
||||
}
|
||||
/* Field record */
|
||||
| e=located(mid_expression) DOT l=located(label_identifier) tl=option(type_list) {
|
||||
Field(e, l, tl)
|
||||
}
|
||||
/* Tagged Value - Construction d'une donnée */
|
||||
| const=located(constructor) tl=option(type_list) el=optionlist(expr_list) {
|
||||
Tagged(const, tl, el)
|
||||
}
|
||||
/* Application */
|
||||
| e1=located(mid_expression) e2=located(mid_expression) %prec app1 {
|
||||
Apply(e1, e2)
|
||||
}
|
||||
|
||||
|
||||
|
||||
expression:
|
||||
| e=mid_expression {
|
||||
e
|
||||
}
|
||||
/* Annotation de type
|
||||
* ( expr : type ) */
|
||||
| LPAREN e=located(expression) COLON t=located(ty) RPAREN {
|
||||
TypeAnnotation(e, t)
|
||||
}
|
||||
/* Tuple n = 0 - Construction d'un 0-uplet */
|
||||
| LPAREN RPAREN {
|
||||
Tuple([])
|
||||
}
|
||||
/* Sequence - Séquencement */
|
||||
| e=located(expression) SEMICOLON e2=located(expression) {
|
||||
Sequence([e; e2])
|
||||
|
@ -419,11 +399,24 @@ expression:
|
|||
For(var, e1, e2, e3)
|
||||
}
|
||||
/* Allocation
|
||||
* ref expr */
|
||||
* ref expr */
|
||||
| REF e=located(mid_expression) {
|
||||
Ref(e)
|
||||
}
|
||||
/* Field record */
|
||||
| e=located(mid_expression) DOT l=located(label_identifier) tl=option(type_list) {
|
||||
Field(e, l, tl)
|
||||
}
|
||||
|
||||
type_list:
|
||||
| INFERIOR tl=separated_list(COMMA, located(ty)) SUPERIOR {
|
||||
tl
|
||||
}
|
||||
|
||||
expr_list:
|
||||
| LPAREN el=separated_nonempty_list(COMMA, located(expression)) RPAREN {
|
||||
el
|
||||
}
|
||||
|
||||
|
||||
/******************************** BASIC TYPES *********************************/
|
||||
|
|
Reference in a new issue