-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrammar.txt
216 lines (137 loc) · 5.91 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
program : statement
program : statement program
statement : assignation
| transformation
| control
integer_argument : IDENTIFIER
| INTEGER
| STEP
integer_argument : integer_argument ADD_OP integer_argument
| integer_argument MUL_OP integer_argument
string_argument : STRING
string_argument : IDENTIFIER
point_argument : IDENTIFIER
| POINT
color_argument : IDENTIFIER
| COLOR
boolean_argument : IDENTIFIER
| BOOLEAN
color_arguments : RGB '(' integer_argument ',' integer_argument ',' integer_argument ')'
| HEX '(' string_argument ')'
| NAME '(' string_argument ')'
point_arguments : X '(' integer_argument ')'
| Y '(' integer_argument ')'
point_arguments : X '(' integer_argument ')' ':' point_arguments
| Y '(' integer_argument ')' ':' point_arguments
line_arguments : P1 '(' point_argument ')'
| P2 '(' point_argument ')'
| FILL_COLOR '(' color_argument ')'
| WIDTH '(' integer_argument ')'
line_arguments : P1 '(' point_argument ')' ':' line_arguments
| P2 '(' point_argument ')' ':' line_arguments
| FILL_COLOR '(' color_argument ')' ':' line_arguments
| WIDTH '(' integer_argument ')' ':' line_arguments
circle_arguments : C '(' point_argument ')'
| R '(' integer_argument ')'
| BORDER_COLOR '(' color_argument ')'
| BORDER_WIDTH '(' integer_argument ')'
| FILL_COLOR '(' color_argument ')'
circle_arguments : C '(' point_argument ')' ':' circle_arguments
| R '(' integer_argument ')' ':' circle_arguments
| BORDER_COLOR '(' color_argument ')' ':' circle_arguments
| BORDER_WIDTH '(' integer_argument ')' ':' circle_arguments
| FILL_COLOR '(' color_argument ')' ':' circle_arguments
rect_arguments : O '(' point_argument ')'
| WIDTH '(' integer_argument ')'
| HEIGHT '(' integer_argument ')'
| RX '(' integer_argument ')'
| RY '(' integer_argument ')'
| BORDER_COLOR '(' color_argument ')'
| BORDER_WIDTH '(' integer_argument ')'
| FILL_COLOR '(' color_argument ')'
rect_arguments : O '(' point_argument ')' ':' rect_arguments
| WIDTH '(' integer_argument ')' ':' rect_arguments
| HEIGHT '(' integer_argument ')' ':' rect_arguments
| RX '(' integer_argument ')' ':' rect_arguments
| RY '(' integer_argument ')' ':' rect_arguments
| BORDER_COLOR '(' color_argument ')' ':' rect_arguments
| BORDER_WIDTH '(' integer_argument ')' ':' rect_arguments
| FILL_COLOR '(' color_argument ')' ':' rect_arguments
ellipse_arguments : C '(' point_argument ')'
| RY '(' integer_argument ')'
| RX '(' integer_argument ')'
| BORDER_COLOR '(' color_argument ')'
| BORDER_WIDTH '(' integer_argument ')'
| FILL_COLOR '(' color_argument ')'
ellipse_arguments : C '(' point_argument ')' ':' ellipse_arguments
| RY '(' integer_argument ')' ':' ellipse_arguments
| RX '(' integer_argument ')' ':' ellipse_arguments
| BORDER_COLOR '(' color_argument ')' ':' ellipse_arguments
| BORDER_WIDTH '(' integer_argument ')' ':' ellipse_arguments
| FILL_COLOR '(' color_argument ')' ':' ellipse_arguments
customshape_arguments : P '(' point_argument ')'
| BORDER_COLOR '(' color_argument ')'
| BORDER_WIDTH '(' integer_argument ')'
| CLOSE '(' boolean_argument ')'
| FILL_COLOR '(' color_argument ')'
customshape_arguments : P '(' point_argument ')' ':' customshape_arguments
| BORDER_COLOR '(' color_argument ')' ':' customshape_arguments
| BORDER_WIDTH '(' integer_argument ')' ':' customshape_arguments
| CLOSE '(' boolean_argument ')' ':' customshape_arguments
| FILL_COLOR '(' color_argument ')' ':' customshape_arguments
text_arguments : CONTENT '(' string_argument ')'
| P '(' point_argument ')'
| FONT '(' string_argument ')'
| SIZE '(' integer_argument ')'
| FILL_COLOR '(' color_argument ')'
text_arguments : CONTENT '(' string_argument ')' ':' text_arguments
| P '(' point_argument ')' ':' text_arguments
| FONT '(' string_argument ')' ':' text_arguments
| SIZE '(' integer_argument ')' ':' text_arguments
| FILL_COLOR '(' color_argument ')' ':' text_arguments
color : COLOR ':' color_arguments
point : POINT ':' point_arguments
line : LINE ':' line_arguments
circle : CIRCLE ':' circle_arguments
rect : RECT ':' rect_arguments
ellipse : ELLIPSE ':' ellipse_arguments
customshape : CUSTOMSHAPE ':' customshape_arguments
text : TEXT ':' text_arguments
shape : line
| circle
| rect
| ellipse
| customshape
| text
rotate_arguments : ANGLE '(' integer_argument ')'
| C '(' point_argument ')'
rotate_arguments : ANGLE '(' integer_argument ')' ':' rotate_arguments
| C '(' point_argument ')' ':' rotate_arguments
scale_arguments : SX '(' integer_argument ')'
| SY '(' integer_argument ')'
scale_arguments : SX '(' integer_argument ')' ':' scale_arguments
| SY '(' integer_argument ')' ':' scale_arguments
translate_argument : P '(' point_argument ')'
hide_argument : H '(' boolean_argument ')'
transformation : ROTATE ':' rotate_arguments
| SCALE ':' scale_arguments
| TRANSLATE ':' translate_argument
| HIDE ':' hide_argument
control : IF condition '{' program '}'
control : WHILE condition '{' program '}'
control : FOR integer_argument ':' integer_argument '{' program '}'
apply_body : IDENTIFIER ';'
apply_body : IDENTIFIER ';' apply_body
control : APPLY IDENTIFIER '{' apply_body '}'
condition : integer_argument COND_OP integer_argument
| string_argument COND_OP string_argument
| boolean_argument
assignation : IDENTIFIER '=' shape ';'
| IDENTIFIER '=' point ';'
| IDENTIFIER '=' color ';'
| IDENTIFIER '=' transformation ';'
| IDENTIFIER '=' integer_argument ';'
| IDENTIFIER '=' string_argument ';'
| IDENTIFIER '=' point_argument ';'
| IDENTIFIER '=' color_argument ';'
| IDENTIFIER '=' boolean_argument ';'