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

import org.antlr.runtime.*;
import org.antlr.runtime.tree.*;import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class SimpleCTP extends TreeParser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "VAR_DEF", "ARG_DEF", "FUNC_HDR", "FUNC_DECL", "FUNC_DEF", "BLOCK", "ID", "EQ", "INT", "FOR", "INT_TYPE", "CHAR", "VOID", "EQEQ", "LT", "PLUS", "WS", "';'", "'('", "','", "')'", "'{'", "'}'"
    };
    public static final int LT=18;
    public static final int T__26=26;
    public static final int T__25=25;
    public static final int T__24=24;
    public static final int T__23=23;
    public static final int T__22=22;
    public static final int T__21=21;
    public static final int CHAR=15;
    public static final int FOR=13;
    public static final int FUNC_HDR=6;
    public static final int INT=12;
    public static final int FUNC_DEF=8;
    public static final int INT_TYPE=14;
    public static final int ID=10;
    public static final int EOF=-1;
    public static final int FUNC_DECL=7;
    public static final int ARG_DEF=5;
    public static final int WS=20;
    public static final int BLOCK=9;
    public static final int PLUS=19;
    public static final int VOID=16;
    public static final int EQ=11;
    public static final int VAR_DEF=4;
    public static final int EQEQ=17;

    // delegates
    // delegators


        public SimpleCTP(TreeNodeStream input) {
            this(input, new RecognizerSharedState());
        }
        public SimpleCTP(TreeNodeStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        

    public String[] getTokenNames() { return SimpleCTP.tokenNames; }
    public String getGrammarFileName() { return "/usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g"; }



    // $ANTLR start "program"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:8:1: program : ( declaration )+ ;
    public final void program() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:9:5: ( ( declaration )+ )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:9:9: ( declaration )+
            {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:9:9: ( declaration )+
            int cnt1=0;
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==VAR_DEF||(LA1_0>=FUNC_DECL && LA1_0<=FUNC_DEF)) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:9:9: declaration
            	    {
            	    pushFollow(FOLLOW_declaration_in_program43);
            	    declaration();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "program"


    // $ANTLR start "declaration"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:12:1: declaration : ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) );
    public final void declaration() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:13:5: ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) )
            int alt2=3;
            switch ( input.LA(1) ) {
            case VAR_DEF:
                {
                alt2=1;
                }
                break;
            case FUNC_DECL:
                {
                alt2=2;
                }
                break;
            case FUNC_DEF:
                {
                alt2=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;
            }

            switch (alt2) {
                case 1 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:13:9: variable
                    {
                    pushFollow(FOLLOW_variable_in_declaration63);
                    variable();

                    state._fsp--;


                    }
                    break;
                case 2 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:14:9: ^( FUNC_DECL functionHeader )
                    {
                    match(input,FUNC_DECL,FOLLOW_FUNC_DECL_in_declaration74); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_functionHeader_in_declaration76);
                    functionHeader();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 3 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:15:9: ^( FUNC_DEF functionHeader block )
                    {
                    match(input,FUNC_DEF,FOLLOW_FUNC_DEF_in_declaration88); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_functionHeader_in_declaration90);
                    functionHeader();

                    state._fsp--;

                    pushFollow(FOLLOW_block_in_declaration92);
                    block();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "declaration"


    // $ANTLR start "variable"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:18:1: variable : ^( VAR_DEF type declarator ) ;
    public final void variable() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:19:5: ( ^( VAR_DEF type declarator ) )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:19:9: ^( VAR_DEF type declarator )
            {
            match(input,VAR_DEF,FOLLOW_VAR_DEF_in_variable113); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_type_in_variable115);
            type();

            state._fsp--;

            pushFollow(FOLLOW_declarator_in_variable117);
            declarator();

            state._fsp--;


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "variable"


    // $ANTLR start "declarator"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:22:1: declarator : ID ;
    public final void declarator() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:23:5: ( ID )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:23:9: ID
            {
            match(input,ID,FOLLOW_ID_in_declarator137); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "declarator"


    // $ANTLR start "functionHeader"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:26:1: functionHeader : ^( FUNC_HDR type ID ( formalParameter )+ ) ;
    public final void functionHeader() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:5: ( ^( FUNC_HDR type ID ( formalParameter )+ ) )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:9: ^( FUNC_HDR type ID ( formalParameter )+ )
            {
            match(input,FUNC_HDR,FOLLOW_FUNC_HDR_in_functionHeader158); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_type_in_functionHeader160);
            type();

            state._fsp--;

            match(input,ID,FOLLOW_ID_in_functionHeader162); 
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:28: ( formalParameter )+
            int cnt3=0;
            loop3:
            do {
                int alt3=2;
                int LA3_0 = input.LA(1);

                if ( (LA3_0==ARG_DEF) ) {
                    alt3=1;
                }


                switch (alt3) {
            	case 1 :
            	    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:28: formalParameter
            	    {
            	    pushFollow(FOLLOW_formalParameter_in_functionHeader164);
            	    formalParameter();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt3 >= 1 ) break loop3;
                        EarlyExitException eee =
                            new EarlyExitException(3, input);
                        throw eee;
                }
                cnt3++;
            } while (true);


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "functionHeader"


    // $ANTLR start "formalParameter"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:30:1: formalParameter : ^( ARG_DEF type declarator ) ;
    public final void formalParameter() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:31:5: ( ^( ARG_DEF type declarator ) )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:31:9: ^( ARG_DEF type declarator )
            {
            match(input,ARG_DEF,FOLLOW_ARG_DEF_in_formalParameter186); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_type_in_formalParameter188);
            type();

            state._fsp--;

            pushFollow(FOLLOW_declarator_in_formalParameter190);
            declarator();

            state._fsp--;


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "formalParameter"


    // $ANTLR start "type"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:34:1: type : ( 'int' | 'char' | 'void' | ID );
    public final void type() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:35:5: ( 'int' | 'char' | 'void' | ID )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:
            {
            if ( input.LA(1)==ID||(input.LA(1)>=INT_TYPE && input.LA(1)<=VOID) ) {
                input.consume();
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "type"


    // $ANTLR start "block"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:41:1: block : ^( BLOCK ( variable )* ( stat )* ) ;
    public final void block() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:5: ( ^( BLOCK ( variable )* ( stat )* ) )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:9: ^( BLOCK ( variable )* ( stat )* )
            {
            match(input,BLOCK,FOLLOW_BLOCK_in_block273); 

            if ( input.LA(1)==Token.DOWN ) {
                match(input, Token.DOWN, null); 
                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:17: ( variable )*
                loop4:
                do {
                    int alt4=2;
                    int LA4_0 = input.LA(1);

                    if ( (LA4_0==VAR_DEF) ) {
                        alt4=1;
                    }


                    switch (alt4) {
                	case 1 :
                	    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:17: variable
                	    {
                	    pushFollow(FOLLOW_variable_in_block275);
                	    variable();

                	    state._fsp--;


                	    }
                	    break;

                	default :
                	    break loop4;
                    }
                } while (true);

                // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:27: ( stat )*
                loop5:
                do {
                    int alt5=2;
                    int LA5_0 = input.LA(1);

                    if ( ((LA5_0>=BLOCK && LA5_0<=FOR)||(LA5_0>=EQEQ && LA5_0<=PLUS)) ) {
                        alt5=1;
                    }


                    switch (alt5) {
                	case 1 :
                	    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:27: stat
                	    {
                	    pushFollow(FOLLOW_stat_in_block278);
                	    stat();

                	    state._fsp--;


                	    }
                	    break;

                	default :
                	    break loop5;
                    }
                } while (true);


                match(input, Token.UP, null); 
            }

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "block"


    // $ANTLR start "stat"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:45:1: stat : ( forStat | expr | block );
    public final void stat() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:45:5: ( forStat | expr | block )
            int alt6=3;
            switch ( input.LA(1) ) {
            case FOR:
                {
                alt6=1;
                }
                break;
            case ID:
            case EQ:
            case INT:
            case EQEQ:
            case LT:
            case PLUS:
                {
                alt6=2;
                }
                break;
            case BLOCK:
                {
                alt6=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 6, 0, input);

                throw nvae;
            }

            switch (alt6) {
                case 1 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:45:7: forStat
                    {
                    pushFollow(FOLLOW_forStat_in_stat292);
                    forStat();

                    state._fsp--;


                    }
                    break;
                case 2 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:46:7: expr
                    {
                    pushFollow(FOLLOW_expr_in_stat300);
                    expr();

                    state._fsp--;


                    }
                    break;
                case 3 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:47:7: block
                    {
                    pushFollow(FOLLOW_block_in_stat308);
                    block();

                    state._fsp--;


                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "stat"


    // $ANTLR start "forStat"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:50:1: forStat : ^( 'for' expr expr expr block ) ;
    public final void forStat() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:51:5: ( ^( 'for' expr expr expr block ) )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:51:9: ^( 'for' expr expr expr block )
            {
            match(input,FOR,FOLLOW_FOR_in_forStat328); 

            match(input, Token.DOWN, null); 
            pushFollow(FOLLOW_expr_in_forStat330);
            expr();

            state._fsp--;

            pushFollow(FOLLOW_expr_in_forStat332);
            expr();

            state._fsp--;

            pushFollow(FOLLOW_expr_in_forStat334);
            expr();

            state._fsp--;

            pushFollow(FOLLOW_block_in_forStat336);
            block();

            state._fsp--;


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "forStat"

    public static class expr_return extends TreeRuleReturnScope {
    };

    // $ANTLR start "expr"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:54:1: expr : ( ^( EQEQ expr expr ) | ^( LT expr expr ) | ^( PLUS expr expr ) | ^( EQ ID e= expr ) | atom );
    public final SimpleCTP.expr_return expr() throws RecognitionException {
        SimpleCTP.expr_return retval = new SimpleCTP.expr_return();
        retval.start = input.LT(1);

        ANTLRCommonTree ID1=null;
        SimpleCTP.expr_return e = null;


        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:54:5: ( ^( EQEQ expr expr ) | ^( LT expr expr ) | ^( PLUS expr expr ) | ^( EQ ID e= expr ) | atom )
            int alt7=5;
            switch ( input.LA(1) ) {
            case EQEQ:
                {
                alt7=1;
                }
                break;
            case LT:
                {
                alt7=2;
                }
                break;
            case PLUS:
                {
                alt7=3;
                }
                break;
            case EQ:
                {
                alt7=4;
                }
                break;
            case ID:
            case INT:
                {
                alt7=5;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 7, 0, input);

                throw nvae;
            }

            switch (alt7) {
                case 1 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:54:9: ^( EQEQ expr expr )
                    {
                    match(input,EQEQ,FOLLOW_EQEQ_in_expr352); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_expr_in_expr354);
                    expr();

                    state._fsp--;

                    pushFollow(FOLLOW_expr_in_expr356);
                    expr();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 2 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:55:9: ^( LT expr expr )
                    {
                    match(input,LT,FOLLOW_LT_in_expr368); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_expr_in_expr370);
                    expr();

                    state._fsp--;

                    pushFollow(FOLLOW_expr_in_expr372);
                    expr();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 3 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:56:9: ^( PLUS expr expr )
                    {
                    match(input,PLUS,FOLLOW_PLUS_in_expr384); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_expr_in_expr386);
                    expr();

                    state._fsp--;

                    pushFollow(FOLLOW_expr_in_expr388);
                    expr();

                    state._fsp--;


                    match(input, Token.UP, null); 

                    }
                    break;
                case 4 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:57:9: ^( EQ ID e= expr )
                    {
                    match(input,EQ,FOLLOW_EQ_in_expr400); 

                    match(input, Token.DOWN, null); 
                    ID1=(ANTLRCommonTree)match(input,ID,FOLLOW_ID_in_expr402); 
                    pushFollow(FOLLOW_expr_in_expr406);
                    e=expr();

                    state._fsp--;


                    match(input, Token.UP, null); 
                     NSLog(@"assigning %@ to variable %@", (e!=null?(input.getTokenStream().toString(
                      input.getTreeAdaptor().getTokenStartIndex(e.start),
                      input.getTreeAdaptor().getTokenStopIndex(e.start))):null), (ID1!=null?ID1.getText():null)); 

                    }
                    break;
                case 5 :
                    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:58:9: atom
                    {
                    pushFollow(FOLLOW_atom_in_expr419);
                    atom();

                    state._fsp--;


                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "expr"


    // $ANTLR start "atom"
    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:61:1: atom : ( ID | INT );
    public final void atom() throws RecognitionException {
        try {
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:62:5: ( ID | INT )
            // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:
            {
            if ( input.LA(1)==ID||input.LA(1)==INT ) {
                input.consume();
                state.errorRecovery=false;
            }
            else {
                MismatchedSetException mse = new MismatchedSetException(null,input);
                throw mse;
            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "atom"

    // Delegated rules


 

    public static final BitSet FOLLOW_declaration_in_program43 = new BitSet(new long[]{0x0000000000000192L});
    public static final BitSet FOLLOW_variable_in_declaration63 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FUNC_DECL_in_declaration74 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_functionHeader_in_declaration76 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_FUNC_DEF_in_declaration88 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_functionHeader_in_declaration90 = new BitSet(new long[]{0x0000000000000200L});
    public static final BitSet FOLLOW_block_in_declaration92 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_VAR_DEF_in_variable113 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_type_in_variable115 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_declarator_in_variable117 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_ID_in_declarator137 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FUNC_HDR_in_functionHeader158 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_type_in_functionHeader160 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_ID_in_functionHeader162 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_formalParameter_in_functionHeader164 = new BitSet(new long[]{0x0000000000000028L});
    public static final BitSet FOLLOW_ARG_DEF_in_formalParameter186 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_type_in_formalParameter188 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_declarator_in_formalParameter190 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_set_in_type0 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_BLOCK_in_block273 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_variable_in_block275 = new BitSet(new long[]{0x00000000000E3E18L});
    public static final BitSet FOLLOW_stat_in_block278 = new BitSet(new long[]{0x00000000000E3E08L});
    public static final BitSet FOLLOW_forStat_in_stat292 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_expr_in_stat300 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_block_in_stat308 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FOR_in_forStat328 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expr_in_forStat330 = new BitSet(new long[]{0x00000000000E1C00L});
    public static final BitSet FOLLOW_expr_in_forStat332 = new BitSet(new long[]{0x00000000000E1C00L});
    public static final BitSet FOLLOW_expr_in_forStat334 = new BitSet(new long[]{0x0000000000000200L});
    public static final BitSet FOLLOW_block_in_forStat336 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_EQEQ_in_expr352 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expr_in_expr354 = new BitSet(new long[]{0x00000000000E1C00L});
    public static final BitSet FOLLOW_expr_in_expr356 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_LT_in_expr368 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expr_in_expr370 = new BitSet(new long[]{0x00000000000E1C00L});
    public static final BitSet FOLLOW_expr_in_expr372 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_PLUS_in_expr384 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_expr_in_expr386 = new BitSet(new long[]{0x00000000000E1C00L});
    public static final BitSet FOLLOW_expr_in_expr388 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_EQ_in_expr400 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_ID_in_expr402 = new BitSet(new long[]{0x00000000000E1C00L});
    public static final BitSet FOLLOW_expr_in_expr406 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_atom_in_expr419 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_set_in_atom0 = new BitSet(new long[]{0x0000000000000002L});

}