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#     (Function)
232#     /
233#         x
234#             '\('
235#             (Expression)
236#             '\)'
237#         x
238#             (Factor)
239#             *
240#                 x
241#                     (MulOp)
242#                     (Factor)
243
244         symbol_restore    Expression
245  found! jump              found_50
246         loc_push
247         ast_push
248
249         call              choice_48
250
251   fail! value_clear
252     ok! value_reduce      Expression
253         symbol_save       Expression
254         error_nonterminal Expression
255         ast_pop_rewind
256         loc_pop_discard
257
258found_50:
259     ok! ast_value_push
260         return
261
262choice_48:
263# /
264#     (Function)
265#     /
266#         x
267#             '\('
268#             (Expression)
269#             '\)'
270#         x
271#             (Factor)
272#             *
273#                 x
274#                     (MulOp)
275#                     (Factor)
276
277         error_clear
278
279         ast_push
280         loc_push
281         error_push
282
283         call              sym_Function
284
285         error_pop_merge
286     ok! jump              ok_47
287
288         ast_pop_rewind
289         loc_pop_rewind
290         ast_push
291         loc_push
292         error_push
293
294         call              choice_45
295
296         error_pop_merge
297     ok! jump              ok_47
298
299         ast_pop_rewind
300         loc_pop_rewind
301         status_fail
302         return
303
304ok_47:
305         ast_pop_discard
306         loc_pop_discard
307         return
308
309choice_45:
310# /
311#     x
312#         '\('
313#         (Expression)
314#         '\)'
315#     x
316#         (Factor)
317#         *
318#             x
319#                 (MulOp)
320#                 (Factor)
321
322         error_clear
323
324         ast_push
325         loc_push
326         error_push
327
328         call              sequence_28
329
330         error_pop_merge
331     ok! jump              ok_44
332
333         ast_pop_rewind
334         loc_pop_rewind
335         ast_push
336         loc_push
337         error_push
338
339         call              sequence_41
340
341         error_pop_merge
342     ok! jump              ok_44
343
344         ast_pop_rewind
345         loc_pop_rewind
346         status_fail
347         return
348
349ok_44:
350         ast_pop_discard
351         loc_pop_discard
352         return
353
354sequence_28:
355# x
356#     '\('
357#     (Expression)
358#     '\)'
359
360         loc_push
361         error_clear
362
363         error_push
364
365         input_next        "t ("
366     ok! test_char         "("
367
368         error_pop_merge
369   fail! jump              failednoast_30
370         ast_push
371         error_push
372
373         call              sym_Expression
374
375         error_pop_merge
376   fail! jump              failed_29
377         error_push
378
379         input_next        "t )"
380     ok! test_char         ")"
381
382         error_pop_merge
383   fail! jump              failed_29
384
385         ast_pop_discard
386         loc_pop_discard
387         return
388
389failed_29:
390         ast_pop_rewind
391
392failednoast_30:
393         loc_pop_rewind
394         return
395
396sequence_41:
397# x
398#     (Factor)
399#     *
400#         x
401#             (MulOp)
402#             (Factor)
403
404         ast_push
405         loc_push
406         error_clear
407
408         error_push
409
410         call              sym_Factor
411
412         error_pop_merge
413   fail! jump              failed_42
414         error_push
415
416         call              kleene_38
417
418         error_pop_merge
419   fail! jump              failed_42
420
421         ast_pop_discard
422         loc_pop_discard
423         return
424
425failed_42:
426         ast_pop_rewind
427         loc_pop_rewind
428         return
429
430kleene_38:
431# *
432#     x
433#         (MulOp)
434#         (Factor)
435
436         loc_push
437         error_push
438
439         call              sequence_35
440
441         error_pop_merge
442   fail! jump              failed_39
443         loc_pop_discard
444         jump              kleene_38
445
446failed_39:
447         loc_pop_rewind
448         status_ok
449         return
450
451sequence_35:
452# x
453#     (MulOp)
454#     (Factor)
455
456         ast_push
457         loc_push
458         error_clear
459
460         error_push
461
462         call              sym_MulOp
463
464         error_pop_merge
465   fail! jump              failed_36
466         error_push
467
468         call              sym_Factor
469
470         error_pop_merge
471   fail! jump              failed_36
472
473         ast_pop_discard
474         loc_pop_discard
475         return
476
477failed_36:
478         ast_pop_rewind
479         loc_pop_rewind
480         return
481#
482# value Symbol 'Factor'
483#
484
485sym_Factor:
486# x
487#     (Term)
488#     *
489#         x
490#             (AddOp)
491#             (Term)
492
493         symbol_restore    Factor
494  found! jump              found_64
495         loc_push
496         ast_push
497
498         call              sequence_61
499
500   fail! value_clear
501     ok! value_reduce      Factor
502         symbol_save       Factor
503         error_nonterminal Factor
504         ast_pop_rewind
505         loc_pop_discard
506
507found_64:
508     ok! ast_value_push
509         return
510
511sequence_61:
512# x
513#     (Term)
514#     *
515#         x
516#             (AddOp)
517#             (Term)
518
519         ast_push
520         loc_push
521         error_clear
522
523         error_push
524
525         call              sym_Term
526
527         error_pop_merge
528   fail! jump              failed_62
529         error_push
530
531         call              kleene_58
532
533         error_pop_merge
534   fail! jump              failed_62
535
536         ast_pop_discard
537         loc_pop_discard
538         return
539
540failed_62:
541         ast_pop_rewind
542         loc_pop_rewind
543         return
544
545kleene_58:
546# *
547#     x
548#         (AddOp)
549#         (Term)
550
551         loc_push
552         error_push
553
554         call              sequence_55
555
556         error_pop_merge
557   fail! jump              failed_59
558         loc_pop_discard
559         jump              kleene_58
560
561failed_59:
562         loc_pop_rewind
563         status_ok
564         return
565
566sequence_55:
567# x
568#     (AddOp)
569#     (Term)
570
571         ast_push
572         loc_push
573         error_clear
574
575         error_push
576
577         call              sym_AddOp
578
579         error_pop_merge
580   fail! jump              failed_56
581         error_push
582
583         call              sym_Term
584
585         error_pop_merge
586   fail! jump              failed_56
587
588         ast_pop_discard
589         loc_pop_discard
590         return
591
592failed_56:
593         ast_pop_rewind
594         loc_pop_rewind
595         return
596#
597# value Symbol 'Function'
598#
599
600sym_Function:
601# (Sinus)
602
603         symbol_restore    Function
604  found! jump              found_67
605         loc_push
606         ast_push
607
608         call              sym_Sinus
609
610   fail! value_clear
611     ok! value_reduce      Function
612         symbol_save       Function
613         error_nonterminal Function
614         ast_pop_rewind
615         loc_pop_discard
616
617found_67:
618     ok! ast_value_push
619         return
620#
621# value Symbol 'MulOp'
622#
623
624sym_MulOp:
625# /
626#     '*'
627#     '/'
628
629         symbol_restore    MulOp
630  found! jump              found_74
631         loc_push
632
633         call              choice_72
634
635   fail! value_clear
636     ok! value_leaf        MulOp
637         symbol_save       MulOp
638         error_nonterminal MulOp
639         loc_pop_discard
640
641found_74:
642     ok! ast_value_push
643         return
644
645choice_72:
646# /
647#     '*'
648#     '/'
649
650         error_clear
651
652         loc_push
653         error_push
654
655         input_next        "t *"
656     ok! test_char         "*"
657
658         error_pop_merge
659     ok! jump              oknoast_71
660
661         loc_pop_rewind
662         loc_push
663         error_push
664
665         input_next        "t /"
666     ok! test_char         "/"
667
668         error_pop_merge
669     ok! jump              oknoast_71
670
671         loc_pop_rewind
672         status_fail
673         return
674
675oknoast_71:
676         loc_pop_discard
677         return
678#
679# value Symbol 'Number'
680#
681
682sym_Number:
683# x
684#     ?
685#         (Sign)
686#     +
687#         (Digit)
688
689         symbol_restore    Number
690  found! jump              found_87
691         loc_push
692         ast_push
693
694         call              sequence_84
695
696   fail! value_clear
697     ok! value_reduce      Number
698         symbol_save       Number
699         error_nonterminal Number
700         ast_pop_rewind
701         loc_pop_discard
702
703found_87:
704     ok! ast_value_push
705         return
706
707sequence_84:
708# x
709#     ?
710#         (Sign)
711#     +
712#         (Digit)
713
714         ast_push
715         loc_push
716         error_clear
717
718         error_push
719
720         call              optional_77
721
722         error_pop_merge
723   fail! jump              failed_85
724         error_push
725
726         call              poskleene_80
727
728         error_pop_merge
729   fail! jump              failed_85
730
731         ast_pop_discard
732         loc_pop_discard
733         return
734
735failed_85:
736         ast_pop_rewind
737         loc_pop_rewind
738         return
739
740optional_77:
741# ?
742#     (Sign)
743
744         loc_push
745         error_push
746
747         call              sym_Sign
748
749         error_pop_merge
750   fail! loc_pop_rewind
751     ok! loc_pop_discard
752         status_ok
753         return
754
755poskleene_80:
756# +
757#     (Digit)
758
759         loc_push
760
761         call              sym_Digit
762
763   fail! jump              failed_81
764
765loop_82:
766         loc_pop_discard
767         loc_push
768         error_push
769
770         call              sym_Digit
771
772         error_pop_merge
773     ok! jump              loop_82
774         status_ok
775
776failed_81:
777         loc_pop_rewind
778         return
779#
780# value Symbol 'Sign'
781#
782
783sym_Sign:
784# /
785#     '-'
786#     '+'
787
788         symbol_restore    Sign
789  found! jump              found_93
790         loc_push
791
792         call              choice_5
793
794   fail! value_clear
795     ok! value_leaf        Sign
796         symbol_save       Sign
797         error_nonterminal Sign
798         loc_pop_discard
799
800found_93:
801     ok! ast_value_push
802         return
803#
804# value Symbol 'Sinus'
805#
806
807sym_Sinus:
808# x
809#     's'
810#     'i'
811#     'n'
812#     '\('
813#     (Expression)
814#     '\)'
815
816         symbol_restore    Sinus
817  found! jump              found_105
818         loc_push
819         ast_push
820
821         call              sequence_101
822
823   fail! value_clear
824     ok! value_reduce      Sinus
825         symbol_save       Sinus
826         error_nonterminal Sinus
827         ast_pop_rewind
828         loc_pop_discard
829
830found_105:
831     ok! ast_value_push
832         return
833
834sequence_101:
835# x
836#     's'
837#     'i'
838#     'n'
839#     '\('
840#     (Expression)
841#     '\)'
842
843         loc_push
844         error_clear
845
846         error_push
847
848         input_next        "t s"
849     ok! test_char         "s"
850
851         error_pop_merge
852   fail! jump              failednoast_103
853         error_push
854
855         input_next        "t i"
856     ok! test_char         "i"
857
858         error_pop_merge
859   fail! jump              failednoast_103
860         error_push
861
862         input_next        "t n"
863     ok! test_char         "n"
864
865         error_pop_merge
866   fail! jump              failednoast_103
867         error_push
868
869         input_next        "t ("
870     ok! test_char         "("
871
872         error_pop_merge
873   fail! jump              failednoast_103
874         ast_push
875         error_push
876
877         call              sym_Expression
878
879         error_pop_merge
880   fail! jump              failed_102
881         error_push
882
883         input_next        "t )"
884     ok! test_char         ")"
885
886         error_pop_merge
887   fail! jump              failed_102
888
889         ast_pop_discard
890         loc_pop_discard
891         return
892
893failed_102:
894         ast_pop_rewind
895
896failednoast_103:
897         loc_pop_rewind
898         return
899#
900# value Symbol 'Term'
901#
902
903sym_Term:
904# (Number)
905
906         symbol_restore    Term
907  found! jump              found_108
908         loc_push
909         ast_push
910
911         call              sym_Number
912
913   fail! value_clear
914     ok! value_reduce      Term
915         symbol_save       Term
916         error_nonterminal Term
917         ast_pop_rewind
918         loc_pop_discard
919
920found_108:
921     ok! ast_value_push
922         return
923
924#
925#
926