-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrammar1.txt
56 lines (42 loc) · 1.1 KB
/
grammar1.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
52
53
54
55
56
program -> tip main ( ) { listaInstructiuni }
tip -> int
tip -> float
tip -> double
listaInstructiuni -> instructiune listaInstructiuni1
listaInstructiuni1 -> instructiune listaInstructiuni1
listaInstructiuni1 ->
instructiune -> declarareVariabile
instructiune -> citire
instructiune -> scriere
instructiune -> atribuire
instructiune -> ifCondition
instructiune -> forLoop
declarareVariabile -> tip listaId
listaId -> ID, listaId1
listaId -> ID;
listaId1 -> listaId
listaId1 -> ID;
atribuire -> ID = expresie ;
atribuireFor -> ID = expresie
expresie -> operand operator expresie
expresie -> operand
operand -> CONST
operand -> ID
operator -> +
operator -> -
operator -> *
operator -> /
operator -> %
citire -> CIN >> operand ;
scriere -> COUT >> operand ;
ifCondition -> if ( comparare ) { listaInstructiuni }
ifCondition -> if ( comparare ) { listaInstructiuni } else { listaInstructiuni }
comparare -> expresie rel expresie
comparare -> expresie rel expresie && comparare
rel -> <
rel -> >
rel -> ==
rel -> <=
rel -> >=
rel -> !=
forLoop -> for ( atribuireFor ; comparare ; atribuireFor ) { listaInstructiuni }