Skip to content
Snippets Groups Projects
Commit cb4c2bd6 authored by BAUQUIN Niels's avatar BAUQUIN Niels
Browse files

zqfeqsg

parent 9aedd869
Branches
No related tags found
No related merge requests found
...@@ -11,9 +11,37 @@ Tokens ...@@ -11,9 +11,37 @@ Tokens
espaces = (' ' | 13 | 10)+; espaces = (' ' | 13 | 10)+;
commentaire= '#' [[0 .. 0xffff] - [10 + 13]]* (10 | 13 | 10 13); commentaire= '#' [[0 .. 0xffff] - [10 + 13]]* (10 | 13 | 10 13);
plus = '+';
nombre = chiffre+; 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 Ignored Tokens
...@@ -21,12 +49,27 @@ espaces, commentaire; ...@@ -21,12 +49,27 @@ espaces, commentaire;
Productions 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 = var = {id} id | {crochets} id gcro exp dcro;
{plus} exp plus nombre |
{nb} nombre ;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment