This commit is contained in:
Mylloon 2023-10-24 14:42:23 +02:00
parent da98682682
commit 8be119b71c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,7 +1,6 @@
%{ (* -*- tuareg -*- *)
open HopixAST
(* open Position *)
%}
@ -16,12 +15,9 @@
%token<char> CHAR
%start<HopixAST.t> program
/* TODO: Résoudre tout les shift/reduce conflits */
%left LPAREN
%left let1
@ -38,12 +34,9 @@
%left LBRACE
%left BACKSLASH
%left EXCLA COLON
/* priorités binop */
/* Priorités binop */
%left D_OR
%left D_AND
%left EQUAL_OP INF_EQUAL_OP INF_OP SUP_EQUAL_OP SUP_OP
@ -127,14 +120,14 @@ label_with_type:
vdefinition:
/* Valeur simple */
| LET i=located(identifier) ts=option(colon_type_scheme)
EQUAL e=located(expression) %prec let1{
EQUAL e=located(expression) %prec let1 {
SimpleValue(i, ts, e)
}
/* Fonction(s)
* Exemple :
* - fun : int f a = 1
* - fun f a = 1 and : int g a = 2 */
| FUN fl=separated_nonempty_list(AND_KW, fundef) {
| FUN fl=separated_nonempty_list(AND_KW, fundef) {
RecFunctions(fl)
}
@ -334,16 +327,13 @@ expression:
}
/* Sequence - Séquencement *
* Pas sûr, voir s'il ne faut pas une troisième couche d'expression */
| e=located(simple_expression)
SEMICOLON e_list=separated_nonempty_list(SEMICOLON, located(simple_expression)) {
Sequence(e :: e_list)
}
/*
|e1=located(expression) SEMICOLON e2=located(expression){
Sequence([e1;e2])
}*/
/* | e1=located(expression) SEMICOLON e2=located(expression) {
Sequence([e1; e2])
} */
/* Definition locale */
| vd=vdefinition SEMICOLON e=located(expression) {
Define(vd, e)