refactor doing nothing

This commit is contained in:
Mylloon 2023-10-24 23:46:32 +02:00
parent 88efc86649
commit 485c2cd15c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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,53 +283,16 @@ 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)
}
/* Record - Construction d'un enregistrement */
| LBRACE l=separated_nonempty_list(
COMMA,
separated_pair(located(label_identifier), EQUAL, located(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)
@ -340,13 +301,32 @@ mid_expression:
| 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,
separated_pair(located(label_identifier), EQUAL, located(expression))
) RBRACE tl=option(type_list) {
Record(l, tl)
}
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])
@ -423,7 +403,20 @@ expression:
| 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 *********************************/