source: devel-tools/trunk/LL1GrammarAnalyzers/RfpLLGr.f @ 4103

Last change on this file since 4103 was 3279, checked in by yura, 13 years ago
  • Generalization of $trap/$with: after $with may be any sentence (not only pattern_alt).
File size: 8.7 KB
Line 
1
2Nullable nonterminals:
3
4  (const_bindings | const_bindings_tail | decls | directives | exp | 
5  implem | imports | interf | iter | let | 
6  module_name | names | native_sentences | path | path_tail | 
7  paths | pattern | pattern_alts | rest | sentence | 
8  sentences | source)
9
10
11The starters of nonterminals:
12
13program ->
14  (IMPLEMENTATION | INTERFACE)
15implem ->
16  (CONST | FUNC_DECL | MODULE | NATIVE | OBJ_DECL | 
17  PUBLIC | TRACE_ALL | USE | WORD)
18interf ->
19  (CONST | FUNC_DECL | MODULE | OBJ_DECL | PUBLIC)
20module_name ->
21  (MODULE)
22imports ->
23  (USE)
24directives ->
25  (CONST | FUNC_DECL | NATIVE | OBJ_DECL | PUBLIC | 
26  TRACE_ALL | WORD)
27directive ->
28  (CONST | FUNC_DECL | NATIVE | OBJ_DECL | PUBLIC | 
29  TRACE_ALL | WORD)
30decls ->
31  (CONST | FUNC_DECL | OBJ_DECL | PUBLIC)
32decl ->
33  (CONST | FUNC_DECL | OBJ_DECL | PUBLIC)
34private_decl ->
35  (CONST | FUNC_DECL | OBJ_DECL)
36obj_decl ->
37  (OBJ_DECL)
38const_decl ->
39  (CONST)
40const_bindings ->
41  (WORD)
42const_bindings_tail ->
43  (COMMA)
44const_binding ->
45  (WORD)
46func_decl ->
47  (FUNC_DECL)
48native ->
49  (NATIVE)
50native_block ->
51  (LCURL | WORD)
52native_sentences ->
53  (WORD)
54native_sentence ->
55  (WORD)
56trace_all ->
57  (TRACE_ALL)
58func_def ->
59  (WORD)
60sentence ->
61  (CHAR | COMMA | CUT | EQL | ERROR | 
62  FAIL | FENCE | LANGU | LCURL | LPAR | 
63  MATCH_DIR | NOT | NUMB | REF | TRAP | 
64  VAR | WORD)
65path ->
66  (CHAR | COL | COL_CURL | COMMA | CUT | 
67  EQL | ERROR | FAIL | FENCE | ITER | 
68  LANGU | LCURL | LET | LPAR | NOT | 
69  NUMB | REF | TRAP | VAR | WORD)
70path_tail ->
71  (COL | COMMA | CUT | EQL | ERROR | 
72  FAIL | FENCE | ITER | LET | NOT | 
73  TRAP)
74iter ->
75  (ITER)
76let ->
77  (LET)
78rest ->
79  (COMMA | CUT | EQL | ERROR | FAIL | 
80  FENCE | NOT | TRAP)
81source ->
82  (CHAR | COL_CURL | LANGU | LCURL | LPAR | 
83  NUMB | REF | VAR | WORD)
84pattern_alts ->
85  (COL_CURL)
86pattern ->
87  (CHAR | LANGU | LPAR | MATCH_DIR | NUMB | 
88  REF | VAR | WORD)
89pattern_alt ->
90  (LCURL)
91sentences ->
92  (CHAR | COMMA | CUT | EQL | ERROR | 
93  FAIL | FENCE | LANGU | LCURL | LPAR | 
94  MATCH_DIR | NOT | NUMB | REF | SC | 
95  TRAP | VAR | WORD)
96alt ->
97  (LCURL)
98paths ->
99  (CHAR | COL | COL_CURL | COMMA | CUT | 
100  EQL | ERROR | FAIL | FENCE | ITER | 
101  LANGU | LCURL | LET | LPAR | NOT | 
102  NUMB | REF | SC | TRAP | VAR | 
103  WORD)
104exp ->
105  (CHAR | LANGU | LPAR | NUMB | REF | 
106  VAR | WORD)
107exp_head ->
108  (CHAR | LANGU | LPAR | NUMB | REF | 
109  VAR | WORD)
110static_symbol ->
111  (CHAR | NUMB | WORD)
112names ->
113  (WORD)
114name ->
115  (WORD)
116
117
118The followers of nullable nonterminals:
119
120implem ->
121  ($END)
122interf ->
123  ($END)
124module_name ->
125  ($END | CONST | FUNC_DECL | NATIVE | OBJ_DECL | 
126  PUBLIC | TRACE_ALL | USE | WORD)
127imports ->
128  ($END | CONST | FUNC_DECL | NATIVE | OBJ_DECL | 
129  PUBLIC | TRACE_ALL | WORD)
130directives ->
131  ($END)
132decls ->
133  ($END)
134const_bindings ->
135  (SC)
136const_bindings_tail ->
137  (SC)
138native_sentences ->
139  (RCURL)
140sentence ->
141  (SC | WITH)
142path ->
143  (SC | WITH)
144path_tail ->
145  (SC | WITH)
146iter ->
147  (COMMA | CUT | EQL | ERROR | FAIL | 
148  FENCE | LET | NOT | SC | TRAP | 
149  WITH)
150let ->
151  (COMMA | CUT | EQL | ERROR | FAIL | 
152  FENCE | NOT | SC | TRAP | WITH)
153rest ->
154  (SC | WITH)
155source ->
156  (COL | COMMA | CUT | EQL | ERROR | 
157  FAIL | FENCE | ITER | LET | NOT | 
158  SC | TRAP | WITH)
159pattern_alts ->
160  (COL | COMMA | CUT | EQL | ERROR | 
161  FAIL | FENCE | ITER | LET | NOT | 
162  SC | TRAP | WITH)
163pattern ->
164  (COMMA | CUT | EQL | ERROR | FAIL | 
165  FENCE | NOT | SC | TRAP | WITH)
166sentences ->
167  (RCURL)
168paths ->
169  (RCURL)
170exp ->
171  (COL | COL_CURL | COMMA | CUT | EQL | 
172  ERROR | FAIL | FENCE | ITER | LET | 
173  NOT | RANGU | RPAR | SC | TRAP | 
174  WITH)
175names ->
176  (SC)
177
178
179*** Annotated grammar ***
180
181program
182: (IMPLEMENTATION)
183     IMPLEMENTATION #implem
184| (INTERFACE)
185     INTERFACE #interf
186;
187
188#implem
189: ($END | CONST | FUNC_DECL | MODULE | NATIVE | 
190  OBJ_DECL | PUBLIC | TRACE_ALL | USE | WORD)
191     #module_name #imports #directives
192;
193
194#interf
195: ($END | CONST | FUNC_DECL | MODULE | OBJ_DECL | 
196  PUBLIC)
197     #module_name #decls
198;
199
200#module_name
201: ($END | CONST | FUNC_DECL | NATIVE | OBJ_DECL | 
202  PUBLIC | TRACE_ALL | USE | WORD)
203     /* empty */
204| (MODULE)
205     MODULE name SC
206;
207
208#imports
209: (USE)
210     USE #names SC #imports
211| ($END | CONST | FUNC_DECL | NATIVE | OBJ_DECL | 
212  PUBLIC | TRACE_ALL | WORD)
213     /* empty */
214;
215
216#directives
217: (CONST | FUNC_DECL | NATIVE | OBJ_DECL | PUBLIC | 
218  TRACE_ALL | WORD)
219     directive SC #directives
220| ($END)
221     /* empty */
222;
223
224directive
225: (CONST | FUNC_DECL | OBJ_DECL | PUBLIC)
226     decl
227| (WORD)
228     func_def
229| (NATIVE)
230     native
231| (TRACE_ALL)
232     trace_all
233;
234
235#decls
236: (CONST | FUNC_DECL | OBJ_DECL | PUBLIC)
237     decl SC #decls
238| ($END)
239     /* empty */
240;
241
242decl
243: (PUBLIC)
244     PUBLIC private_decl
245| (CONST | FUNC_DECL | OBJ_DECL)
246     private_decl
247;
248
249private_decl
250: (OBJ_DECL)
251     obj_decl
252| (CONST)
253     const_decl
254| (FUNC_DECL)
255     func_decl
256;
257
258obj_decl
259: (OBJ_DECL)
260     OBJ_DECL #names
261;
262
263const_decl
264: (CONST)
265     CONST #const_bindings
266;
267
268#const_bindings
269: (WORD)
270     const_binding #const_bindings_tail
271| (SC)
272     /* empty */
273;
274
275#const_bindings_tail
276: (COMMA)
277     COMMA const_binding #const_bindings_tail
278| (SC)
279     /* empty */
280;
281
282const_binding
283: (WORD)
284     name EQL #exp 
285;
286
287func_decl
288: (FUNC_DECL)
289     FUNC_DECL name #exp EQL #exp 
290;
291
292native
293: (NATIVE)
294     NATIVE native_block
295;
296
297native_block
298: (LCURL)
299     LCURL #native_sentences RCURL
300| (WORD)
301     native_sentence
302;
303
304#native_sentences
305: (WORD)
306     native_sentence SC #native_sentences
307| (RCURL)
308     /* empty */
309;
310
311native_sentence
312: (WORD)
313     name EQL name
314;
315
316trace_all
317: (TRACE_ALL)
318     TRACE_ALL
319;
320
321func_def
322: (WORD)
323     name #sentence
324;
325
326#sentence
327: (LCURL)
328     pattern_alt #pattern_alts #path_tail
329| (CHAR | COMMA | CUT | EQL | ERROR | 
330  FAIL | FENCE | LANGU | LPAR | MATCH_DIR | 
331  NOT | NUMB | REF | SC | TRAP | 
332  VAR | WITH | WORD)
333     #pattern #rest
334;
335
336#path
337: (CHAR | COL | COL_CURL | COMMA | CUT | 
338  EQL | ERROR | FAIL | FENCE | ITER | 
339  LANGU | LCURL | LET | LPAR | NOT | 
340  NUMB | REF | SC | TRAP | VAR | 
341  WITH | WORD)
342     #source #path_tail
343;
344
345#path_tail
346: (COL)
347     COL #sentence
348| (COMMA | CUT | EQL | ERROR | FAIL | 
349  FENCE | ITER | LET | NOT | SC | 
350  TRAP | WITH)
351     #iter #let #rest
352;
353
354#iter
355: (ITER)
356     ITER #source
357| (COMMA | CUT | EQL | ERROR | FAIL | 
358  FENCE | LET | NOT | SC | TRAP | 
359  WITH)
360     /* empty */
361;
362
363#let
364: (LET)
365     LET #exp 
366| (COMMA | CUT | EQL | ERROR | FAIL | 
367  FENCE | NOT | SC | TRAP | WITH)
368     /* empty */
369;
370
371#rest
372: (COMMA)
373     COMMA #path
374| (FENCE)
375     FENCE #path
376| (CUT)
377     CUT #path
378| (ERROR)
379     ERROR #path
380| (EQL)
381     EQL #path
382| (NOT)
383     NOT #source #rest
384| (FAIL)
385     FAIL
386| (TRAP)
387     TRAP #path WITH #sentence
388| (SC | WITH)
389     /* empty */
390;
391
392#source
393: (LCURL)
394     alt #pattern_alts
395| (CHAR | COL | COL_CURL | COMMA | CUT | 
396  EQL | ERROR | FAIL | FENCE | ITER | 
397  LANGU | LET | LPAR | NOT | NUMB | 
398  REF | SC | TRAP | VAR | WITH | 
399  WORD)
400     #exp #pattern_alts
401;
402
403#pattern_alts
404: (COL_CURL)
405     COL_CURL pattern_alt #pattern_alts
406| (COL | COMMA | CUT | EQL | ERROR | 
407  FAIL | FENCE | ITER | LET | NOT | 
408  SC | TRAP | WITH)
409     /* empty */
410;
411
412#pattern
413: (MATCH_DIR)
414     MATCH_DIR #exp 
415| (CHAR | COMMA | CUT | EQL | ERROR | 
416  FAIL | FENCE | LANGU | LPAR | NOT | 
417  NUMB | REF | SC | TRAP | VAR | 
418  WITH | WORD)
419     #exp 
420;
421
422pattern_alt
423: (LCURL)
424     LCURL #sentences RCURL
425;
426
427#sentences
428: (CHAR | COMMA | CUT | EQL | ERROR | 
429  FAIL | FENCE | LANGU | LCURL | LPAR | 
430  MATCH_DIR | NOT | NUMB | REF | SC | 
431  TRAP | VAR | WORD)
432     #sentence SC #sentences
433| (RCURL)
434     /* empty */
435;
436
437alt
438: (LCURL)
439     LCURL #paths RCURL
440;
441
442#paths
443: (CHAR | COL | COL_CURL | COMMA | CUT | 
444  EQL | ERROR | FAIL | FENCE | ITER | 
445  LANGU | LCURL | LET | LPAR | NOT | 
446  NUMB | REF | SC | TRAP | VAR | 
447  WORD)
448     #path SC #paths
449| (RCURL)
450     /* empty */
451;
452
453#exp
454: (CHAR | LANGU | LPAR | NUMB | REF | 
455  VAR | WORD)
456     exp_head #exp 
457| (COL | COL_CURL | COMMA | CUT | EQL | 
458  ERROR | FAIL | FENCE | ITER | LET | 
459  NOT | RANGU | RPAR | SC | TRAP | 
460  WITH)
461     /* empty */
462;
463
464exp_head
465: (REF)
466     REF name
467| (CHAR | NUMB | WORD)
468     static_symbol
469| (LPAR)
470     LPAR #exp RPAR
471| (VAR)
472     VAR
473| (LANGU)
474     LANGU name #exp RANGU
475;
476
477static_symbol
478: (CHAR)
479     CHAR 
480| (WORD)
481     WORD
482| (NUMB)
483     NUMB
484;
485
486#names
487: (WORD)
488     name #names
489| (SC)
490     /* empty */
491;
492
493name
494: (WORD)
495     WORD
496;
497
Note: See TracBrowser for help on using the repository browser.