forked from arleenchr/IF2124-Tugas-Besar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrammar.txt
234 lines (234 loc) · 8.9 KB
/
grammar.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
S -> ENTER S
S -> S ENTER
S -> S TITIKKOMA ENTER
S -> ENTER
S -> TITIKKOMA ENTER
S -> SS
SS -> PART SS
PART -> FUNC_STATEMENT
PART -> WHILE_LOOP
PART -> IF_STATEMENT
PART -> SENTENCE
EXP -> ID OP_ROUND_BRACKET CL_ROUND_BRACKET
EXP -> ID OP_ROUND_BRACKET PARAM CL_ROUND_BRACKET
EXP -> ALL
EXP -> BOOLEAN
EXP -> ID_INT
EXP -> EXP ARITH_OP EXP
EXP -> TYPE OP_ROUND_BRACKET EXP CL_ROUND_BRACKET
SENTENCE -> ALL
SENTENCE -> WHILE_LOOP
SENTENCE -> FOR_LOOP
SENTENCE -> FUNC_STATEMENT
SENTENCE -> IF_BLOCK
SENTENCE -> TRY_CATCH_BLOCK
SENTENCE -> TRY_CATCH_FINALLY_BLOCK
SENTENCE -> FUNC_SENTENCE
SENTENCE -> FUNCTION_CALL
SENTENCE -> ARRAY_ACCESSELMT
SENTENCE -> OBJECT_ACCESSELMT
SENTENCE -> ASSIGN
SENTENCE -> ENTER SENTENCE
SENTENCE -> TITIKKOMA ENTER SENTENCE
SENTENCE -> SENTENCE ENTER SENTENCE
SENTENCE -> SENTENCE ENTER
SENTENCE -> SENTENCE TITIKKOMA
SENTENCE -> SENTENCE TITIKKOMA ENTER
SENTENCE -> DELETE ID_INT
SENTENCE -> CONTINUE
SENTENCE -> BREAK
SENTENCE -> VAR_DEC
SENTENCE -> THROW SENTENCE
ASSIGN -> ID INCREMENT
ASSIGN -> INCREMENT ID
ASSIGN -> ID DECREMENT
ASSIGN -> DECREMENT ID
ASSIGN -> ID ASSIGN_OP ASSIGNMENT
ASSIGN -> ARRAY ASSIGN_OP ASSIGNMENT
ASSIGN -> ARRAY OBJECT ASSIGN_OP ASSIGNMENT
FUNCTION_CALL -> ID OP_ROUND_BRACKET CL_ROUND_BRACKET
FUNCTION_CALL -> ID OP_ROUND_BRACKET PARAM CL_ROUND_BRACKET
ARRAY_ACCESSELMT -> ID OP_SQUARE_BRACKET ID_INT CL_SQUARE_BRACKET
OBJECT_ACCESSELMT -> ID TITIK ID_INT
TERNARY_STATEMENT -> EXP TERNARY SENTENCE TITIKDUA SENTENCE
TERNARY_STATEMENT -> STATEMENT TERNARY SENTENCE TITIKDUA SENTENCE
TERNARY_STATEMENT -> ID TERNARY SENTENCE TITIKDUA SENTENCE
TERNARY_STATEMENT -> FUNCTION_CALL TERNARY SENTENCE TITIKDUA SENTENCE
TERNARY_STATEMENT -> LOGIC_OPR TERNARY SENTENCE TITIKDUA SENTENCE
STATEMENT -> EXP LOGIC_OP EXP
IF_STATEMENT -> IF OP_ROUND_BRACKET EXP CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
IF_STATEMENT -> IF OP_ROUND_BRACKET STATEMENT CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
IF_STATEMENT -> IF OP_ROUND_BRACKET ID CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
IF_STATEMENT -> IF OP_ROUND_BRACKET FUNCTION_CALL CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
IF_STATEMENT -> IF OP_ROUND_BRACKET ASSIGN CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
IF_STATEMENT -> IF OP_ROUND_BRACKET LOGIC_OPR CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
ELSEIF_STATEMENT -> ELSE IF OP_ROUND_BRACKET EXP CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
ELSEIF_STATEMENT -> ELSE IF OP_ROUND_BRACKET STATEMENT CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
ELSEIF_STATEMENT -> ELSE IF OP_ROUND_BRACKET ID CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
ELSEIF_STATEMENT -> ELSE IF OP_ROUND_BRACKET FUNCTION_CALL CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
ELSEIF_STATEMENT -> ELSE IF OP_ROUND_BRACKET LOGIC_OPR CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
ELSEIF_MULTIPLE -> ELSEIF_STATEMENT
ELSEIF_MULTIPLE -> ELSEIF_STATEMENT ELSEIF_MULTIPLE
ELSE_STATEMENT -> ELSE OP_CURLY_BRACKET ENTER SENTENCE CL_CURLY_BRACKET
IF_BLOCK -> IF_STATEMENT
IF_BLOCK -> IF_STATEMENT ELSE_STATEMENT
IF_BLOCK -> IF_STATEMENT ELSEIF_MULTIPLE
IF_BLOCK -> IF_STATEMENT ELSEIF_MULTIPLE ELSE_STATEMENT
SWITCH_STATEMENT -> SWITCH OP_ROUND_BRACKET ID CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER SWITCH_SENTENCE CL_CURLY_BRACKET
SWITCH_SENTENCE -> SWITCH_SENTENCE SWITCH_SENTENCE
SWITCH_SENTENCE -> DEFAULT TITIKDUA ENTER SENTENCE
SWITCH_SENTENCE -> DEFAULT TITIKDUA ENTER SENTENCE BREAK
SWITCH_SENTENCE -> CASE INT TITIKDUA ENTER SENTENCE
SWITCH_SENTENCE -> CASE INT TITIKDUA ENTER SENTENCE ENTER BREAK
SWITCH_SENTENCE -> CASE FLOAT TITIKDUA ENTER SENTENCE
SWITCH_SENTENCE -> CASE FLOAT TITIKDUA ENTER SENTENCE ENTER BREAK
SWITCH_SENTENCE -> CASE STRING TITIKDUA ENTER SENTENCE
SWITCH_SENTENCE -> CASE STRING TITIKDUA ENTER SENTENCE ENTER BREAK
SWITCH_SENTENCE -> CASE BOOLEAN TITIKDUA ENTER SENTENCE
SWITCH_SENTENCE -> CASE BOOLEAN TITIKDUA ENTER SENTENCE ENTER BREAK
FOR_LOOP -> FOR OP_ROUND_BRACKET VAR_DEC TITIKKOMA LOGIC_OPR TITIKKOMA ASSIGN CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER LOOP_SENTENCE CL_CURLY_BRACKET
FOR_LOOP -> FOR OP_ROUND_BRACKET ASSIGN TITIKKOMA LOGIC_OPR TITIKKOMA ASSIGN CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER LOOP_SENTENCE CL_CURLY_BRACKET
WHILE_LOOP -> WHILE OP_ROUND_BRACKET LOGIC_OPR CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER LOOP_SENTENCE CL_CURLY_BRACKET
WHILE_LOOP -> WHILE OP_ROUND_BRACKET ID_INT CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER LOOP_SENTENCE CL_CURLY_BRACKET
LOOP_SENTENCE -> SENTENCE
LOOP_SENTENCE -> BREAK
LOOP_SENTENCE -> CONTINUE
LOOP_SENTENCE -> LOOP_SENTENCE ENTER LOOP_SENTENCE
LOOP_SENTENCE -> IF_BLOCK
LOOP_SENTENCE -> IF_BLOCK LOOP_SENTENCE
LOOP_SENTENCE -> TRY_CATCH_BLOCK
LOOP_SENTENCE -> TRY_CATCH_BLOCK LOOP_SENTENCE
LOOP_SENTENCE -> TRY_CATCH_FINALLY_BLOCK
LOOP_SENTENCE -> TRY_CATCH_FINALLY_BLOCK LOOP_SENTENCE
FUNC_STATEMENT -> FUNCTION ID OP_ROUND_BRACKET CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER FUNC_SENTENCE CL_CURLY_BRACKET
FUNC_STATEMENT -> FUNCTION ID OP_ROUND_BRACKET FUNCPARAM CL_ROUND_BRACKET OP_CURLY_BRACKET ENTER FUNC_SENTENCE CL_CURLY_BRACKET
FUNC_SENTENCE -> RETURN ALL
FUNC_SENTENCE -> RETURN STATIC
FUNC_SENTENCE -> RETURN EXP
FUNC_SENTENCE -> RETURN ARITH_OPR
FUNC_SENTENCE -> RETURN OP_ROUND_BRACKET ARITH_OPR CL_ROUND_BRACKET
FUNC_SENTENCE -> RETURN LOGIC_OPR
FUNC_SENTENCE -> RETURN BOOLEAN
FUNC_SENTENCE -> IF_BLOCK
FUNC_SENTENCE -> TRY_CATCH_BLOCK
FUNC_SENTENCE -> TRY_CATCH_FINALLY_BLOCK
FUNC_SENTENCE -> PASS
FUNC_SENTENCE -> SENTENCE
FUNC_SENTENCE -> FUNC_SENTENCE RETURN ALL
FUNC_SENTENCE -> FUNC_SENTENCE RETURN STATIC
FUNC_SENTENCE -> FUNC_SENTENCE RETURN EXP
FUNC_SENTENCE -> FUNC_SENTENCE RETURN LOGIC_OPR
FUNC_SENTENCE -> SENTENCE FUNC_SENTENCE
FUNCPARAM -> PARAM
TRY_CATCH_BLOCK -> TRY_STATEMENT CATCH_STATEMENT
TRY_CATCH_BLOCK -> TRY_STATEMENT ENTER CATCH_STATEMENT
TRY_CATCH_FINALLY_BLOCK -> TRY_STATEMENT CATCH_STATEMENT FINALLY_STATEMENT
TRY_CATCH_FINALLY_BLOCK -> TRY_STATEMENT ENTER CATCH_STATEMENT FINALLY_STATEMENT
TRY_CATCH_FINALLY_BLOCK -> TRY_STATEMENT CATCH_STATEMENT ENTER FINALLY_STATEMENT
TRY_CATCH_FINALLY_BLOCK -> TRY_STATEMENT ENTER CATCH_STATEMENT ENTER FINALLY_STATEMENT
TRY_STATEMENT -> TRY OP_CURLY_BRACKET TRY_CATCH_SENTENCE CL_CURLY_BRACKET
CATCH_STATEMENT -> CATCH OP_ROUND_BRACKET PARAM CL_ROUND_BRACKET OP_CURLY_BRACKET TRY_CATCH_SENTENCE CL_CURLY_BRACKET
FINALLY_STATEMENT -> FINALLY OP_CURLY_BRACKET TRY_CATCH_SENTENCE CL_CURLY_BRACKET
TRY_CATCH_SENTENCE -> SENTENCE
TRY_CATCH_SENTENCE -> THROW SENTENCE
TRY_CATCH_SENTENCE -> IF_BLOCK
ENTER -> NEWLINE
ENTER -> NEWLINE ENTER
LOGIC_ID -> FUNCTION_CALL
LOGIC_ID -> ARRAY_ACCESSELMT
LOGIC_ID -> ID_INT
LOGIC_ID -> NOT ID_INT
LOGIC_ID -> BOOLEAN
LOGIC_ID -> NOT LOGIC_ID
LOGIC_ID -> OP_ROUND_BRACKET LOGIC_ID CL_ROUND_BRACKET
LOGIC_OPR -> ID
LOGIC_OPR -> NOT LOGIC_OPR
LOGIC_OPR -> LOGIC_ID LOGIC_OP LOGIC_OPR
LOGIC_OPR -> LOGIC_ID LOGIC_OP LOGIC_ID
LOGIC_OPR -> OP_ROUND_BRACKET LOGIC_OPR CL_ROUND_BRACKET
LOGIC_OP -> AND
LOGIC_OP -> OR
LOGIC_OP -> NOT
LOGIC_OP -> LESS
LOGIC_OP -> LEQ
LOGIC_OP -> GREATER
LOGIC_OP -> GEQ
LOGIC_OP -> ISEQ
LOGIC_OP -> ISEQTYPE
LOGIC_OP -> ISNEQ
LOGIC_OP -> ISNEQTYPE
LOGIC_OP -> TERNARY
ARITH_OPR -> ID ARITH_OP ARITH_OPR
ARITH_OPR -> STATIC ARITH_OP ARITH_OPR
ARITH_OPR -> ID ARITH_OP ID
ARITH_OPR -> STATIC ARITH_OP ID
ARITH_OPR -> ID ARITH_OP STATIC
ARITH_OPR -> STATIC ARITH_OP STATIC
ARITH_OPR -> OP_ROUND_BRACKET ARITH_OPR CL_ROUND_BRACKET
ARITH_OPR -> TYPE OP_ROUND_BRACKET ARITH_OPR CL_ROUND_BRACKET
ARITH_OP -> TAMBAH
ARITH_OP -> KURANG
ARITH_OP -> KALI
ARITH_OP -> BAGI
ARITH_OP -> MOD
ARITH_OP -> PANGKAT
OPERATION -> ARITH_OPR
OPERATION -> LOGIC_OPR
ASSIGN_OP -> EQ
ASSIGN_OP -> TAMBAHSD
ASSIGN_OP -> KURANGSD
ASSIGN_OP -> KALISD
ASSIGN_OP -> BAGISD
ASSIGN_OP -> MODSD
ASSIGN_OP -> PANGKATSD
ASSIGNMENT -> ALL
ASSIGNMENT -> ID
ASSIGNMENT -> INT
ASSIGNMENT -> STRING
ASSIGNMENT -> FUNCTION_CALL
ASSIGNMENT -> ARRAY_ACCESSELMT
ASSIGNMENT -> OBJECT_ACCESSELMT
ASSIGNMENT -> ARRAY
ASSIGNMENT -> OBJECT
ASSIGNMENT -> OPERATION
ASSIGNMENT -> BOOLEAN
ASSIGNMENT -> TERNARY_STATEMENT
VAR_DEC -> VAR ID
VAR_DEC -> VAR ASSIGN
VAR_DEC -> LET ID
VAR_DEC -> LET ASSIGN
VAR_DEC -> CONST ID
VAR_DEC -> CONST ASSIGN
STATIC -> ID
STATIC -> INT
STATIC -> FLOAT
STATIC -> STRING
STATIC -> ARRAY
STATIC -> OBJECT
STATIC -> BOOLEAN
ARRAY -> OP_SQUARE_BRACKET CL_SQUARE_BRACKET
ARRAY -> OP_SQUARE_BRACKET PARAM CL_SQUARE_BRACKET
OBJECT -> OP_CURLY_BRACKET CL_CURLY_BRACKET
OBJECT -> OP_CURLY_BRACKET OBJECTPARAM CL_CURLY_BRACKET
OBJECTPARAM -> STATIC TITIKDUA STATIC
OBJECTPARAM -> OBJECTPARAM KOMA OBJECTPARAM
PARAM -> ALL
PARAM -> STATIC
PARAM -> PARAM KOMA PARAM
PARAM -> ARITH_OPR
PARAM -> LOGIC_OPR
ALL -> NULL
ALL -> ID_INT
ALL -> STRING
ID -> OP_ROUND_BRACKET ID_INT CL_ROUND_BRACKET
ID_INT -> ID
ID_INT -> NULL
ID_INT -> FLOAT
ID_INT -> INT
ID_INT -> ARRAY_ACCESSELMT
ID_INT -> BOOLEAN
ID_INT -> NONE
BOOLEAN -> TRUE
BOOLEAN -> FALSE
BOOLEAN -> NONE
BOOLEAN -> NOT BOOLEAN