From cb4c2bd66de45bf9c23ae30a611635aa0d469248 Mon Sep 17 00:00:00 2001
From: b21202065 <niels.bauquin@etu.univ-amu.fr>
Date: Fri, 19 Jan 2024 18:04:00 +0100
Subject: [PATCH] zqfeqsg

---
 src/l.cfg | 57 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 50 insertions(+), 7 deletions(-)

diff --git a/src/l.cfg b/src/l.cfg
index 5159f48..1761dce 100644
--- a/src/l.cfg
+++ b/src/l.cfg
@@ -11,9 +11,37 @@ Tokens
 
 espaces = (' ' | 13 | 10)+;
 commentaire= '#' [[0 .. 0xffff] - [10 + 13]]* (10 | 13 | 10 13);
-plus = '+';
 nombre = chiffre+;
-
+ou = '|';
+et = '&';
+egal = '=';
+inf = '<';
+infegal = '<=';
+sup = '>';
+supegal = '>=';
+plus = '+';
+moins = '-';
+mul = '*';
+div = '/';
+non = '!';
+gpar = '(';
+dpar = ')';
+vrai = 'vrai';
+faux = 'faux';
+tantque = 'tantque';
+faire = 'faire';
+pvirg = ';';
+si = 'si';
+alors = 'alors';
+sinon = 'sinon';
+retour = 'retour';
+gacc = '{';
+dacc = '}';
+epsilon = ;
+id = alpha[alpha + chiffre]+;
+gcro = '[';
+dcro = ']';
+virg = ',';
 
 Ignored Tokens
 
@@ -21,12 +49,27 @@ espaces, commentaire;
 
 Productions
 
-// l'axiome
+exp = {ou} exp ou exp1 | {exp1} exp1;
+exp1 = {et} exp1 et exp2 | {exp2} exp2;
+exp2 = {egal} exp2 egal exp3 | {inf} exp2 inf exp3 | {exp3} exp3;
+exp3 = {plus} exp3 plus exp4 | {moins} exp3 moins exp4 | {exp4} exp4;
+exp4 = {mul} exp4 mul exp5 | {div} exp4 div exp5 | {exp5} exp5;
+exp5 = {non} non exp5 | {exp6} exp6;
+exp6 = {parenthesis} gpar exp dpar | {nombre} nombre | {vrai} vrai | {faux} faux ;
+
+ins = {affectation} var egal exp |
+{fairetantque} tantque exp faire bloc |
+{fonction} id gpar lexp dpar |
+{sisinon} si exp alors [alors1]: bloc sinon [sinon1]: bloc |
+{sialors} si exp alors bloc |
+{retour} retour exp pvirg;
+
+bloc = {accolades} gacc lins dacc;
+lins = {lins} ins lins | {epsilon} epsilon;
 
-programme = exp ;
+lexp = {lexp2} lexp2 | {epsilon} epsilon;
+lexp2 = {virgule} exp virg lexp2 | {exp} exp;
 
-exp =
-     {plus} exp plus nombre |
-     {nb} nombre ;
+var = {id} id | {crochets} id gcro exp dcro;
 
 
-- 
GitLab