From 27696ecf09762c63d6b310cc26ee6d5d8a81d159 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 24 Oct 2023 15:12:10 +0200 Subject: [PATCH] renommage pour bien voir avec la grammaire --- flap/src/hopix/hopixParser.mly | 36 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/flap/src/hopix/hopixParser.mly b/flap/src/hopix/hopixParser.mly index b3e64ee..4396ea7 100644 --- a/flap/src/hopix/hopixParser.mly +++ b/flap/src/hopix/hopixParser.mly @@ -73,7 +73,7 @@ definition: DefineType (tc, tvl, Abstract) } /* Valeurs externes */ -| EXTERN id=located(identifier) COLON ts=located(type_scheme) { +| EXTERN id=located(var_identifier) COLON ts=located(type_scheme) { DeclareExtern(id, ts) } /* Définition de valeurs */ @@ -112,14 +112,14 @@ list_ty: } label_with_type: -| l=located(label) COLON t=located(ty) { +| l=located(label_identifier) COLON t=located(ty) { l, t } vdefinition: /* 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 { SimpleValue(i, ts, e) } @@ -133,7 +133,7 @@ vdefinition: 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 { i, t, FunctionDefinition(p, e) } @@ -157,7 +157,7 @@ branch: simple_pattern: /* Motif universel liant */ -| i=located(identifier) { +| i=located(var_identifier) { PVariable i } /* Motif universel non liant */ @@ -183,7 +183,7 @@ simple_pattern: /* Enregistrement */ | LBRACE l=separated_nonempty_list( COMMA, - separated_pair(located(label), EQUAL, located(pattern)) + separated_pair(located(label_identifier), EQUAL, located(pattern)) ) RBRACE tl=option(type_list) { PRecord(l, tl) } @@ -278,7 +278,7 @@ simple_expression: Literal l } /* Variable */ -| i=located(identifier) tl=option(type_list) { +| i=located(var_identifier) tl=option(type_list) { Variable(i, tl) } /* Tagged Value - Construction d'une donnée */ @@ -297,7 +297,7 @@ simple_expression: /* Record - Construction d'un enregistrement */ | LBRACE l=separated_nonempty_list( COMMA, - separated_pair(located(label), EQUAL, located(expression)) + separated_pair(located(label_identifier), EQUAL, located(expression)) ) RBRACE tl=option(type_list) { Record(l, tl) } @@ -322,7 +322,7 @@ expression: e } /* Field - Projection d’un 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) } /* Sequence - Séquencement * @@ -415,7 +415,7 @@ expression: } /* Boucle for - Boucle bornée * for x in (e1 to e2) { expr } */ -| FOR var=located(identifier) +| FOR var=located(var_identifier) FROM LPAREN e1=located(expression) RPAREN TO LPAREN e2=located(expression) RPAREN LBRACE e3=located(expression) RBRACE { @@ -434,9 +434,9 @@ expression: /******************************** BASIC TYPES *********************************/ -identifier: -| i=ID { - Id i +var_identifier: +| var_id=ID { + Id var_id } type_variable: @@ -445,17 +445,17 @@ type_variable: } constructor: -| kid=CID { - KId kid +| constr_id=CID { + KId constr_id } type_constructor: -| tcon=ID { - TCon tcon +| type_con=ID { + TCon type_con } -label: +label_identifier: | label=ID { LId label }