source: applications/trunk/LFC/lfc.ag @ 3809

Last change on this file since 3809 was 3809, checked in by orlov, 12 years ago
  • Property svn:eol-style set to native
File size: 4.6 KB
Line 
1
2Nullable nonterminals:
3
4  (arg_list | arg_list_rest | concept_list_rest | equation_rest | exp_concat |
5  exp_concat_or_where | exp_var_or_func | pat_concat | pattern_list_rest | program_rest |
6  varassign_rest | variable_dec_rest | variable_list_rest)
7
8
9The starters of nonterminals:
10
11program ->
12  (DEC)
13program_rest ->
14  (DEC)
15function_dec ->
16  (DEC)
17var_dec_and_func_def ->
18  (DEF | VAR)
19variable_dec ->
20  (VAR)
21vars_decl ->
22  (IDENTIFIER)
23variable_dec_rest ->
24  (IDENTIFIER)
25variable_list ->
26  (IDENTIFIER)
27variable_list_rest ->
28  (COMMA)
29definition ->
30  (DEF)
31equation ->
32  (IDENTIFIER)
33equation_rest ->
34  (IDENTIFIER)
35pattern_list ->
36  (IDENTIFIER | STRING)
37pattern ->
38  (IDENTIFIER | STRING)
39pat_concat ->
40  (CONCAT)
41pattern_list_rest ->
42  (COMMA)
43function_type ->
44  (IDENTIFIER)
45concept_list_rest ->
46  (ASTERISK)
47concept_name ->
48  (IDENTIFIER)
49funname ->
50  (IDENTIFIER)
51variable ->
52  (IDENTIFIER)
53exp ->
54  (IDENTIFIER | IF | LPAR | STRING | UNDEFINED)
55exp_with_where ->
56  (IDENTIFIER | IF | LPAR | STRING | UNDEFINED)
57exp_var_or_func ->
58  (LPAR)
59arg_list ->
60  (IDENTIFIER | IF | LPAR | STRING | UNDEFINED)
61arg_list_rest ->
62  (COMMA)
63exp_concat ->
64  (CONCAT)
65exp_concat_or_where ->
66  (CONCAT | WHERE)
67varassign_list ->
68  (IDENTIFIER)
69varassign_rest ->
70  (COMMA)
71
72
73The followers of nullable nonterminals:
74
75program_rest ->
76  ($END)
77variable_dec_rest ->
78  (DEF)
79variable_list_rest ->
80  (COLON)
81equation_rest ->
82  ($END | DEC)
83pat_concat ->
84  (COMMA | RPAR)
85pattern_list_rest ->
86  (RPAR)
87concept_list_rest ->
88  (TO)
89exp_var_or_func ->
90  (COMMA | CONCAT | ELSE | RPAR | SC |
91  THEN | WHERE)
92arg_list ->
93  (RPAR)
94arg_list_rest ->
95  (RPAR)
96exp_concat ->
97  (COMMA | ELSE | RPAR | SC | THEN)
98exp_concat_or_where ->
99  (ELSE | RPAR | SC | THEN)
100varassign_rest ->
101  (ELSE | RPAR | SC | THEN)
102
103
104*** Annotated grammar ***
105
106program
107: (DEC)
108     function_dec var_dec_and_func_def #program_rest
109;
110
111#program_rest
112: ($END)
113     /* empty */
114| (DEC)
115     program
116;
117
118function_dec
119: (DEC)
120     DEC funname COLON function_type SC
121;
122
123var_dec_and_func_def
124: (VAR)
125     variable_dec definition
126| (DEF)
127     definition
128;
129
130variable_dec
131: (VAR)
132     VAR vars_decl #variable_dec_rest
133;
134
135vars_decl
136: (IDENTIFIER)
137     variable_list COLON concept_name SC
138;
139
140#variable_dec_rest
141: (DEF)
142     /* empty */
143| (IDENTIFIER)
144     vars_decl #variable_dec_rest
145;
146
147variable_list
148: (IDENTIFIER)
149     variable #variable_list_rest
150;
151
152#variable_list_rest
153: (COLON)
154     /* empty */
155| (COMMA)
156     COMMA variable #variable_list_rest
157;
158
159definition
160: (DEF)
161     DEF equation #equation_rest
162;
163
164equation
165: (IDENTIFIER)
166     funname LPAR pattern_list RPAR EQ exp_with_where SC
167;
168
169#equation_rest
170: ($END | DEC)
171     /* empty */
172| (IDENTIFIER)
173     equation #equation_rest
174;
175
176pattern_list
177: (IDENTIFIER | STRING)
178     pattern #pattern_list_rest
179;
180
181pattern
182: (STRING)
183     STRING #pat_concat
184| (IDENTIFIER)
185     variable #pat_concat
186;
187
188#pat_concat
189: (COMMA | RPAR)
190     /* empty */
191| (CONCAT)
192     CONCAT pattern
193;
194
195#pattern_list_rest
196: (RPAR)
197     /* empty */
198| (COMMA)
199     COMMA pattern #pattern_list_rest
200;
201
202function_type
203: (IDENTIFIER)
204     concept_name #concept_list_rest TO concept_name
205;
206
207#concept_list_rest
208: (TO)
209     /* empty */
210| (ASTERISK)
211     ASTERISK concept_name #concept_list_rest
212;
213
214concept_name
215: (IDENTIFIER)
216     IDENTIFIER
217;
218
219funname
220: (IDENTIFIER)
221     IDENTIFIER
222;
223
224variable
225: (IDENTIFIER)
226     IDENTIFIER
227;
228
229exp
230: (STRING)
231     STRING #exp_concat
232| (UNDEFINED)
233     UNDEFINED #exp_concat
234| (IDENTIFIER)
235     IDENTIFIER #exp_var_or_func #exp_concat
236| (LPAR)
237     LPAR exp_with_where RPAR #exp_concat
238| (IF)
239     IF exp THEN exp ELSE exp
240;
241
242exp_with_where
243: (STRING)
244     STRING #exp_concat_or_where
245| (UNDEFINED)
246     UNDEFINED #exp_concat_or_where
247| (IDENTIFIER)
248     IDENTIFIER #exp_var_or_func #exp_concat_or_where
249| (LPAR)
250     LPAR exp_with_where RPAR #exp_concat_or_where
251| (IF)
252     IF exp_with_where THEN exp_with_where ELSE exp_with_where
253;
254
255#exp_var_or_func
256: (COMMA | CONCAT | ELSE | RPAR | SC |
257  THEN | WHERE)
258     /* empty */
259| (LPAR)
260     LPAR #arg_list RPAR
261;
262
263#arg_list
264: (RPAR)
265     /* empty */
266| (IDENTIFIER | IF | LPAR | STRING | UNDEFINED)
267     exp #arg_list_rest
268;
269
270#arg_list_rest
271: (RPAR)
272     /* empty */
273| (COMMA)
274     COMMA exp #arg_list_rest
275;
276
277#exp_concat
278: (COMMA | ELSE | RPAR | SC | THEN)
279     /* empty */
280| (CONCAT)
281     CONCAT exp
282;
283
284#exp_concat_or_where
285: (ELSE | RPAR | SC | THEN)
286     /* empty */
287| (CONCAT)
288     CONCAT exp_with_where
289| (WHERE)
290     WHERE varassign_list
291;
292
293varassign_list
294: (IDENTIFIER)
295     variable EQ exp #varassign_rest
296;
297
298#varassign_rest
299: (ELSE | RPAR | SC | THEN)
300     /* empty */
301| (COMMA)
302     COMMA varassign_list
303;
304
Note: See TracBrowser for help on using the repository browser.