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

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