Browse Source

First commit

Arnaud Vergnet 3 years ago
commit
63975af86f
1 changed files with 53 additions and 0 deletions
  1. 53
    0
      grammaire_c

+ 53
- 0
grammaire_c View File

@@ -0,0 +1,53 @@
1
+les fonctions (avec parametres)
2
+le if
3
+le while
4
+les declarations
5
+les affectations
6
+les operations arith.
7
+le retour de fonction
8
+l'invocation de fonctions
9
+
10
+
11
+C : Fonctions ;
12
+Fonctions : Fonction Fonctions | Fonction ;
13
+
14
+Fonction : tInt tID tPO Params tPF Body ;
15
+
16
+Params : | Param SuiteParams ;
17
+Param : tInt tID ;
18
+
19
+SuiteParams : tVirgule Param SuiteParams | ;
20
+
21
+// Ps : P Ps | ;
22
+// P : tInt tID tVirgule
23
+// Ps =>* tInt tID tVirgule tInt tID tVirgule
24
+// Ps => P Ps => P P Ps ...
25
+
26
+Body : tAO Instructions tAF ;
27
+
28
+Instructions : Instruction Instructions | ;
29
+
30
+Instruction : Aff | If | While | Return | Decl | Invocation tPV ;
31
+
32
+Aff : tID tEQ E tPV ;
33
+
34
+E : tNB | tID | E tADD E | E tMUL E | E tMINUS E | E tDIV E | Invocation | tPO E tPF | tMINUS E ;
35
+
36
+// E : tID tADD tID | ...
37
+
38
+If : tIF tPO Cond tPF Body ;
39
+
40
+Cond : Cond tAND Cond | Cond tOR Cond | E tEQ2 E | E tINF E | tNOT Cond ;
41
+
42
+Invocation : tID tPO  Args  tPF ;
43
+
44
+Args : .... cf params
45
+
46
+Return : tRET E tPV ;
47
+
48
+
49
+
50
+
51
+
52
+
53
+ 

Loading…
Cancel
Save