-
Notifications
You must be signed in to change notification settings - Fork 0
/
gramar.txt
51 lines (46 loc) · 791 Bytes
/
gramar.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
%%
SL -> S | S ; SL
S -> AS | CS | WHILE| MS
AS -> V := E
CS -> if RS then S else S
WHILE -> while RS do S
MS -> begin SL end
E -> T | E + T | E - T
T -> F | T * F | T / F
F -> V | int | ( E )
RS -> E OP E
V -> id
OP -> < | <= | == | > | >= | <>
%%
%%
SL -> S SL1
SL1 -> ; SL | EPSILON
S -> AS | CS | WHILE | MS
AS -> V := E
CS -> if RS then S else S
WHILE -> while RS do S
MS -> begin SL end
E -> T E1
E1 -> + T E1 | - T E1 | EPSILON
T -> F T1
T1 -> * F T1 | / F T1 | EPSILON
F -> V | int | ( E )
RS -> E OP E
V -> id
OP -> < | <= | == | > | >= | <>
%%
%%
SL: Statement List
S: Statement
AS: Asignment Statement
CS: Conditional Statement
WHILE: while statement
MS: multiple statements
RS: Relational Statement
E: Expression
T: Term
F: Factor
V: Variable
INT: integer
ID: identifier
%%