1 // $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
2 
3 import org.antlr.runtime.*;
4 import org.antlr.runtime.tree.*;import java.util.Stack;
5 import java.util.List;
6 import java.util.ArrayList;
7 
8 public class SimpleCTP extends TreeParser {
9     public static final String[] tokenNames = new String[] {
10         "<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", "';'", "'('", "','", "')'", "'{'", "'}'"
11     };
12     public static final int LT=18;
13     public static final int T__26=26;
14     public static final int T__25=25;
15     public static final int T__24=24;
16     public static final int T__23=23;
17     public static final int T__22=22;
18     public static final int T__21=21;
19     public static final int CHAR=15;
20     public static final int FOR=13;
21     public static final int FUNC_HDR=6;
22     public static final int INT=12;
23     public static final int FUNC_DEF=8;
24     public static final int INT_TYPE=14;
25     public static final int ID=10;
26     public static final int EOF=-1;
27     public static final int FUNC_DECL=7;
28     public static final int ARG_DEF=5;
29     public static final int WS=20;
30     public static final int BLOCK=9;
31     public static final int PLUS=19;
32     public static final int VOID=16;
33     public static final int EQ=11;
34     public static final int VAR_DEF=4;
35     public static final int EQEQ=17;
36 
37     // delegates
38     // delegators
39 
40 
SimpleCTP(TreeNodeStream input)41         public SimpleCTP(TreeNodeStream input) {
42             this(input, new RecognizerSharedState());
43         }
SimpleCTP(TreeNodeStream input, RecognizerSharedState state)44         public SimpleCTP(TreeNodeStream input, RecognizerSharedState state) {
45             super(input, state);
46 
47         }
48 
49 
getTokenNames()50     public String[] getTokenNames() { return SimpleCTP.tokenNames; }
getGrammarFileName()51     public String getGrammarFileName() { return "/usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g"; }
52 
53 
54 
55     // $ANTLR start "program"
56     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:8:1: program : ( declaration )+ ;
program()57     public final void program() throws RecognitionException {
58         try {
59             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:9:5: ( ( declaration )+ )
60             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:9:9: ( declaration )+
61             {
62             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:9:9: ( declaration )+
63             int cnt1=0;
64             loop1:
65             do {
66                 int alt1=2;
67                 int LA1_0 = input.LA(1);
68 
69                 if ( (LA1_0==VAR_DEF||(LA1_0>=FUNC_DECL && LA1_0<=FUNC_DEF)) ) {
70                     alt1=1;
71                 }
72 
73 
74                 switch (alt1) {
75             	case 1 :
76             	    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:9:9: declaration
77             	    {
78             	    pushFollow(FOLLOW_declaration_in_program43);
79             	    declaration();
80 
81             	    state._fsp--;
82 
83 
84             	    }
85             	    break;
86 
87             	default :
88             	    if ( cnt1 >= 1 ) break loop1;
89                         EarlyExitException eee =
90                             new EarlyExitException(1, input);
91                         throw eee;
92                 }
93                 cnt1++;
94             } while (true);
95 
96 
97             }
98 
99         }
100         catch (RecognitionException re) {
101             reportError(re);
102             recover(input,re);
103         }
104         finally {
105         }
106         return ;
107     }
108     // $ANTLR end "program"
109 
110 
111     // $ANTLR start "declaration"
112     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:12:1: declaration : ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) );
declaration()113     public final void declaration() throws RecognitionException {
114         try {
115             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:13:5: ( variable | ^( FUNC_DECL functionHeader ) | ^( FUNC_DEF functionHeader block ) )
116             int alt2=3;
117             switch ( input.LA(1) ) {
118             case VAR_DEF:
119                 {
120                 alt2=1;
121                 }
122                 break;
123             case FUNC_DECL:
124                 {
125                 alt2=2;
126                 }
127                 break;
128             case FUNC_DEF:
129                 {
130                 alt2=3;
131                 }
132                 break;
133             default:
134                 NoViableAltException nvae =
135                     new NoViableAltException("", 2, 0, input);
136 
137                 throw nvae;
138             }
139 
140             switch (alt2) {
141                 case 1 :
142                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:13:9: variable
143                     {
144                     pushFollow(FOLLOW_variable_in_declaration63);
145                     variable();
146 
147                     state._fsp--;
148 
149 
150                     }
151                     break;
152                 case 2 :
153                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:14:9: ^( FUNC_DECL functionHeader )
154                     {
155                     match(input,FUNC_DECL,FOLLOW_FUNC_DECL_in_declaration74);
156 
157                     match(input, Token.DOWN, null);
158                     pushFollow(FOLLOW_functionHeader_in_declaration76);
159                     functionHeader();
160 
161                     state._fsp--;
162 
163 
164                     match(input, Token.UP, null);
165 
166                     }
167                     break;
168                 case 3 :
169                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:15:9: ^( FUNC_DEF functionHeader block )
170                     {
171                     match(input,FUNC_DEF,FOLLOW_FUNC_DEF_in_declaration88);
172 
173                     match(input, Token.DOWN, null);
174                     pushFollow(FOLLOW_functionHeader_in_declaration90);
175                     functionHeader();
176 
177                     state._fsp--;
178 
179                     pushFollow(FOLLOW_block_in_declaration92);
180                     block();
181 
182                     state._fsp--;
183 
184 
185                     match(input, Token.UP, null);
186 
187                     }
188                     break;
189 
190             }
191         }
192         catch (RecognitionException re) {
193             reportError(re);
194             recover(input,re);
195         }
196         finally {
197         }
198         return ;
199     }
200     // $ANTLR end "declaration"
201 
202 
203     // $ANTLR start "variable"
204     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:18:1: variable : ^( VAR_DEF type declarator ) ;
variable()205     public final void variable() throws RecognitionException {
206         try {
207             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:19:5: ( ^( VAR_DEF type declarator ) )
208             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:19:9: ^( VAR_DEF type declarator )
209             {
210             match(input,VAR_DEF,FOLLOW_VAR_DEF_in_variable113);
211 
212             match(input, Token.DOWN, null);
213             pushFollow(FOLLOW_type_in_variable115);
214             type();
215 
216             state._fsp--;
217 
218             pushFollow(FOLLOW_declarator_in_variable117);
219             declarator();
220 
221             state._fsp--;
222 
223 
224             match(input, Token.UP, null);
225 
226             }
227 
228         }
229         catch (RecognitionException re) {
230             reportError(re);
231             recover(input,re);
232         }
233         finally {
234         }
235         return ;
236     }
237     // $ANTLR end "variable"
238 
239 
240     // $ANTLR start "declarator"
241     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:22:1: declarator : ID ;
declarator()242     public final void declarator() throws RecognitionException {
243         try {
244             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:23:5: ( ID )
245             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:23:9: ID
246             {
247             match(input,ID,FOLLOW_ID_in_declarator137);
248 
249             }
250 
251         }
252         catch (RecognitionException re) {
253             reportError(re);
254             recover(input,re);
255         }
256         finally {
257         }
258         return ;
259     }
260     // $ANTLR end "declarator"
261 
262 
263     // $ANTLR start "functionHeader"
264     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:26:1: functionHeader : ^( FUNC_HDR type ID ( formalParameter )+ ) ;
functionHeader()265     public final void functionHeader() throws RecognitionException {
266         try {
267             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:5: ( ^( FUNC_HDR type ID ( formalParameter )+ ) )
268             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:9: ^( FUNC_HDR type ID ( formalParameter )+ )
269             {
270             match(input,FUNC_HDR,FOLLOW_FUNC_HDR_in_functionHeader158);
271 
272             match(input, Token.DOWN, null);
273             pushFollow(FOLLOW_type_in_functionHeader160);
274             type();
275 
276             state._fsp--;
277 
278             match(input,ID,FOLLOW_ID_in_functionHeader162);
279             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:28: ( formalParameter )+
280             int cnt3=0;
281             loop3:
282             do {
283                 int alt3=2;
284                 int LA3_0 = input.LA(1);
285 
286                 if ( (LA3_0==ARG_DEF) ) {
287                     alt3=1;
288                 }
289 
290 
291                 switch (alt3) {
292             	case 1 :
293             	    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:27:28: formalParameter
294             	    {
295             	    pushFollow(FOLLOW_formalParameter_in_functionHeader164);
296             	    formalParameter();
297 
298             	    state._fsp--;
299 
300 
301             	    }
302             	    break;
303 
304             	default :
305             	    if ( cnt3 >= 1 ) break loop3;
306                         EarlyExitException eee =
307                             new EarlyExitException(3, input);
308                         throw eee;
309                 }
310                 cnt3++;
311             } while (true);
312 
313 
314             match(input, Token.UP, null);
315 
316             }
317 
318         }
319         catch (RecognitionException re) {
320             reportError(re);
321             recover(input,re);
322         }
323         finally {
324         }
325         return ;
326     }
327     // $ANTLR end "functionHeader"
328 
329 
330     // $ANTLR start "formalParameter"
331     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:30:1: formalParameter : ^( ARG_DEF type declarator ) ;
formalParameter()332     public final void formalParameter() throws RecognitionException {
333         try {
334             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:31:5: ( ^( ARG_DEF type declarator ) )
335             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:31:9: ^( ARG_DEF type declarator )
336             {
337             match(input,ARG_DEF,FOLLOW_ARG_DEF_in_formalParameter186);
338 
339             match(input, Token.DOWN, null);
340             pushFollow(FOLLOW_type_in_formalParameter188);
341             type();
342 
343             state._fsp--;
344 
345             pushFollow(FOLLOW_declarator_in_formalParameter190);
346             declarator();
347 
348             state._fsp--;
349 
350 
351             match(input, Token.UP, null);
352 
353             }
354 
355         }
356         catch (RecognitionException re) {
357             reportError(re);
358             recover(input,re);
359         }
360         finally {
361         }
362         return ;
363     }
364     // $ANTLR end "formalParameter"
365 
366 
367     // $ANTLR start "type"
368     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:34:1: type : ( 'int' | 'char' | 'void' | ID );
type()369     public final void type() throws RecognitionException {
370         try {
371             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:35:5: ( 'int' | 'char' | 'void' | ID )
372             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:
373             {
374             if ( input.LA(1)==ID||(input.LA(1)>=INT_TYPE && input.LA(1)<=VOID) ) {
375                 input.consume();
376                 state.errorRecovery=false;
377             }
378             else {
379                 MismatchedSetException mse = new MismatchedSetException(null,input);
380                 throw mse;
381             }
382 
383 
384             }
385 
386         }
387         catch (RecognitionException re) {
388             reportError(re);
389             recover(input,re);
390         }
391         finally {
392         }
393         return ;
394     }
395     // $ANTLR end "type"
396 
397 
398     // $ANTLR start "block"
399     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:41:1: block : ^( BLOCK ( variable )* ( stat )* ) ;
block()400     public final void block() throws RecognitionException {
401         try {
402             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:5: ( ^( BLOCK ( variable )* ( stat )* ) )
403             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:9: ^( BLOCK ( variable )* ( stat )* )
404             {
405             match(input,BLOCK,FOLLOW_BLOCK_in_block273);
406 
407             if ( input.LA(1)==Token.DOWN ) {
408                 match(input, Token.DOWN, null);
409                 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:17: ( variable )*
410                 loop4:
411                 do {
412                     int alt4=2;
413                     int LA4_0 = input.LA(1);
414 
415                     if ( (LA4_0==VAR_DEF) ) {
416                         alt4=1;
417                     }
418 
419 
420                     switch (alt4) {
421                 	case 1 :
422                 	    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:17: variable
423                 	    {
424                 	    pushFollow(FOLLOW_variable_in_block275);
425                 	    variable();
426 
427                 	    state._fsp--;
428 
429 
430                 	    }
431                 	    break;
432 
433                 	default :
434                 	    break loop4;
435                     }
436                 } while (true);
437 
438                 // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:27: ( stat )*
439                 loop5:
440                 do {
441                     int alt5=2;
442                     int LA5_0 = input.LA(1);
443 
444                     if ( ((LA5_0>=BLOCK && LA5_0<=FOR)||(LA5_0>=EQEQ && LA5_0<=PLUS)) ) {
445                         alt5=1;
446                     }
447 
448 
449                     switch (alt5) {
450                 	case 1 :
451                 	    // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:42:27: stat
452                 	    {
453                 	    pushFollow(FOLLOW_stat_in_block278);
454                 	    stat();
455 
456                 	    state._fsp--;
457 
458 
459                 	    }
460                 	    break;
461 
462                 	default :
463                 	    break loop5;
464                     }
465                 } while (true);
466 
467 
468                 match(input, Token.UP, null);
469             }
470 
471             }
472 
473         }
474         catch (RecognitionException re) {
475             reportError(re);
476             recover(input,re);
477         }
478         finally {
479         }
480         return ;
481     }
482     // $ANTLR end "block"
483 
484 
485     // $ANTLR start "stat"
486     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:45:1: stat : ( forStat | expr | block );
stat()487     public final void stat() throws RecognitionException {
488         try {
489             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:45:5: ( forStat | expr | block )
490             int alt6=3;
491             switch ( input.LA(1) ) {
492             case FOR:
493                 {
494                 alt6=1;
495                 }
496                 break;
497             case ID:
498             case EQ:
499             case INT:
500             case EQEQ:
501             case LT:
502             case PLUS:
503                 {
504                 alt6=2;
505                 }
506                 break;
507             case BLOCK:
508                 {
509                 alt6=3;
510                 }
511                 break;
512             default:
513                 NoViableAltException nvae =
514                     new NoViableAltException("", 6, 0, input);
515 
516                 throw nvae;
517             }
518 
519             switch (alt6) {
520                 case 1 :
521                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:45:7: forStat
522                     {
523                     pushFollow(FOLLOW_forStat_in_stat292);
524                     forStat();
525 
526                     state._fsp--;
527 
528 
529                     }
530                     break;
531                 case 2 :
532                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:46:7: expr
533                     {
534                     pushFollow(FOLLOW_expr_in_stat300);
535                     expr();
536 
537                     state._fsp--;
538 
539 
540                     }
541                     break;
542                 case 3 :
543                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:47:7: block
544                     {
545                     pushFollow(FOLLOW_block_in_stat308);
546                     block();
547 
548                     state._fsp--;
549 
550 
551                     }
552                     break;
553 
554             }
555         }
556         catch (RecognitionException re) {
557             reportError(re);
558             recover(input,re);
559         }
560         finally {
561         }
562         return ;
563     }
564     // $ANTLR end "stat"
565 
566 
567     // $ANTLR start "forStat"
568     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:50:1: forStat : ^( 'for' expr expr expr block ) ;
forStat()569     public final void forStat() throws RecognitionException {
570         try {
571             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:51:5: ( ^( 'for' expr expr expr block ) )
572             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:51:9: ^( 'for' expr expr expr block )
573             {
574             match(input,FOR,FOLLOW_FOR_in_forStat328);
575 
576             match(input, Token.DOWN, null);
577             pushFollow(FOLLOW_expr_in_forStat330);
578             expr();
579 
580             state._fsp--;
581 
582             pushFollow(FOLLOW_expr_in_forStat332);
583             expr();
584 
585             state._fsp--;
586 
587             pushFollow(FOLLOW_expr_in_forStat334);
588             expr();
589 
590             state._fsp--;
591 
592             pushFollow(FOLLOW_block_in_forStat336);
593             block();
594 
595             state._fsp--;
596 
597 
598             match(input, Token.UP, null);
599 
600             }
601 
602         }
603         catch (RecognitionException re) {
604             reportError(re);
605             recover(input,re);
606         }
607         finally {
608         }
609         return ;
610     }
611     // $ANTLR end "forStat"
612 
613     public static class expr_return extends TreeRuleReturnScope {
614     };
615 
616     // $ANTLR start "expr"
617     // /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 );
expr()618     public final SimpleCTP.expr_return expr() throws RecognitionException {
619         SimpleCTP.expr_return retval = new SimpleCTP.expr_return();
620         retval.start = input.LT(1);
621 
622         ANTLRCommonTree ID1=null;
623         SimpleCTP.expr_return e = null;
624 
625 
626         try {
627             // /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 )
628             int alt7=5;
629             switch ( input.LA(1) ) {
630             case EQEQ:
631                 {
632                 alt7=1;
633                 }
634                 break;
635             case LT:
636                 {
637                 alt7=2;
638                 }
639                 break;
640             case PLUS:
641                 {
642                 alt7=3;
643                 }
644                 break;
645             case EQ:
646                 {
647                 alt7=4;
648                 }
649                 break;
650             case ID:
651             case INT:
652                 {
653                 alt7=5;
654                 }
655                 break;
656             default:
657                 NoViableAltException nvae =
658                     new NoViableAltException("", 7, 0, input);
659 
660                 throw nvae;
661             }
662 
663             switch (alt7) {
664                 case 1 :
665                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:54:9: ^( EQEQ expr expr )
666                     {
667                     match(input,EQEQ,FOLLOW_EQEQ_in_expr352);
668 
669                     match(input, Token.DOWN, null);
670                     pushFollow(FOLLOW_expr_in_expr354);
671                     expr();
672 
673                     state._fsp--;
674 
675                     pushFollow(FOLLOW_expr_in_expr356);
676                     expr();
677 
678                     state._fsp--;
679 
680 
681                     match(input, Token.UP, null);
682 
683                     }
684                     break;
685                 case 2 :
686                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:55:9: ^( LT expr expr )
687                     {
688                     match(input,LT,FOLLOW_LT_in_expr368);
689 
690                     match(input, Token.DOWN, null);
691                     pushFollow(FOLLOW_expr_in_expr370);
692                     expr();
693 
694                     state._fsp--;
695 
696                     pushFollow(FOLLOW_expr_in_expr372);
697                     expr();
698 
699                     state._fsp--;
700 
701 
702                     match(input, Token.UP, null);
703 
704                     }
705                     break;
706                 case 3 :
707                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:56:9: ^( PLUS expr expr )
708                     {
709                     match(input,PLUS,FOLLOW_PLUS_in_expr384);
710 
711                     match(input, Token.DOWN, null);
712                     pushFollow(FOLLOW_expr_in_expr386);
713                     expr();
714 
715                     state._fsp--;
716 
717                     pushFollow(FOLLOW_expr_in_expr388);
718                     expr();
719 
720                     state._fsp--;
721 
722 
723                     match(input, Token.UP, null);
724 
725                     }
726                     break;
727                 case 4 :
728                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:57:9: ^( EQ ID e= expr )
729                     {
730                     match(input,EQ,FOLLOW_EQ_in_expr400);
731 
732                     match(input, Token.DOWN, null);
733                     ID1=(ANTLRCommonTree)match(input,ID,FOLLOW_ID_in_expr402);
734                     pushFollow(FOLLOW_expr_in_expr406);
735                     e=expr();
736 
737                     state._fsp--;
738 
739 
740                     match(input, Token.UP, null);
741                      NSLog(@"assigning %@ to variable %@", (e!=null?(input.getTokenStream().toString(
742                       input.getTreeAdaptor().getTokenStartIndex(e.start),
743                       input.getTreeAdaptor().getTokenStopIndex(e.start))):null), (ID1!=null?ID1.getText():null));
744 
745                     }
746                     break;
747                 case 5 :
748                     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:58:9: atom
749                     {
750                     pushFollow(FOLLOW_atom_in_expr419);
751                     atom();
752 
753                     state._fsp--;
754 
755 
756                     }
757                     break;
758 
759             }
760         }
761         catch (RecognitionException re) {
762             reportError(re);
763             recover(input,re);
764         }
765         finally {
766         }
767         return retval;
768     }
769     // $ANTLR end "expr"
770 
771 
772     // $ANTLR start "atom"
773     // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:61:1: atom : ( ID | INT );
atom()774     public final void atom() throws RecognitionException {
775         try {
776             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:62:5: ( ID | INT )
777             // /usr/local/ANTLR3-ObjC2.0-Runtime/Framework/examples/simplecTreeParser/SimpleCTP.g:
778             {
779             if ( input.LA(1)==ID||input.LA(1)==INT ) {
780                 input.consume();
781                 state.errorRecovery=false;
782             }
783             else {
784                 MismatchedSetException mse = new MismatchedSetException(null,input);
785                 throw mse;
786             }
787 
788 
789             }
790 
791         }
792         catch (RecognitionException re) {
793             reportError(re);
794             recover(input,re);
795         }
796         finally {
797         }
798         return ;
799     }
800     // $ANTLR end "atom"
801 
802     // Delegated rules
803 
804 
805 
806 
807     public static final BitSet FOLLOW_declaration_in_program43 = new BitSet(new long[]{0x0000000000000192L});
808     public static final BitSet FOLLOW_variable_in_declaration63 = new BitSet(new long[]{0x0000000000000002L});
809     public static final BitSet FOLLOW_FUNC_DECL_in_declaration74 = new BitSet(new long[]{0x0000000000000004L});
810     public static final BitSet FOLLOW_functionHeader_in_declaration76 = new BitSet(new long[]{0x0000000000000008L});
811     public static final BitSet FOLLOW_FUNC_DEF_in_declaration88 = new BitSet(new long[]{0x0000000000000004L});
812     public static final BitSet FOLLOW_functionHeader_in_declaration90 = new BitSet(new long[]{0x0000000000000200L});
813     public static final BitSet FOLLOW_block_in_declaration92 = new BitSet(new long[]{0x0000000000000008L});
814     public static final BitSet FOLLOW_VAR_DEF_in_variable113 = new BitSet(new long[]{0x0000000000000004L});
815     public static final BitSet FOLLOW_type_in_variable115 = new BitSet(new long[]{0x0000000000000400L});
816     public static final BitSet FOLLOW_declarator_in_variable117 = new BitSet(new long[]{0x0000000000000008L});
817     public static final BitSet FOLLOW_ID_in_declarator137 = new BitSet(new long[]{0x0000000000000002L});
818     public static final BitSet FOLLOW_FUNC_HDR_in_functionHeader158 = new BitSet(new long[]{0x0000000000000004L});
819     public static final BitSet FOLLOW_type_in_functionHeader160 = new BitSet(new long[]{0x0000000000000400L});
820     public static final BitSet FOLLOW_ID_in_functionHeader162 = new BitSet(new long[]{0x0000000000000020L});
821     public static final BitSet FOLLOW_formalParameter_in_functionHeader164 = new BitSet(new long[]{0x0000000000000028L});
822     public static final BitSet FOLLOW_ARG_DEF_in_formalParameter186 = new BitSet(new long[]{0x0000000000000004L});
823     public static final BitSet FOLLOW_type_in_formalParameter188 = new BitSet(new long[]{0x0000000000000400L});
824     public static final BitSet FOLLOW_declarator_in_formalParameter190 = new BitSet(new long[]{0x0000000000000008L});
825     public static final BitSet FOLLOW_set_in_type0 = new BitSet(new long[]{0x0000000000000002L});
826     public static final BitSet FOLLOW_BLOCK_in_block273 = new BitSet(new long[]{0x0000000000000004L});
827     public static final BitSet FOLLOW_variable_in_block275 = new BitSet(new long[]{0x00000000000E3E18L});
828     public static final BitSet FOLLOW_stat_in_block278 = new BitSet(new long[]{0x00000000000E3E08L});
829     public static final BitSet FOLLOW_forStat_in_stat292 = new BitSet(new long[]{0x0000000000000002L});
830     public static final BitSet FOLLOW_expr_in_stat300 = new BitSet(new long[]{0x0000000000000002L});
831     public static final BitSet FOLLOW_block_in_stat308 = new BitSet(new long[]{0x0000000000000002L});
832     public static final BitSet FOLLOW_FOR_in_forStat328 = new BitSet(new long[]{0x0000000000000004L});
833     public static final BitSet FOLLOW_expr_in_forStat330 = new BitSet(new long[]{0x00000000000E1C00L});
834     public static final BitSet FOLLOW_expr_in_forStat332 = new BitSet(new long[]{0x00000000000E1C00L});
835     public static final BitSet FOLLOW_expr_in_forStat334 = new BitSet(new long[]{0x0000000000000200L});
836     public static final BitSet FOLLOW_block_in_forStat336 = new BitSet(new long[]{0x0000000000000008L});
837     public static final BitSet FOLLOW_EQEQ_in_expr352 = new BitSet(new long[]{0x0000000000000004L});
838     public static final BitSet FOLLOW_expr_in_expr354 = new BitSet(new long[]{0x00000000000E1C00L});
839     public static final BitSet FOLLOW_expr_in_expr356 = new BitSet(new long[]{0x0000000000000008L});
840     public static final BitSet FOLLOW_LT_in_expr368 = new BitSet(new long[]{0x0000000000000004L});
841     public static final BitSet FOLLOW_expr_in_expr370 = new BitSet(new long[]{0x00000000000E1C00L});
842     public static final BitSet FOLLOW_expr_in_expr372 = new BitSet(new long[]{0x0000000000000008L});
843     public static final BitSet FOLLOW_PLUS_in_expr384 = new BitSet(new long[]{0x0000000000000004L});
844     public static final BitSet FOLLOW_expr_in_expr386 = new BitSet(new long[]{0x00000000000E1C00L});
845     public static final BitSet FOLLOW_expr_in_expr388 = new BitSet(new long[]{0x0000000000000008L});
846     public static final BitSet FOLLOW_EQ_in_expr400 = new BitSet(new long[]{0x0000000000000004L});
847     public static final BitSet FOLLOW_ID_in_expr402 = new BitSet(new long[]{0x00000000000E1C00L});
848     public static final BitSet FOLLOW_expr_in_expr406 = new BitSet(new long[]{0x0000000000000008L});
849     public static final BitSet FOLLOW_atom_in_expr419 = new BitSet(new long[]{0x0000000000000002L});
850     public static final BitSet FOLLOW_set_in_atom0 = new BitSet(new long[]{0x0000000000000002L});
851 
852 }