1# -*- text -*-
2# Parsing Expression Grammar 'TEMPLATE'.
3# Generated for unknown, from file 'TEST'
4
5#
6# Grammar Start Expression
7#
8
9<<MAIN>>:
10         call              sym_Expression
11         halt
12
13#
14# value Symbol 'AddOp'
15#
16
17sym_AddOp:
18# /
19#     '-'
20#     '+'
21
22         symbol_restore    AddOp
23  found! jump              found_7
24         loc_push
25
26         call              choice_5
27
28   fail! value_clear
29     ok! value_leaf        AddOp
30         symbol_save       AddOp
31         error_nonterminal AddOp
32         loc_pop_discard
33
34found_7:
35     ok! ast_value_push
36         return
37
38choice_5:
39# /
40#     '-'
41#     '+'
42
43         error_clear
44
45         loc_push
46         error_push
47
48         input_next        "t -"
49     ok! test_char         "-"
50
51         error_pop_merge
52     ok! jump              oknoast_4
53
54         loc_pop_rewind
55         loc_push
56         error_push
57
58         input_next        "t +"
59     ok! test_char         "+"
60
61         error_pop_merge
62     ok! jump              oknoast_4
63
64         loc_pop_rewind
65         status_fail
66         return
67
68oknoast_4:
69         loc_pop_discard
70         return
71#
72# value Symbol 'Digit'
73#
74
75sym_Digit:
76# /
77#     '0'
78#     '1'
79#     '2'
80#     '3'
81#     '4'
82#     '5'
83#     '6'
84#     '7'
85#     '8'
86#     '9'
87
88         symbol_restore    Digit
89  found! jump              found_22
90         loc_push
91
92         call              choice_20
93
94   fail! value_clear
95     ok! value_leaf        Digit
96         symbol_save       Digit
97         error_nonterminal Digit
98         loc_pop_discard
99
100found_22:
101     ok! ast_value_push
102         return
103
104choice_20:
105# /
106#     '0'
107#     '1'
108#     '2'
109#     '3'
110#     '4'
111#     '5'
112#     '6'
113#     '7'
114#     '8'
115#     '9'
116
117         error_clear
118
119         loc_push
120         error_push
121
122         input_next        "t 0"
123     ok! test_char         "0"
124
125         error_pop_merge
126     ok! jump              oknoast_19
127
128         loc_pop_rewind
129         loc_push
130         error_push
131
132         input_next        "t 1"
133     ok! test_char         "1"
134
135         error_pop_merge
136     ok! jump              oknoast_19
137
138         loc_pop_rewind
139         loc_push
140         error_push
141
142         input_next        "t 2"
143     ok! test_char         "2"
144
145         error_pop_merge
146     ok! jump              oknoast_19
147
148         loc_pop_rewind
149         loc_push
150         error_push
151
152         input_next        "t 3"
153     ok! test_char         "3"
154
155         error_pop_merge
156     ok! jump              oknoast_19
157
158         loc_pop_rewind
159         loc_push
160         error_push
161
162         input_next        "t 4"
163     ok! test_char         "4"
164
165         error_pop_merge
166     ok! jump              oknoast_19
167
168         loc_pop_rewind
169         loc_push
170         error_push
171
172         input_next        "t 5"
173     ok! test_char         "5"
174
175         error_pop_merge
176     ok! jump              oknoast_19
177
178         loc_pop_rewind
179         loc_push
180         error_push
181
182         input_next        "t 6"
183     ok! test_char         "6"
184
185         error_pop_merge
186     ok! jump              oknoast_19
187
188         loc_pop_rewind
189         loc_push
190         error_push
191
192         input_next        "t 7"
193     ok! test_char         "7"
194
195         error_pop_merge
196     ok! jump              oknoast_19
197
198         loc_pop_rewind
199         loc_push
200         error_push
201
202         input_next        "t 8"
203     ok! test_char         "8"
204
205         error_pop_merge
206     ok! jump              oknoast_19
207
208         loc_pop_rewind
209         loc_push
210         error_push
211
212         input_next        "t 9"
213     ok! test_char         "9"
214
215         error_pop_merge
216     ok! jump              oknoast_19
217
218         loc_pop_rewind
219         status_fail
220         return
221
222oknoast_19:
223         loc_pop_discard
224         return
225#
226# value Symbol 'Expression'
227#
228
229sym_Expression:
230# /
231#     x
232#         '\('
233#         (Expression)
234#         '\)'
235#     x
236#         (Factor)
237#         *
238#             x
239#                 (MulOp)
240#                 (Factor)
241
242         symbol_restore    Expression
243  found! jump              found_46
244         loc_push
245         ast_push
246
247         call              choice_44
248
249   fail! value_clear
250     ok! value_reduce      Expression
251         symbol_save       Expression
252         error_nonterminal Expression
253         ast_pop_rewind
254         loc_pop_discard
255
256found_46:
257     ok! ast_value_push
258         return
259
260choice_44:
261# /
262#     x
263#         '\('
264#         (Expression)
265#         '\)'
266#     x
267#         (Factor)
268#         *
269#             x
270#                 (MulOp)
271#                 (Factor)
272
273         error_clear
274
275         ast_push
276         loc_push
277         error_push
278
279         call              sequence_27
280
281         error_pop_merge
282     ok! jump              ok_43
283
284         ast_pop_rewind
285         loc_pop_rewind
286         ast_push
287         loc_push
288         error_push
289
290         call              sequence_40
291
292         error_pop_merge
293     ok! jump              ok_43
294
295         ast_pop_rewind
296         loc_pop_rewind
297         status_fail
298         return
299
300ok_43:
301         ast_pop_discard
302         loc_pop_discard
303         return
304
305sequence_27:
306# x
307#     '\('
308#     (Expression)
309#     '\)'
310
311         loc_push
312         error_clear
313
314         error_push
315
316         input_next        "t ("
317     ok! test_char         "("
318
319         error_pop_merge
320   fail! jump              failednoast_29
321         ast_push
322         error_push
323
324         call              sym_Expression
325
326         error_pop_merge
327   fail! jump              failed_28
328         error_push
329
330         input_next        "t )"
331     ok! test_char         ")"
332
333         error_pop_merge
334   fail! jump              failed_28
335
336         ast_pop_discard
337         loc_pop_discard
338         return
339
340failed_28:
341         ast_pop_rewind
342
343failednoast_29:
344         loc_pop_rewind
345         return
346
347sequence_40:
348# x
349#     (Factor)
350#     *
351#         x
352#             (MulOp)
353#             (Factor)
354
355         ast_push
356         loc_push
357         error_clear
358
359         error_push
360
361         call              sym_Factor
362
363         error_pop_merge
364   fail! jump              failed_41
365         error_push
366
367         call              kleene_37
368
369         error_pop_merge
370   fail! jump              failed_41
371
372         ast_pop_discard
373         loc_pop_discard
374         return
375
376failed_41:
377         ast_pop_rewind
378         loc_pop_rewind
379         return
380
381kleene_37:
382# *
383#     x
384#         (MulOp)
385#         (Factor)
386
387         loc_push
388         error_push
389
390         call              sequence_34
391
392         error_pop_merge
393   fail! jump              failed_38
394         loc_pop_discard
395         jump              kleene_37
396
397failed_38:
398         loc_pop_rewind
399         status_ok
400         return
401
402sequence_34:
403# x
404#     (MulOp)
405#     (Factor)
406
407         ast_push
408         loc_push
409         error_clear
410
411         error_push
412
413         call              sym_MulOp
414
415         error_pop_merge
416   fail! jump              failed_35
417         error_push
418
419         call              sym_Factor
420
421         error_pop_merge
422   fail! jump              failed_35
423
424         ast_pop_discard
425         loc_pop_discard
426         return
427
428failed_35:
429         ast_pop_rewind
430         loc_pop_rewind
431         return
432#
433# value Symbol 'Factor'
434#
435
436sym_Factor:
437# x
438#     (Term)
439#     *
440#         x
441#             (AddOp)
442#             (Term)
443
444         symbol_restore    Factor
445  found! jump              found_60
446         loc_push
447         ast_push
448
449         call              sequence_57
450
451   fail! value_clear
452     ok! value_reduce      Factor
453         symbol_save       Factor
454         error_nonterminal Factor
455         ast_pop_rewind
456         loc_pop_discard
457
458found_60:
459     ok! ast_value_push
460         return
461
462sequence_57:
463# x
464#     (Term)
465#     *
466#         x
467#             (AddOp)
468#             (Term)
469
470         ast_push
471         loc_push
472         error_clear
473
474         error_push
475
476         call              sym_Term
477
478         error_pop_merge
479   fail! jump              failed_58
480         error_push
481
482         call              kleene_54
483
484         error_pop_merge
485   fail! jump              failed_58
486
487         ast_pop_discard
488         loc_pop_discard
489         return
490
491failed_58:
492         ast_pop_rewind
493         loc_pop_rewind
494         return
495
496kleene_54:
497# *
498#     x
499#         (AddOp)
500#         (Term)
501
502         loc_push
503         error_push
504
505         call              sequence_51
506
507         error_pop_merge
508   fail! jump              failed_55
509         loc_pop_discard
510         jump              kleene_54
511
512failed_55:
513         loc_pop_rewind
514         status_ok
515         return
516
517sequence_51:
518# x
519#     (AddOp)
520#     (Term)
521
522         ast_push
523         loc_push
524         error_clear
525
526         error_push
527
528         call              sym_AddOp
529
530         error_pop_merge
531   fail! jump              failed_52
532         error_push
533
534         call              sym_Term
535
536         error_pop_merge
537   fail! jump              failed_52
538
539         ast_pop_discard
540         loc_pop_discard
541         return
542
543failed_52:
544         ast_pop_rewind
545         loc_pop_rewind
546         return
547#
548# value Symbol 'MulOp'
549#
550
551sym_MulOp:
552# /
553#     '*'
554#     '/'
555
556         symbol_restore    MulOp
557  found! jump              found_67
558         loc_push
559
560         call              choice_65
561
562   fail! value_clear
563     ok! value_leaf        MulOp
564         symbol_save       MulOp
565         error_nonterminal MulOp
566         loc_pop_discard
567
568found_67:
569     ok! ast_value_push
570         return
571
572choice_65:
573# /
574#     '*'
575#     '/'
576
577         error_clear
578
579         loc_push
580         error_push
581
582         input_next        "t *"
583     ok! test_char         "*"
584
585         error_pop_merge
586     ok! jump              oknoast_64
587
588         loc_pop_rewind
589         loc_push
590         error_push
591
592         input_next        "t /"
593     ok! test_char         "/"
594
595         error_pop_merge
596     ok! jump              oknoast_64
597
598         loc_pop_rewind
599         status_fail
600         return
601
602oknoast_64:
603         loc_pop_discard
604         return
605#
606# value Symbol 'Number'
607#
608
609sym_Number:
610# x
611#     ?
612#         (Sign)
613#     +
614#         (Digit)
615
616         symbol_restore    Number
617  found! jump              found_80
618         loc_push
619         ast_push
620
621         call              sequence_77
622
623   fail! value_clear
624     ok! value_reduce      Number
625         symbol_save       Number
626         error_nonterminal Number
627         ast_pop_rewind
628         loc_pop_discard
629
630found_80:
631     ok! ast_value_push
632         return
633
634sequence_77:
635# x
636#     ?
637#         (Sign)
638#     +
639#         (Digit)
640
641         ast_push
642         loc_push
643         error_clear
644
645         error_push
646
647         call              optional_70
648
649         error_pop_merge
650   fail! jump              failed_78
651         error_push
652
653         call              poskleene_73
654
655         error_pop_merge
656   fail! jump              failed_78
657
658         ast_pop_discard
659         loc_pop_discard
660         return
661
662failed_78:
663         ast_pop_rewind
664         loc_pop_rewind
665         return
666
667optional_70:
668# ?
669#     (Sign)
670
671         loc_push
672         error_push
673
674         call              sym_Sign
675
676         error_pop_merge
677   fail! loc_pop_rewind
678     ok! loc_pop_discard
679         status_ok
680         return
681
682poskleene_73:
683# +
684#     (Digit)
685
686         loc_push
687
688         call              sym_Digit
689
690   fail! jump              failed_74
691
692loop_75:
693         loc_pop_discard
694         loc_push
695         error_push
696
697         call              sym_Digit
698
699         error_pop_merge
700     ok! jump              loop_75
701         status_ok
702
703failed_74:
704         loc_pop_rewind
705         return
706#
707# value Symbol 'Sign'
708#
709
710sym_Sign:
711# /
712#     '-'
713#     '+'
714
715         symbol_restore    Sign
716  found! jump              found_87
717         loc_push
718
719         call              choice_85
720
721   fail! value_clear
722     ok! value_leaf        Sign
723         symbol_save       Sign
724         error_nonterminal Sign
725         loc_pop_discard
726
727found_87:
728     ok! ast_value_push
729         return
730
731choice_85:
732# /
733#     '-'
734#     '+'
735
736         error_clear
737
738         loc_push
739         error_push
740
741         input_next        "t -"
742     ok! test_char         "-"
743
744         error_pop_merge
745     ok! jump              oknoast_84
746
747         loc_pop_rewind
748         loc_push
749         error_push
750
751         input_next        "t +"
752     ok! test_char         "+"
753
754         error_pop_merge
755     ok! jump              oknoast_84
756
757         loc_pop_rewind
758         status_fail
759         return
760
761oknoast_84:
762         loc_pop_discard
763         return
764#
765# value Symbol 'Term'
766#
767
768sym_Term:
769# (Number)
770
771         symbol_restore    Term
772  found! jump              found_90
773         loc_push
774         ast_push
775
776         call              sym_Number
777
778   fail! value_clear
779     ok! value_reduce      Term
780         symbol_save       Term
781         error_nonterminal Term
782         ast_pop_rewind
783         loc_pop_discard
784
785found_90:
786     ok! ast_value_push
787         return
788
789#
790#
791