Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2024_compilation_bauquin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BAUQUIN Niels
2024_compilation_bauquin
Commits
151bc9eb
Commit
151bc9eb
authored
1 year ago
by
BAUQUIN Niels
Browse files
Options
Downloads
Patches
Plain Diff
dgrdfhg
parent
314e8ec1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/l.cfg
+39
-36
39 additions, 36 deletions
src/l.cfg
with
39 additions
and
36 deletions
src/l.cfg
+
39
−
36
View file @
151bc9eb
...
...
@@ -11,37 +11,37 @@ Tokens
espaces
=
(' ' | 13 | 10)+;
commentaire
=
'#'
[[0 .. 0xffff] - [10 + 13]]* (10 | 13 | 10 13);
nombre
=
chiffre+;
ou
=
'|'
;
et = '&';
add
=
'+'
;
sub = '-';
mult
=
'*'
;
div = '/';
egal
=
'='
;
inf = '<';
infegal
=
'<='
;
sup = '>';
supegal
=
'>='
;
plus = '+';
moins
=
'-'
;
mul = '*';
div
=
'/'
;
non = '!';
gpar
=
'('
;
dpar = ')';
or
=
'|'
;
and = '&';
not
=
'!'
;
vrai = 'vrai';
faux
=
'faux'
;
tantque
=
'tantque'
;
faire = 'faire';
pvirg
=
';'
;
si = 'si';
alors
=
'alors'
;
sinon = 'sinon';
retour
=
'retour'
;
gpar = '(';
dpar
=
')'
;
gacc = '{';
dacc
=
'}'
;
epsilon = ;
id
=
alpha[alpha + chiffre]+;
gcro = '[';
dcro
=
']'
;
pvirg = ';';
virg
=
','
;
si = 'si';
alors
=
'alors'
;
sinon = 'sinon';
tantque
=
'tantque'
;
faire = 'faire';
retour
=
'retour'
;
ecrire = 'ecrire';
lire
=
'lire'
;
int = 'int';
boolean
=
'boolean'
;
nombre = chiffre+;
id
=
alpha alphanum*;
Ignored
Tokens
...
...
@@ -49,21 +49,25 @@ espaces, commentaire;
Productions
exp
=
{ou} exp ou exp1 | {exp1} exp1;
exp1
=
{et} exp1 et exp2 | {exp2} exp2;
epsilon
=
;
exp
=
{or} exp or exp1 | {exp1} exp1;
exp1
=
{and} exp1 and 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
=
{no
n
} no
n
exp5 | {exp6} exp6;
exp6
=
{parenthesis} gpar exp dpar | {nombre} nombre | {vrai} vrai | {faux} faux | {
l
ire}
lire()
;
exp3
=
{
add
} exp3
add
exp4 | {
sub
} exp3
sub
exp4 | {exp4} exp4;
exp4
=
{mul
t
} exp4 mul
t
exp5 | {div} exp4 div exp5 | {exp5} exp5;
exp5
=
{no
t
} no
t
exp5 | {exp6} exp6;
exp6
=
{parenthesis} gpar exp dpar | {nombre} nombre |
{var} var |
{vrai} vrai | {faux} faux | {
ecr
ire}
ecrire gpar dpar
;
ins
=
{affectation} var egal exp |
var
=
{id} id | {crochets} id gcro exp dcro;
ins
=
{affectation} var egal exp pvirg|
{fairetantque}
tantque
exp
faire
bloc
|
{fonction}
id
gpar
lexp
dpar
|
{fonction}
id
gpar
lexp
dpar
pvirg
|
{sisinon}
si
exp
alors
[alors1]
:
bloc
sinon
[sinon1]
:
bloc
|
{sialors}
si
exp
alors
bloc
|
{retour}
retour
exp
pvirg
|
{ecrire}
ecrire
(e)
;
{ecrire}
ecrire
gpar
exp
dpar
pvirg
;
bloc
=
{accolades} gacc lins dacc;
lins
=
{lins} ins lins | {epsilon} epsilon;
...
...
@@ -71,19 +75,18 @@ lins = {lins} ins lins | {epsilon} epsilon;
lexp
=
{lexp2} lexp2 | {epsilon} epsilon;
lexp2
=
{virgule} exp virg lexp2 | {exp} exp;
var
=
{id} id | {crochets} id gcro exp dcro;
type
=
{bool} bool | {
e
nt
ier
}
e
nt
ier
;
type
=
{bool
ean
} bool
ean
| {
i
nt}
i
nt;
typeopt
=
{type} type | {epsilon} epsilon;
decvar
=
{var} type id | {tableau} type id gcro nombre dcro;
decfonc
=
{fonction} type id gpar [params]: ldecvar
r
par [locals]: ldecvar bloc;
decfonc
=
{fonction} type id gpar [params]: ldecvar
d
par [locals]: ldecvar bloc;
ldecvar
=
{listedecvar} ldecvar2 | {epsilon} epsilon;
ldecvar2
=
{listedecvar2} decvar virg ldecvar2 | decvar;
ldecvar2
=
{listedecvar2} decvar virg ldecvar2 |
{decvar}
decvar;
ldecfonc
=
{listedecfonc} decfonc ldecfonc | {epsilon} epsilon;
prog
=
ldecvar ldecfonc;
\ No newline at end of file
prog
=
{prog} ldecvar ldecfonc;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment