renommage pour bien voir avec la grammaire

This commit is contained in:
Mylloon 2023-10-24 15:12:10 +02:00
parent 7af9e7622f
commit 27696ecf09
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -73,7 +73,7 @@ definition:
DefineType (tc, tvl, Abstract) DefineType (tc, tvl, Abstract)
} }
/* Valeurs externes */ /* Valeurs externes */
| EXTERN id=located(identifier) COLON ts=located(type_scheme) { | EXTERN id=located(var_identifier) COLON ts=located(type_scheme) {
DeclareExtern(id, ts) DeclareExtern(id, ts)
} }
/* Définition de valeurs */ /* Définition de valeurs */
@ -112,14 +112,14 @@ list_ty:
} }
label_with_type: label_with_type:
| l=located(label) COLON t=located(ty) { | l=located(label_identifier) COLON t=located(ty) {
l, t l, t
} }
vdefinition: vdefinition:
/* Valeur simple */ /* Valeur simple */
| LET i=located(identifier) ts=option(colon_type_scheme) | LET i=located(var_identifier) ts=option(colon_type_scheme)
EQUAL e=located(expression) %prec let1 { EQUAL e=located(expression) %prec let1 {
SimpleValue(i, ts, e) SimpleValue(i, ts, e)
} }
@ -133,7 +133,7 @@ vdefinition:
fundef: fundef:
| t=option(colon_type_scheme) i=located(identifier) p=located(pattern) | t=option(colon_type_scheme) i=located(var_identifier) p=located(pattern)
EQUAL e=located(expression) %prec fun1 { EQUAL e=located(expression) %prec fun1 {
i, t, FunctionDefinition(p, e) i, t, FunctionDefinition(p, e)
} }
@ -157,7 +157,7 @@ branch:
simple_pattern: simple_pattern:
/* Motif universel liant */ /* Motif universel liant */
| i=located(identifier) { | i=located(var_identifier) {
PVariable i PVariable i
} }
/* Motif universel non liant */ /* Motif universel non liant */
@ -183,7 +183,7 @@ simple_pattern:
/* Enregistrement */ /* Enregistrement */
| LBRACE l=separated_nonempty_list( | LBRACE l=separated_nonempty_list(
COMMA, COMMA,
separated_pair(located(label), EQUAL, located(pattern)) separated_pair(located(label_identifier), EQUAL, located(pattern))
) RBRACE tl=option(type_list) { ) RBRACE tl=option(type_list) {
PRecord(l, tl) PRecord(l, tl)
} }
@ -278,7 +278,7 @@ simple_expression:
Literal l Literal l
} }
/* Variable */ /* Variable */
| i=located(identifier) tl=option(type_list) { | i=located(var_identifier) tl=option(type_list) {
Variable(i, tl) Variable(i, tl)
} }
/* Tagged Value - Construction d'une donnée */ /* Tagged Value - Construction d'une donnée */
@ -297,7 +297,7 @@ simple_expression:
/* Record - Construction d'un enregistrement */ /* Record - Construction d'un enregistrement */
| LBRACE l=separated_nonempty_list( | LBRACE l=separated_nonempty_list(
COMMA, COMMA,
separated_pair(located(label), EQUAL, located(expression)) separated_pair(located(label_identifier), EQUAL, located(expression))
) RBRACE tl=option(type_list) { ) RBRACE tl=option(type_list) {
Record(l, tl) Record(l, tl)
} }
@ -322,7 +322,7 @@ expression:
e e
} }
/* Field - Projection dun champ */ /* Field - Projection dun champ */
| e=located(expression) DOT l=located(label) tl=option(type_list) { | e=located(expression) DOT l=located(label_identifier) tl=option(type_list) {
Field(e, l, tl) Field(e, l, tl)
} }
/* Sequence - Séquencement * /* Sequence - Séquencement *
@ -415,7 +415,7 @@ expression:
} }
/* Boucle for - Boucle bornée /* Boucle for - Boucle bornée
* for x in (e1 to e2) { expr } */ * for x in (e1 to e2) { expr } */
| FOR var=located(identifier) | FOR var=located(var_identifier)
FROM LPAREN e1=located(expression) RPAREN FROM LPAREN e1=located(expression) RPAREN
TO LPAREN e2=located(expression) RPAREN TO LPAREN e2=located(expression) RPAREN
LBRACE e3=located(expression) RBRACE { LBRACE e3=located(expression) RBRACE {
@ -434,9 +434,9 @@ expression:
/******************************** BASIC TYPES *********************************/ /******************************** BASIC TYPES *********************************/
identifier: var_identifier:
| i=ID { | var_id=ID {
Id i Id var_id
} }
type_variable: type_variable:
@ -445,17 +445,17 @@ type_variable:
} }
constructor: constructor:
| kid=CID { | constr_id=CID {
KId kid KId constr_id
} }
type_constructor: type_constructor:
| tcon=ID { | type_con=ID {
TCon tcon TCon type_con
} }
label: label_identifier:
| label=ID { | label=ID {
LId label LId label
} }