This commit is contained in:
Mylloon 2023-10-23 19:22:02 +02:00
parent ca5b578afa
commit ede3bcd07c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,7 +1,6 @@
%{ (* -*- tuareg -*- *) %{ (* -*- tuareg -*- *)
open HopixAST open HopixAST
(* open Position *)
%} %}
@ -16,29 +15,23 @@
%token<char> CHAR %token<char> CHAR
%start<HopixAST.t> program %start<HopixAST.t> program
/* TODO: Résoudre tout les shift/reduce conflits */ /* TODO: Résoudre tout les shift/reduce conflits */
%left FUN %left FUN
%left STRING %left STRING
%left INT %left INT
%right WHILE REF DO %right WHILE REF DO
%left LET MATCH IF FOR %left LET MATCH IF FOR
%right ARROW %right ARROW
%right SEMICOLON %right SEMICOLON
%left ASSIGN %left ASSIGN
%left LPAREN %left LPAREN
%left BACKSLASH %left BACKSLASH
%left EXCLA COLON
/* Priorités binop */
%left EXCLA COLON
/* priorités binop */
%left D_OR %left D_OR
%left D_AND %left D_AND
%left EQUAL_OP INF_EQUAL_OP INF_OP SUP_EQUAL_OP SUP_OP %left EQUAL_OP INF_EQUAL_OP INF_OP SUP_EQUAL_OP SUP_OP
@ -123,7 +116,7 @@ vdefinition:
/* Valeur simple */ /* Valeur simple */
| LET i=located(identifier) ts=option(vdef_type_scheme) | LET i=located(identifier) ts=option(vdef_type_scheme)
EQUAL e=located(expression) %prec let1 { EQUAL e=located(expression) %prec let1 {
SimpleValue(i, ts, e) SimpleValue(i, ts, e)
} }
/* Fonction(s) /* Fonction(s)
* Exemple : * Exemple :
@ -332,16 +325,13 @@ expression:
} }
/* Sequence - Séquencement * /* Sequence - Séquencement *
* Pas sûr, voir s'il ne faut pas une troisième couche d'expression */ * Pas sûr, voir s'il ne faut pas une troisième couche d'expression */
| e=located(simple_expression) | e=located(simple_expression)
SEMICOLON e_list=separated_nonempty_list(SEMICOLON, located(simple_expression)) { SEMICOLON e_list=separated_nonempty_list(SEMICOLON, located(simple_expression)) {
Sequence(e :: e_list) Sequence(e :: e_list)
} }
/* /* | e1=located(expression) SEMICOLON e2=located(expression) {
|e1=located(expression) SEMICOLON e2=located(expression){ Sequence([e1; e2])
Sequence([e1;e2]) } */
}*/
/* Definition locale */ /* Definition locale */
| vd=vdefinition SEMICOLON e=located(expression) { | vd=vdefinition SEMICOLON e=located(expression) {
Define(vd, e) Define(vd, e)