Home | History | Annotate | Download | only in simplecTreeParser
      1 /** \file
      2  *  This OBJC source file was generated by $ANTLR version ${project.version} ${buildNumber}
      3  *
      4  *     -  From the grammar source file : SimpleC.g
      5  *     -                            On : 2011-05-06 15:09:17
      6  *     -                for the parser : SimpleCParserParser
      7  *
      8  * Editing it, at least manually, is not wise.
      9  *
     10  * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com.
     11  *
     12  *
     13 */
     14 // $ANTLR ${project.version} ${buildNumber} SimpleC.g 2011-05-06 15:09:17
     15 
     16 
     17 /* -----------------------------------------
     18  * Include the ANTLR3 generated header file.
     19  */
     20 #import "SimpleCParser.h"
     21 /* ----------------------------------------- */
     22 
     23 
     24 /* ============================================================================= */
     25 /* =============================================================================
     26  * Start of recognizer
     27  */
     28 #pragma mark Cyclic DFA implementation start DFA2
     29 @implementation DFA2
     30 const static NSInteger dfa2_eot[13] =
     31     {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
     32 const static NSInteger dfa2_eof[13] =
     33     {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
     34 const static unichar dfa2_min[13] =
     35     {9,14,18,9,0,14,17,10,0,0,9,14,10};
     36 const static unichar dfa2_max[13] =
     37     {24,14,23,24,0,14,23,22,0,0,24,14,22};
     38 const static NSInteger dfa2_accept[13] =
     39     {-1,-1,-1,-1,1,-1,-1,-1,2,3,-1,-1,-1};
     40 const static NSInteger dfa2_special[13] =
     41     {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
     42 const static NSInteger dfa2_transition[] = {};
     43 const static NSInteger dfa2_transition0[] = {9, -1, -1, -1, -1, -1, 8};
     44 const static NSInteger dfa2_transition1[] = {10, -1, -1, -1, -1, -1, -1,
     45  -1, -1, -1, -1, -1, 6};
     46 const static NSInteger dfa2_transition2[] = {5, -1, -1, -1, -1, 5, -1, 5,
     47  -1, -1, -1, -1, -1, 6, -1, 5};
     48 const static NSInteger dfa2_transition3[] = {11, -1, -1, -1, -1, 11, -1,
     49  11, -1, -1, -1, -1, -1, -1, -1, 11};
     50 const static NSInteger dfa2_transition4[] = {3, -1, -1, -1, -1, 4};
     51 const static NSInteger dfa2_transition5[] = {1, -1, -1, -1, -1, 1, -1, 1,
     52  -1, -1, -1, -1, -1, -1, -1, 1};
     53 const static NSInteger dfa2_transition6[] = {7};
     54 const static NSInteger dfa2_transition7[] = {12};
     55 const static NSInteger dfa2_transition8[] = {2};
     56 
     57 
     58 + (id) newDFA2WithRecognizer:(ANTLRBaseRecognizer *)aRecognizer
     59 {
     60     return [[[DFA2 alloc] initWithRecognizer:aRecognizer] retain];
     61 }
     62 
     63 - (id) initWithRecognizer:(ANTLRBaseRecognizer *) theRecognizer
     64 {
     65     self = [super initWithRecognizer:theRecognizer];
     66     if ( self != nil ) {
     67         decisionNumber = 2;
     68         eot = dfa2_eot;
     69         eof = dfa2_eof;
     70         min = dfa2_min;
     71         max = dfa2_max;
     72         accept = dfa2_accept;
     73         special = dfa2_special;
     74         if (!(transition = calloc(13, sizeof(void*)))) {
     75             [self release];
     76             return nil;
     77         }
     78         len = 13;
     79         transition[0] = dfa2_transition5;
     80         transition[1] = dfa2_transition8;
     81         transition[2] = dfa2_transition4;
     82         transition[3] = dfa2_transition2;
     83 
     84         transition[4] = dfa2_transition6;
     85         transition[5] = dfa2_transition0;
     86         transition[6] = dfa2_transition1;
     87 
     88 
     89         transition[7] = dfa2_transition3;
     90         transition[8] = dfa2_transition7;
     91         transition[9] = dfa2_transition1;
     92     }
     93     return self;
     94 }
     95 
     96 - (void) dealloc
     97 {
     98     free(transition);
     99     [super dealloc];
    100 }
    101 
    102 - (NSString *) description
    103 {
    104     return @"20:1: declaration : ( variable | functionHeader K_SEMICOLON -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) );";
    105 }
    106 
    107 
    108 @end /* end DFA2 implementation */
    109 
    110 #pragma mark Cyclic DFA implementation end DFA2
    111 
    112 
    113 
    114 #pragma mark Bitsets
    115 static ANTLRBitSet *FOLLOW_declaration_in_program85;
    116 static const unsigned long long FOLLOW_declaration_in_program85_data[] = { 0x0000000001014202LL};
    117 static ANTLRBitSet *FOLLOW_variable_in_declaration105;
    118 static const unsigned long long FOLLOW_variable_in_declaration105_data[] = { 0x0000000000000002LL};
    119 static ANTLRBitSet *FOLLOW_functionHeader_in_declaration115;
    120 static const unsigned long long FOLLOW_functionHeader_in_declaration115_data[] = { 0x0000000000800000LL};
    121 static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_declaration117;
    122 static const unsigned long long FOLLOW_K_SEMICOLON_in_declaration117_data[] = { 0x0000000000000002LL};
    123 static ANTLRBitSet *FOLLOW_functionHeader_in_declaration135;
    124 static const unsigned long long FOLLOW_functionHeader_in_declaration135_data[] = { 0x0000000000020000LL};
    125 static ANTLRBitSet *FOLLOW_block_in_declaration137;
    126 static const unsigned long long FOLLOW_block_in_declaration137_data[] = { 0x0000000000000002LL};
    127 static ANTLRBitSet *FOLLOW_type_in_variable166;
    128 static const unsigned long long FOLLOW_type_in_variable166_data[] = { 0x0000000000004000LL};
    129 static ANTLRBitSet *FOLLOW_declarator_in_variable168;
    130 static const unsigned long long FOLLOW_declarator_in_variable168_data[] = { 0x0000000000800000LL};
    131 static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_variable170;
    132 static const unsigned long long FOLLOW_K_SEMICOLON_in_variable170_data[] = { 0x0000000000000002LL};
    133 static ANTLRBitSet *FOLLOW_K_ID_in_declarator199;
    134 static const unsigned long long FOLLOW_K_ID_in_declarator199_data[] = { 0x0000000000000002LL};
    135 static ANTLRBitSet *FOLLOW_type_in_functionHeader219;
    136 static const unsigned long long FOLLOW_type_in_functionHeader219_data[] = { 0x0000000000004000LL};
    137 static ANTLRBitSet *FOLLOW_K_ID_in_functionHeader221;
    138 static const unsigned long long FOLLOW_K_ID_in_functionHeader221_data[] = { 0x0000000000040000LL};
    139 static ANTLRBitSet *FOLLOW_K_LCURVE_in_functionHeader223;
    140 static const unsigned long long FOLLOW_K_LCURVE_in_functionHeader223_data[] = { 0x0000000001414200LL};
    141 static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader227;
    142 static const unsigned long long FOLLOW_formalParameter_in_functionHeader227_data[] = { 0x0000000000400400LL};
    143 static ANTLRBitSet *FOLLOW_K_COMMA_in_functionHeader231;
    144 static const unsigned long long FOLLOW_K_COMMA_in_functionHeader231_data[] = { 0x0000000001014200LL};
    145 static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader233;
    146 static const unsigned long long FOLLOW_formalParameter_in_functionHeader233_data[] = { 0x0000000000400400LL};
    147 static ANTLRBitSet *FOLLOW_K_RCURVE_in_functionHeader241;
    148 static const unsigned long long FOLLOW_K_RCURVE_in_functionHeader241_data[] = { 0x0000000000000002LL};
    149 static ANTLRBitSet *FOLLOW_type_in_formalParameter281;
    150 static const unsigned long long FOLLOW_type_in_formalParameter281_data[] = { 0x0000000000004000LL};
    151 static ANTLRBitSet *FOLLOW_declarator_in_formalParameter283;
    152 static const unsigned long long FOLLOW_declarator_in_formalParameter283_data[] = { 0x0000000000000002LL};
    153 static ANTLRBitSet *FOLLOW_K_LCURLY_in_block376;
    154 static const unsigned long long FOLLOW_K_LCURLY_in_block376_data[] = { 0x0000000001A7E200LL};
    155 static ANTLRBitSet *FOLLOW_variable_in_block390;
    156 static const unsigned long long FOLLOW_variable_in_block390_data[] = { 0x0000000001A7E200LL};
    157 static ANTLRBitSet *FOLLOW_stat_in_block405;
    158 static const unsigned long long FOLLOW_stat_in_block405_data[] = { 0x0000000000A6E000LL};
    159 static ANTLRBitSet *FOLLOW_K_RCURLY_in_block416;
    160 static const unsigned long long FOLLOW_K_RCURLY_in_block416_data[] = { 0x0000000000000002LL};
    161 static ANTLRBitSet *FOLLOW_forStat_in_stat449;
    162 static const unsigned long long FOLLOW_forStat_in_stat449_data[] = { 0x0000000000000002LL};
    163 static ANTLRBitSet *FOLLOW_expr_in_stat457;
    164 static const unsigned long long FOLLOW_expr_in_stat457_data[] = { 0x0000000000800000LL};
    165 static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_stat459;
    166 static const unsigned long long FOLLOW_K_SEMICOLON_in_stat459_data[] = { 0x0000000000000002LL};
    167 static ANTLRBitSet *FOLLOW_block_in_stat468;
    168 static const unsigned long long FOLLOW_block_in_stat468_data[] = { 0x0000000000000002LL};
    169 static ANTLRBitSet *FOLLOW_assignStat_in_stat476;
    170 static const unsigned long long FOLLOW_assignStat_in_stat476_data[] = { 0x0000000000800000LL};
    171 static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_stat478;
    172 static const unsigned long long FOLLOW_K_SEMICOLON_in_stat478_data[] = { 0x0000000000000002LL};
    173 static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_stat487;
    174 static const unsigned long long FOLLOW_K_SEMICOLON_in_stat487_data[] = { 0x0000000000000002LL};
    175 static ANTLRBitSet *FOLLOW_K_FOR_in_forStat507;
    176 static const unsigned long long FOLLOW_K_FOR_in_forStat507_data[] = { 0x0000000000040000LL};
    177 static ANTLRBitSet *FOLLOW_K_LCURVE_in_forStat509;
    178 static const unsigned long long FOLLOW_K_LCURVE_in_forStat509_data[] = { 0x0000000000004000LL};
    179 static ANTLRBitSet *FOLLOW_assignStat_in_forStat513;
    180 static const unsigned long long FOLLOW_assignStat_in_forStat513_data[] = { 0x0000000000800000LL};
    181 static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_forStat515;
    182 static const unsigned long long FOLLOW_K_SEMICOLON_in_forStat515_data[] = { 0x000000000004C000LL};
    183 static ANTLRBitSet *FOLLOW_expr_in_forStat517;
    184 static const unsigned long long FOLLOW_expr_in_forStat517_data[] = { 0x0000000000800000LL};
    185 static ANTLRBitSet *FOLLOW_K_SEMICOLON_in_forStat519;
    186 static const unsigned long long FOLLOW_K_SEMICOLON_in_forStat519_data[] = { 0x0000000000004000LL};
    187 static ANTLRBitSet *FOLLOW_assignStat_in_forStat523;
    188 static const unsigned long long FOLLOW_assignStat_in_forStat523_data[] = { 0x0000000000400000LL};
    189 static ANTLRBitSet *FOLLOW_K_RCURVE_in_forStat525;
    190 static const unsigned long long FOLLOW_K_RCURVE_in_forStat525_data[] = { 0x0000000000020000LL};
    191 static ANTLRBitSet *FOLLOW_block_in_forStat527;
    192 static const unsigned long long FOLLOW_block_in_forStat527_data[] = { 0x0000000000000002LL};
    193 static ANTLRBitSet *FOLLOW_K_ID_in_assignStat570;
    194 static const unsigned long long FOLLOW_K_ID_in_assignStat570_data[] = { 0x0000000000000800LL};
    195 static ANTLRBitSet *FOLLOW_K_EQ_in_assignStat572;
    196 static const unsigned long long FOLLOW_K_EQ_in_assignStat572_data[] = { 0x000000000004C000LL};
    197 static ANTLRBitSet *FOLLOW_expr_in_assignStat574;
    198 static const unsigned long long FOLLOW_expr_in_assignStat574_data[] = { 0x0000000000000002LL};
    199 static ANTLRBitSet *FOLLOW_condExpr_in_expr598;
    200 static const unsigned long long FOLLOW_condExpr_in_expr598_data[] = { 0x0000000000000002LL};
    201 static ANTLRBitSet *FOLLOW_aexpr_in_condExpr617;
    202 static const unsigned long long FOLLOW_aexpr_in_condExpr617_data[] = { 0x0000000000081002LL};
    203 static ANTLRBitSet *FOLLOW_K_EQEQ_in_condExpr622;
    204 static const unsigned long long FOLLOW_K_EQEQ_in_condExpr622_data[] = { 0x000000000004C000LL};
    205 static ANTLRBitSet *FOLLOW_K_LT_in_condExpr627;
    206 static const unsigned long long FOLLOW_K_LT_in_condExpr627_data[] = { 0x000000000004C000LL};
    207 static ANTLRBitSet *FOLLOW_aexpr_in_condExpr631;
    208 static const unsigned long long FOLLOW_aexpr_in_condExpr631_data[] = { 0x0000000000000002LL};
    209 static ANTLRBitSet *FOLLOW_atom_in_aexpr653;
    210 static const unsigned long long FOLLOW_atom_in_aexpr653_data[] = { 0x0000000000100002LL};
    211 static ANTLRBitSet *FOLLOW_K_PLUS_in_aexpr657;
    212 static const unsigned long long FOLLOW_K_PLUS_in_aexpr657_data[] = { 0x000000000004C000LL};
    213 static ANTLRBitSet *FOLLOW_atom_in_aexpr660;
    214 static const unsigned long long FOLLOW_atom_in_aexpr660_data[] = { 0x0000000000100002LL};
    215 static ANTLRBitSet *FOLLOW_K_ID_in_atom680;
    216 static const unsigned long long FOLLOW_K_ID_in_atom680_data[] = { 0x0000000000000002LL};
    217 static ANTLRBitSet *FOLLOW_K_INT_in_atom694;
    218 static const unsigned long long FOLLOW_K_INT_in_atom694_data[] = { 0x0000000000000002LL};
    219 static ANTLRBitSet *FOLLOW_K_LCURVE_in_atom708;
    220 static const unsigned long long FOLLOW_K_LCURVE_in_atom708_data[] = { 0x000000000004C000LL};
    221 static ANTLRBitSet *FOLLOW_expr_in_atom710;
    222 static const unsigned long long FOLLOW_expr_in_atom710_data[] = { 0x0000000000400000LL};
    223 static ANTLRBitSet *FOLLOW_K_RCURVE_in_atom712;
    224 static const unsigned long long FOLLOW_K_RCURVE_in_atom712_data[] = { 0x0000000000000002LL};
    225 
    226 
    227 #pragma mark Dynamic Global Scopes
    228 
    229 #pragma mark Dynamic Rule Scopes
    230 
    231 #pragma mark Rule Return Scopes start
    232 @implementation SimpleCParser_program_return /* returnScope */
    233 /* AST returnScope.synthesize */
    234 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    235 + (SimpleCParser_program_return *)newSimpleCParser_program_return
    236 {
    237     return [[[SimpleCParser_program_return alloc] init] retain];
    238 }
    239 
    240 - (id) init
    241 {
    242     self = [super init];
    243     return self;
    244 }
    245 
    246 /* AST returnScope.methods */
    247 - (ANTLRCommonTree *)getTree
    248 {
    249     return tree;
    250 }
    251 
    252 - (void) setTree:(ANTLRCommonTree *)aTree
    253 {
    254     if (tree != aTree) {
    255         if (tree != nil) [tree release];
    256         if (aTree != nil) [aTree retain];
    257         tree = aTree;
    258     }
    259 }
    260 
    261 - (void) dealloc
    262 {
    263     self.tree = nil;
    264     [super dealloc];
    265 }
    266 
    267 
    268 
    269 @end /* end of returnScope implementation */
    270 
    271 
    272 @implementation SimpleCParser_declaration_return /* returnScope */
    273 /* AST returnScope.synthesize */
    274 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    275 + (SimpleCParser_declaration_return *)newSimpleCParser_declaration_return
    276 {
    277     return [[[SimpleCParser_declaration_return alloc] init] retain];
    278 }
    279 
    280 - (id) init
    281 {
    282     self = [super init];
    283     return self;
    284 }
    285 
    286 /* AST returnScope.methods */
    287 - (ANTLRCommonTree *)getTree
    288 {
    289     return tree;
    290 }
    291 
    292 - (void) setTree:(ANTLRCommonTree *)aTree
    293 {
    294     if (tree != aTree) {
    295         if (tree != nil) [tree release];
    296         if (aTree != nil) [aTree retain];
    297         tree = aTree;
    298     }
    299 }
    300 
    301 - (void) dealloc
    302 {
    303     self.tree = nil;
    304     [super dealloc];
    305 }
    306 
    307 
    308 
    309 @end /* end of returnScope implementation */
    310 
    311 
    312 @implementation SimpleCParser_variable_return /* returnScope */
    313 /* AST returnScope.synthesize */
    314 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    315 + (SimpleCParser_variable_return *)newSimpleCParser_variable_return
    316 {
    317     return [[[SimpleCParser_variable_return alloc] init] retain];
    318 }
    319 
    320 - (id) init
    321 {
    322     self = [super init];
    323     return self;
    324 }
    325 
    326 /* AST returnScope.methods */
    327 - (ANTLRCommonTree *)getTree
    328 {
    329     return tree;
    330 }
    331 
    332 - (void) setTree:(ANTLRCommonTree *)aTree
    333 {
    334     if (tree != aTree) {
    335         if (tree != nil) [tree release];
    336         if (aTree != nil) [aTree retain];
    337         tree = aTree;
    338     }
    339 }
    340 
    341 - (void) dealloc
    342 {
    343     self.tree = nil;
    344     [super dealloc];
    345 }
    346 
    347 
    348 
    349 @end /* end of returnScope implementation */
    350 
    351 
    352 @implementation SimpleCParser_declarator_return /* returnScope */
    353 /* AST returnScope.synthesize */
    354 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    355 + (SimpleCParser_declarator_return *)newSimpleCParser_declarator_return
    356 {
    357     return [[[SimpleCParser_declarator_return alloc] init] retain];
    358 }
    359 
    360 - (id) init
    361 {
    362     self = [super init];
    363     return self;
    364 }
    365 
    366 /* AST returnScope.methods */
    367 - (ANTLRCommonTree *)getTree
    368 {
    369     return tree;
    370 }
    371 
    372 - (void) setTree:(ANTLRCommonTree *)aTree
    373 {
    374     if (tree != aTree) {
    375         if (tree != nil) [tree release];
    376         if (aTree != nil) [aTree retain];
    377         tree = aTree;
    378     }
    379 }
    380 
    381 - (void) dealloc
    382 {
    383     self.tree = nil;
    384     [super dealloc];
    385 }
    386 
    387 
    388 
    389 @end /* end of returnScope implementation */
    390 
    391 
    392 @implementation SimpleCParser_functionHeader_return /* returnScope */
    393 /* AST returnScope.synthesize */
    394 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    395 + (SimpleCParser_functionHeader_return *)newSimpleCParser_functionHeader_return
    396 {
    397     return [[[SimpleCParser_functionHeader_return alloc] init] retain];
    398 }
    399 
    400 - (id) init
    401 {
    402     self = [super init];
    403     return self;
    404 }
    405 
    406 /* AST returnScope.methods */
    407 - (ANTLRCommonTree *)getTree
    408 {
    409     return tree;
    410 }
    411 
    412 - (void) setTree:(ANTLRCommonTree *)aTree
    413 {
    414     if (tree != aTree) {
    415         if (tree != nil) [tree release];
    416         if (aTree != nil) [aTree retain];
    417         tree = aTree;
    418     }
    419 }
    420 
    421 - (void) dealloc
    422 {
    423     self.tree = nil;
    424     [super dealloc];
    425 }
    426 
    427 
    428 
    429 @end /* end of returnScope implementation */
    430 
    431 
    432 @implementation SimpleCParser_formalParameter_return /* returnScope */
    433 /* AST returnScope.synthesize */
    434 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    435 + (SimpleCParser_formalParameter_return *)newSimpleCParser_formalParameter_return
    436 {
    437     return [[[SimpleCParser_formalParameter_return alloc] init] retain];
    438 }
    439 
    440 - (id) init
    441 {
    442     self = [super init];
    443     return self;
    444 }
    445 
    446 /* AST returnScope.methods */
    447 - (ANTLRCommonTree *)getTree
    448 {
    449     return tree;
    450 }
    451 
    452 - (void) setTree:(ANTLRCommonTree *)aTree
    453 {
    454     if (tree != aTree) {
    455         if (tree != nil) [tree release];
    456         if (aTree != nil) [aTree retain];
    457         tree = aTree;
    458     }
    459 }
    460 
    461 - (void) dealloc
    462 {
    463     self.tree = nil;
    464     [super dealloc];
    465 }
    466 
    467 
    468 
    469 @end /* end of returnScope implementation */
    470 
    471 
    472 @implementation SimpleCParser_type_return /* returnScope */
    473 /* AST returnScope.synthesize */
    474 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    475 + (SimpleCParser_type_return *)newSimpleCParser_type_return
    476 {
    477     return [[[SimpleCParser_type_return alloc] init] retain];
    478 }
    479 
    480 - (id) init
    481 {
    482     self = [super init];
    483     return self;
    484 }
    485 
    486 /* AST returnScope.methods */
    487 - (ANTLRCommonTree *)getTree
    488 {
    489     return tree;
    490 }
    491 
    492 - (void) setTree:(ANTLRCommonTree *)aTree
    493 {
    494     if (tree != aTree) {
    495         if (tree != nil) [tree release];
    496         if (aTree != nil) [aTree retain];
    497         tree = aTree;
    498     }
    499 }
    500 
    501 - (void) dealloc
    502 {
    503     self.tree = nil;
    504     [super dealloc];
    505 }
    506 
    507 
    508 
    509 @end /* end of returnScope implementation */
    510 
    511 
    512 @implementation SimpleCParser_block_return /* returnScope */
    513 /* AST returnScope.synthesize */
    514 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    515 + (SimpleCParser_block_return *)newSimpleCParser_block_return
    516 {
    517     return [[[SimpleCParser_block_return alloc] init] retain];
    518 }
    519 
    520 - (id) init
    521 {
    522     self = [super init];
    523     return self;
    524 }
    525 
    526 /* AST returnScope.methods */
    527 - (ANTLRCommonTree *)getTree
    528 {
    529     return tree;
    530 }
    531 
    532 - (void) setTree:(ANTLRCommonTree *)aTree
    533 {
    534     if (tree != aTree) {
    535         if (tree != nil) [tree release];
    536         if (aTree != nil) [aTree retain];
    537         tree = aTree;
    538     }
    539 }
    540 
    541 - (void) dealloc
    542 {
    543     self.tree = nil;
    544     [super dealloc];
    545 }
    546 
    547 
    548 
    549 @end /* end of returnScope implementation */
    550 
    551 
    552 @implementation SimpleCParser_stat_return /* returnScope */
    553 /* AST returnScope.synthesize */
    554 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    555 + (SimpleCParser_stat_return *)newSimpleCParser_stat_return
    556 {
    557     return [[[SimpleCParser_stat_return alloc] init] retain];
    558 }
    559 
    560 - (id) init
    561 {
    562     self = [super init];
    563     return self;
    564 }
    565 
    566 /* AST returnScope.methods */
    567 - (ANTLRCommonTree *)getTree
    568 {
    569     return tree;
    570 }
    571 
    572 - (void) setTree:(ANTLRCommonTree *)aTree
    573 {
    574     if (tree != aTree) {
    575         if (tree != nil) [tree release];
    576         if (aTree != nil) [aTree retain];
    577         tree = aTree;
    578     }
    579 }
    580 
    581 - (void) dealloc
    582 {
    583     self.tree = nil;
    584     [super dealloc];
    585 }
    586 
    587 
    588 
    589 @end /* end of returnScope implementation */
    590 
    591 
    592 @implementation SimpleCParser_forStat_return /* returnScope */
    593 /* AST returnScope.synthesize */
    594 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    595 + (SimpleCParser_forStat_return *)newSimpleCParser_forStat_return
    596 {
    597     return [[[SimpleCParser_forStat_return alloc] init] retain];
    598 }
    599 
    600 - (id) init
    601 {
    602     self = [super init];
    603     return self;
    604 }
    605 
    606 /* AST returnScope.methods */
    607 - (ANTLRCommonTree *)getTree
    608 {
    609     return tree;
    610 }
    611 
    612 - (void) setTree:(ANTLRCommonTree *)aTree
    613 {
    614     if (tree != aTree) {
    615         if (tree != nil) [tree release];
    616         if (aTree != nil) [aTree retain];
    617         tree = aTree;
    618     }
    619 }
    620 
    621 - (void) dealloc
    622 {
    623     self.tree = nil;
    624     [super dealloc];
    625 }
    626 
    627 
    628 
    629 @end /* end of returnScope implementation */
    630 
    631 
    632 @implementation SimpleCParser_assignStat_return /* returnScope */
    633 /* AST returnScope.synthesize */
    634 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    635 + (SimpleCParser_assignStat_return *)newSimpleCParser_assignStat_return
    636 {
    637     return [[[SimpleCParser_assignStat_return alloc] init] retain];
    638 }
    639 
    640 - (id) init
    641 {
    642     self = [super init];
    643     return self;
    644 }
    645 
    646 /* AST returnScope.methods */
    647 - (ANTLRCommonTree *)getTree
    648 {
    649     return tree;
    650 }
    651 
    652 - (void) setTree:(ANTLRCommonTree *)aTree
    653 {
    654     if (tree != aTree) {
    655         if (tree != nil) [tree release];
    656         if (aTree != nil) [aTree retain];
    657         tree = aTree;
    658     }
    659 }
    660 
    661 - (void) dealloc
    662 {
    663     self.tree = nil;
    664     [super dealloc];
    665 }
    666 
    667 
    668 
    669 @end /* end of returnScope implementation */
    670 
    671 
    672 @implementation SimpleCParser_expr_return /* returnScope */
    673 /* AST returnScope.synthesize */
    674 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    675 + (SimpleCParser_expr_return *)newSimpleCParser_expr_return
    676 {
    677     return [[[SimpleCParser_expr_return alloc] init] retain];
    678 }
    679 
    680 - (id) init
    681 {
    682     self = [super init];
    683     return self;
    684 }
    685 
    686 /* AST returnScope.methods */
    687 - (ANTLRCommonTree *)getTree
    688 {
    689     return tree;
    690 }
    691 
    692 - (void) setTree:(ANTLRCommonTree *)aTree
    693 {
    694     if (tree != aTree) {
    695         if (tree != nil) [tree release];
    696         if (aTree != nil) [aTree retain];
    697         tree = aTree;
    698     }
    699 }
    700 
    701 - (void) dealloc
    702 {
    703     self.tree = nil;
    704     [super dealloc];
    705 }
    706 
    707 
    708 
    709 @end /* end of returnScope implementation */
    710 
    711 
    712 @implementation SimpleCParser_condExpr_return /* returnScope */
    713 /* AST returnScope.synthesize */
    714 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    715 + (SimpleCParser_condExpr_return *)newSimpleCParser_condExpr_return
    716 {
    717     return [[[SimpleCParser_condExpr_return alloc] init] retain];
    718 }
    719 
    720 - (id) init
    721 {
    722     self = [super init];
    723     return self;
    724 }
    725 
    726 /* AST returnScope.methods */
    727 - (ANTLRCommonTree *)getTree
    728 {
    729     return tree;
    730 }
    731 
    732 - (void) setTree:(ANTLRCommonTree *)aTree
    733 {
    734     if (tree != aTree) {
    735         if (tree != nil) [tree release];
    736         if (aTree != nil) [aTree retain];
    737         tree = aTree;
    738     }
    739 }
    740 
    741 - (void) dealloc
    742 {
    743     self.tree = nil;
    744     [super dealloc];
    745 }
    746 
    747 
    748 
    749 @end /* end of returnScope implementation */
    750 
    751 
    752 @implementation SimpleCParser_aexpr_return /* returnScope */
    753 /* AST returnScope.synthesize */
    754 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    755 + (SimpleCParser_aexpr_return *)newSimpleCParser_aexpr_return
    756 {
    757     return [[[SimpleCParser_aexpr_return alloc] init] retain];
    758 }
    759 
    760 - (id) init
    761 {
    762     self = [super init];
    763     return self;
    764 }
    765 
    766 /* AST returnScope.methods */
    767 - (ANTLRCommonTree *)getTree
    768 {
    769     return tree;
    770 }
    771 
    772 - (void) setTree:(ANTLRCommonTree *)aTree
    773 {
    774     if (tree != aTree) {
    775         if (tree != nil) [tree release];
    776         if (aTree != nil) [aTree retain];
    777         tree = aTree;
    778     }
    779 }
    780 
    781 - (void) dealloc
    782 {
    783     self.tree = nil;
    784     [super dealloc];
    785 }
    786 
    787 
    788 
    789 @end /* end of returnScope implementation */
    790 
    791 
    792 @implementation SimpleCParser_atom_return /* returnScope */
    793 /* AST returnScope.synthesize */
    794 @synthesize tree; /* start of synthesize -- OBJC-Line 1837 */
    795 + (SimpleCParser_atom_return *)newSimpleCParser_atom_return
    796 {
    797     return [[[SimpleCParser_atom_return alloc] init] retain];
    798 }
    799 
    800 - (id) init
    801 {
    802     self = [super init];
    803     return self;
    804 }
    805 
    806 /* AST returnScope.methods */
    807 - (ANTLRCommonTree *)getTree
    808 {
    809     return tree;
    810 }
    811 
    812 - (void) setTree:(ANTLRCommonTree *)aTree
    813 {
    814     if (tree != aTree) {
    815         if (tree != nil) [tree release];
    816         if (aTree != nil) [aTree retain];
    817         tree = aTree;
    818     }
    819 }
    820 
    821 - (void) dealloc
    822 {
    823     self.tree = nil;
    824     [super dealloc];
    825 }
    826 
    827 
    828 
    829 @end /* end of returnScope implementation */
    830 
    831 
    832 //#pragma mark Rule return scopes start
    833 //
    834 
    835 #pragma mark Rule return scopes start
    836 
    837 @implementation SimpleCParser  // line 637
    838 
    839 /* ObjC start of ruleAttributeScope */
    840 #pragma mark Dynamic Rule Scopes
    841 /* ObjC end of ruleAttributeScope */
    842 #pragma mark global Attribute Scopes
    843 /* ObjC start globalAttributeScope */
    844 /* ObjC end globalAttributeScope */
    845 /* ObjC start actions.(actionScope).synthesize */
    846 /* ObjC end actions.(actionScope).synthesize */
    847 /* ObjC start synthesize() */
    848 /* AST genericParser.synthesize */
    849 /* AST parserProperties */
    850 @synthesize treeAdaptor;
    851 /* ObjC end synthesize() */
    852 
    853 + (void) initialize
    854 {
    855     #pragma mark Bitsets
    856     FOLLOW_declaration_in_program85 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program85_data Count:(NSUInteger)1] retain];
    857     FOLLOW_variable_in_declaration105 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration105_data Count:(NSUInteger)1] retain];
    858     FOLLOW_functionHeader_in_declaration115 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration115_data Count:(NSUInteger)1] retain];
    859     FOLLOW_K_SEMICOLON_in_declaration117 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_in_declaration117_data Count:(NSUInteger)1] retain];
    860     FOLLOW_functionHeader_in_declaration135 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration135_data Count:(NSUInteger)1] retain];
    861     FOLLOW_block_in_declaration137 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration137_data Count:(NSUInteger)1] retain];
    862     FOLLOW_type_in_variable166 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable166_data Count:(NSUInteger)1] retain];
    863     FOLLOW_declarator_in_variable168 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable168_data Count:(NSUInteger)1] retain];
    864     FOLLOW_K_SEMICOLON_in_variable170 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_in_variable170_data Count:(NSUInteger)1] retain];
    865     FOLLOW_K_ID_in_declarator199 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_declarator199_data Count:(NSUInteger)1] retain];
    866     FOLLOW_type_in_functionHeader219 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader219_data Count:(NSUInteger)1] retain];
    867     FOLLOW_K_ID_in_functionHeader221 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_functionHeader221_data Count:(NSUInteger)1] retain];
    868     FOLLOW_K_LCURVE_in_functionHeader223 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LCURVE_in_functionHeader223_data Count:(NSUInteger)1] retain];
    869     FOLLOW_formalParameter_in_functionHeader227 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader227_data Count:(NSUInteger)1] retain];
    870     FOLLOW_K_COMMA_in_functionHeader231 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_COMMA_in_functionHeader231_data Count:(NSUInteger)1] retain];
    871     FOLLOW_formalParameter_in_functionHeader233 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader233_data Count:(NSUInteger)1] retain];
    872     FOLLOW_K_RCURVE_in_functionHeader241 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_RCURVE_in_functionHeader241_data Count:(NSUInteger)1] retain];
    873     FOLLOW_type_in_formalParameter281 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter281_data Count:(NSUInteger)1] retain];
    874     FOLLOW_declarator_in_formalParameter283 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter283_data Count:(NSUInteger)1] retain];
    875     FOLLOW_K_LCURLY_in_block376 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LCURLY_in_block376_data Count:(NSUInteger)1] retain];
    876     FOLLOW_variable_in_block390 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block390_data Count:(NSUInteger)1] retain];
    877     FOLLOW_stat_in_block405 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block405_data Count:(NSUInteger)1] retain];
    878     FOLLOW_K_RCURLY_in_block416 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_RCURLY_in_block416_data Count:(NSUInteger)1] retain];
    879     FOLLOW_forStat_in_stat449 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat449_data Count:(NSUInteger)1] retain];
    880     FOLLOW_expr_in_stat457 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat457_data Count:(NSUInteger)1] retain];
    881     FOLLOW_K_SEMICOLON_in_stat459 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_in_stat459_data Count:(NSUInteger)1] retain];
    882     FOLLOW_block_in_stat468 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat468_data Count:(NSUInteger)1] retain];
    883     FOLLOW_assignStat_in_stat476 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_stat476_data Count:(NSUInteger)1] retain];
    884     FOLLOW_K_SEMICOLON_in_stat478 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_in_stat478_data Count:(NSUInteger)1] retain];
    885     FOLLOW_K_SEMICOLON_in_stat487 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_in_stat487_data Count:(NSUInteger)1] retain];
    886     FOLLOW_K_FOR_in_forStat507 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_FOR_in_forStat507_data Count:(NSUInteger)1] retain];
    887     FOLLOW_K_LCURVE_in_forStat509 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LCURVE_in_forStat509_data Count:(NSUInteger)1] retain];
    888     FOLLOW_assignStat_in_forStat513 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat513_data Count:(NSUInteger)1] retain];
    889     FOLLOW_K_SEMICOLON_in_forStat515 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_in_forStat515_data Count:(NSUInteger)1] retain];
    890     FOLLOW_expr_in_forStat517 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat517_data Count:(NSUInteger)1] retain];
    891     FOLLOW_K_SEMICOLON_in_forStat519 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_SEMICOLON_in_forStat519_data Count:(NSUInteger)1] retain];
    892     FOLLOW_assignStat_in_forStat523 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat523_data Count:(NSUInteger)1] retain];
    893     FOLLOW_K_RCURVE_in_forStat525 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_RCURVE_in_forStat525_data Count:(NSUInteger)1] retain];
    894     FOLLOW_block_in_forStat527 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat527_data Count:(NSUInteger)1] retain];
    895     FOLLOW_K_ID_in_assignStat570 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_assignStat570_data Count:(NSUInteger)1] retain];
    896     FOLLOW_K_EQ_in_assignStat572 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQ_in_assignStat572_data Count:(NSUInteger)1] retain];
    897     FOLLOW_expr_in_assignStat574 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_assignStat574_data Count:(NSUInteger)1] retain];
    898     FOLLOW_condExpr_in_expr598 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_condExpr_in_expr598_data Count:(NSUInteger)1] retain];
    899     FOLLOW_aexpr_in_condExpr617 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr617_data Count:(NSUInteger)1] retain];
    900     FOLLOW_K_EQEQ_in_condExpr622 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_EQEQ_in_condExpr622_data Count:(NSUInteger)1] retain];
    901     FOLLOW_K_LT_in_condExpr627 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LT_in_condExpr627_data Count:(NSUInteger)1] retain];
    902     FOLLOW_aexpr_in_condExpr631 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr631_data Count:(NSUInteger)1] retain];
    903     FOLLOW_atom_in_aexpr653 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr653_data Count:(NSUInteger)1] retain];
    904     FOLLOW_K_PLUS_in_aexpr657 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_PLUS_in_aexpr657_data Count:(NSUInteger)1] retain];
    905     FOLLOW_atom_in_aexpr660 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr660_data Count:(NSUInteger)1] retain];
    906     FOLLOW_K_ID_in_atom680 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_ID_in_atom680_data Count:(NSUInteger)1] retain];
    907     FOLLOW_K_INT_in_atom694 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_INT_in_atom694_data Count:(NSUInteger)1] retain];
    908     FOLLOW_K_LCURVE_in_atom708 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_LCURVE_in_atom708_data Count:(NSUInteger)1] retain];
    909     FOLLOW_expr_in_atom710 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_atom710_data Count:(NSUInteger)1] retain];
    910     FOLLOW_K_RCURVE_in_atom712 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_K_RCURVE_in_atom712_data Count:(NSUInteger)1] retain];
    911 
    912     [ANTLRBaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
    913  @"ARG_DEF", @"BLOCK", @"FUNC_DECL", @"FUNC_DEF", @"FUNC_HDR", @"K_CHAR",
    914  @"K_COMMA", @"K_EQ", @"K_EQEQ", @"K_FOR", @"K_ID", @"K_INT", @"K_INT_TYPE",
    915  @"K_LCURLY", @"K_LCURVE", @"K_LT", @"K_PLUS", @"K_RCURLY", @"K_RCURVE",
    916  @"K_SEMICOLON", @"K_VOID", @"VAR_DEF", @"WS", nil] retain]];
    917     [ANTLRBaseRecognizer setGrammarFileName:@"SimpleC.g"];
    918 }
    919 
    920 + (SimpleCParser *)newSimpleCParser:(id<ANTLRTokenStream>)aStream
    921 {
    922     return [[SimpleCParser alloc] initWithTokenStream:aStream];
    923 
    924 
    925 }
    926 
    927 - (id) initWithTokenStream:(id<ANTLRTokenStream>)aStream
    928 {
    929     self = [super initWithTokenStream:aStream State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:15+1] retain]];
    930     if ( self != nil ) {
    931 
    932 
    933         dfa2 = [DFA2 newDFA2WithRecognizer:self];
    934         /* start of actions-actionScope-init */
    935         /* start of init */
    936         /* AST genericParser.init */
    937         [self setTreeAdaptor:[[ANTLRCommonTreeAdaptor newTreeAdaptor] retain]];
    938     }
    939     return self;
    940 }
    941 
    942 - (void) dealloc
    943 {
    944     [dfa2 release];
    945     /* AST genericParser.dealloc */
    946     [self setTreeAdaptor:nil];
    947 
    948     [super dealloc];
    949 }
    950 
    951 /* ObjC start members */
    952 /* ObjC end members */
    953 /* ObjC start actions.(actionScope).methods */
    954 /* ObjC end actions.(actionScope).methods */
    955 /* ObjC start methods() */
    956 /* AST genericParser.methods */
    957 /* AST parserMethods */
    958 - (id<ANTLRTreeAdaptor>) getTreeAdaptor
    959 {
    960 	return treeAdaptor;
    961 }
    962 
    963 - (void) setTreeAdaptor:(id<ANTLRTreeAdaptor>)aTreeAdaptor
    964 {
    965 	if (aTreeAdaptor != treeAdaptor) {
    966 		treeAdaptor = aTreeAdaptor;
    967 	}
    968 }
    969 /* ObjC end methods() */
    970 /* ObjC start rules */
    971 /*
    972  * $ANTLR start program
    973  * SimpleC.g:16:1: program : ( declaration )+ ;
    974  */
    975 - (SimpleCParser_program_return *) program
    976 {
    977     /* my ruleScopeSetUp */
    978     /* Terence's stuff */
    979 
    980     /* AST ruleDeclarations */
    981     SimpleCParser_program_return * retval = [SimpleCParser_program_return newSimpleCParser_program_return];
    982     [retval setStart:[input LT:1]];
    983 
    984 
    985     ANTLRCommonTree *root_0 = nil;
    986 
    987     @try {
    988         /* AST ruleLabelDefs */
    989          SimpleCParser_declaration_return * declaration1 = nil ;
    990 
    991 
    992 
    993         // SimpleC.g:17:5: ( ( declaration )+ ) // ruleBlockSingleAlt
    994         // SimpleC.g:17:9: ( declaration )+ // alt
    995         {
    996         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
    997 
    998 
    999         // SimpleC.g:17:9: ( declaration )+ // positiveClosureBlock
   1000         NSInteger cnt1 = 0;
   1001         do {
   1002             NSInteger alt1 = 2;
   1003             NSInteger LA1_0 = [input LA:1];
   1004             if ( (LA1_0==K_CHAR||LA1_0==K_ID||LA1_0==K_INT_TYPE||LA1_0==K_VOID) ) {
   1005                 alt1=1;
   1006             }
   1007 
   1008 
   1009             switch (alt1) {
   1010                 case 1 : ;
   1011                     // SimpleC.g:17:9: declaration // alt
   1012                     {
   1013                     /* ASTParser ruleRef */
   1014                     /* ruleRef */
   1015                     [self pushFollow:FOLLOW_declaration_in_program85];
   1016                     declaration1 = [self declaration];
   1017 
   1018                     [self popFollow];
   1019 
   1020 
   1021                     [treeAdaptor addChild:[declaration1 getTree] toTree:root_0];
   1022 
   1023                     }
   1024                     break;
   1025 
   1026                 default :
   1027                     if ( cnt1 >= 1 )
   1028                         goto loop1;
   1029                     ANTLREarlyExitException *eee =
   1030                         [ANTLREarlyExitException newException:input decisionNumber:1];
   1031                     @throw eee;
   1032             }
   1033             cnt1++;
   1034         } while (YES);
   1035         loop1: ;
   1036 
   1037 
   1038         }
   1039 
   1040         /* ASTParser ruleCleanUp */
   1041         /* AST ruleCleanUp */
   1042         // token+rule list labels
   1043         [retval setStop:[input LT:-1]];
   1044 
   1045 
   1046 
   1047             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   1048             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   1049 
   1050     }
   1051     @catch (ANTLRRecognitionException *re) {
   1052         [self reportError:re];
   1053         [self recover:input Exception:re];
   1054         /* ASTParser rule.setErrorReturnValue */
   1055         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   1056 
   1057     }
   1058 
   1059     @finally {
   1060         /* Terence's stuff */
   1061 
   1062     }
   1063     return retval;
   1064 }
   1065 /* $ANTLR end program */
   1066 
   1067 /*
   1068  * $ANTLR start declaration
   1069  * SimpleC.g:20:1: declaration : ( variable | functionHeader K_SEMICOLON -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) );
   1070  */
   1071 - (SimpleCParser_declaration_return *) declaration
   1072 {
   1073     /* my ruleScopeSetUp */
   1074     /* Terence's stuff */
   1075 
   1076     /* AST ruleDeclarations */
   1077     SimpleCParser_declaration_return * retval = [SimpleCParser_declaration_return newSimpleCParser_declaration_return];
   1078     [retval setStart:[input LT:1]];
   1079 
   1080 
   1081     ANTLRCommonTree *root_0 = nil;
   1082 
   1083     @try {
   1084         /* AST ruleLabelDefs */
   1085         ANTLRCommonToken *K_SEMICOLON4 = nil;
   1086          SimpleCParser_variable_return * variable2 = nil ;
   1087 
   1088          SimpleCParser_functionHeader_return * functionHeader3 = nil ;
   1089 
   1090          SimpleCParser_functionHeader_return * functionHeader5 = nil ;
   1091 
   1092          SimpleCParser_block_return * block6 = nil ;
   1093 
   1094 
   1095         ANTLRCommonTree *K_SEMICOLON4_tree=nil;
   1096         ANTLRRewriteRuleTokenStream *stream_K_SEMICOLON =
   1097             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   1098                                                              description:@"token K_SEMICOLON"] retain];
   1099         ANTLRRewriteRuleSubtreeStream *stream_functionHeader =
   1100             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1101                                                                 description:@"rule functionHeader"] retain];
   1102         ANTLRRewriteRuleSubtreeStream *stream_block =
   1103             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1104                                                                 description:@"rule block"] retain];
   1105         // SimpleC.g:21:5: ( variable | functionHeader K_SEMICOLON -> ^( FUNC_DECL functionHeader ) | functionHeader block -> ^( FUNC_DEF functionHeader block ) ) //ruleblock
   1106         NSInteger alt2=3;
   1107         alt2 = [dfa2 predict:input];
   1108         switch (alt2) {
   1109             case 1 : ;
   1110                 // SimpleC.g:21:9: variable // alt
   1111                 {
   1112                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1113 
   1114 
   1115                 /* ASTParser ruleRef */
   1116                 /* ruleRef */
   1117                 [self pushFollow:FOLLOW_variable_in_declaration105];
   1118                 variable2 = [self variable];
   1119 
   1120                 [self popFollow];
   1121 
   1122 
   1123                 [treeAdaptor addChild:[variable2 getTree] toTree:root_0];
   1124 
   1125                 }
   1126                 break;
   1127             case 2 : ;
   1128                 // SimpleC.g:22:9: functionHeader K_SEMICOLON // alt
   1129                 {
   1130                 /* ruleRef */
   1131                 [self pushFollow:FOLLOW_functionHeader_in_declaration115];
   1132                 functionHeader3 = [self functionHeader];
   1133 
   1134                 [self popFollow];
   1135 
   1136 
   1137                 [stream_functionHeader addElement:[functionHeader3 getTree]];
   1138 
   1139                 K_SEMICOLON4=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_declaration117];
   1140                     [stream_K_SEMICOLON addElement:K_SEMICOLON4];
   1141 
   1142 
   1143                 // AST REWRITE
   1144                 // elements: functionHeader
   1145                 // token labels:
   1146                 // rule labels: retval
   1147                 // token list labels:
   1148                 // rule list labels:
   1149                 // wildcard labels:
   1150                 retval.tree = root_0;
   1151 
   1152                 ANTLRRewriteRuleSubtreeStream *stream_retval =
   1153                     [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1154                         description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   1155 
   1156                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1157 
   1158                 // 22:36: -> ^( FUNC_DECL functionHeader )
   1159                 {
   1160                     // SimpleC.g:22:39: ^( FUNC_DECL functionHeader )
   1161                     {
   1162                         ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1163                         root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
   1164                                 [treeAdaptor createTree:FUNC_DECL Text:@"FUNC_DECL"]
   1165                          old:root_1];
   1166 
   1167                         [treeAdaptor addChild:[stream_functionHeader nextTree] toTree:root_1];
   1168 
   1169                         [treeAdaptor addChild:root_1 toTree:root_0];
   1170                     }
   1171 
   1172                 }
   1173 
   1174 
   1175                 retval.tree = root_0;
   1176 
   1177 
   1178                 }
   1179                 break;
   1180             case 3 : ;
   1181                 // SimpleC.g:23:9: functionHeader block // alt
   1182                 {
   1183                 /* ruleRef */
   1184                 [self pushFollow:FOLLOW_functionHeader_in_declaration135];
   1185                 functionHeader5 = [self functionHeader];
   1186 
   1187                 [self popFollow];
   1188 
   1189 
   1190                 [stream_functionHeader addElement:[functionHeader5 getTree]];
   1191 
   1192                 /* ruleRef */
   1193                 [self pushFollow:FOLLOW_block_in_declaration137];
   1194                 block6 = [self block];
   1195 
   1196                 [self popFollow];
   1197 
   1198 
   1199                 [stream_block addElement:[block6 getTree]];
   1200 
   1201                 // AST REWRITE
   1202                 // elements: functionHeader, block
   1203                 // token labels:
   1204                 // rule labels: retval
   1205                 // token list labels:
   1206                 // rule list labels:
   1207                 // wildcard labels:
   1208                 retval.tree = root_0;
   1209 
   1210                 ANTLRRewriteRuleSubtreeStream *stream_retval =
   1211                     [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1212                         description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   1213 
   1214                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1215 
   1216                 // 23:30: -> ^( FUNC_DEF functionHeader block )
   1217                 {
   1218                     // SimpleC.g:23:33: ^( FUNC_DEF functionHeader block )
   1219                     {
   1220                         ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1221                         root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
   1222                                 [treeAdaptor createTree:FUNC_DEF Text:@"FUNC_DEF"]
   1223                          old:root_1];
   1224 
   1225                         [treeAdaptor addChild:[stream_functionHeader nextTree] toTree:root_1];
   1226 
   1227                         [treeAdaptor addChild:[stream_block nextTree] toTree:root_1];
   1228 
   1229                         [treeAdaptor addChild:root_1 toTree:root_0];
   1230                     }
   1231 
   1232                 }
   1233 
   1234 
   1235                 retval.tree = root_0;
   1236 
   1237 
   1238                 }
   1239                 break;
   1240 
   1241         }
   1242         /* ASTParser ruleCleanUp */
   1243         /* AST ruleCleanUp */
   1244         // token+rule list labels
   1245         [retval setStop:[input LT:-1]];
   1246 
   1247 
   1248         [stream_K_SEMICOLON release];
   1249         [stream_functionHeader release];
   1250         [stream_block release];
   1251 
   1252             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   1253             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   1254 
   1255     }
   1256     @catch (ANTLRRecognitionException *re) {
   1257         [self reportError:re];
   1258         [self recover:input Exception:re];
   1259         /* ASTParser rule.setErrorReturnValue */
   1260         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   1261 
   1262     }
   1263 
   1264     @finally {
   1265         /* Terence's stuff */
   1266 
   1267     }
   1268     return retval;
   1269 }
   1270 /* $ANTLR end declaration */
   1271 
   1272 /*
   1273  * $ANTLR start variable
   1274  * SimpleC.g:26:1: variable : type declarator K_SEMICOLON -> ^( VAR_DEF type declarator ) ;
   1275  */
   1276 - (SimpleCParser_variable_return *) variable
   1277 {
   1278     /* my ruleScopeSetUp */
   1279     /* Terence's stuff */
   1280 
   1281     /* AST ruleDeclarations */
   1282     SimpleCParser_variable_return * retval = [SimpleCParser_variable_return newSimpleCParser_variable_return];
   1283     [retval setStart:[input LT:1]];
   1284 
   1285 
   1286     ANTLRCommonTree *root_0 = nil;
   1287 
   1288     @try {
   1289         /* AST ruleLabelDefs */
   1290         ANTLRCommonToken *K_SEMICOLON9 = nil;
   1291          SimpleCParser_type_return * type7 = nil ;
   1292 
   1293          SimpleCParser_declarator_return * declarator8 = nil ;
   1294 
   1295 
   1296         ANTLRCommonTree *K_SEMICOLON9_tree=nil;
   1297         ANTLRRewriteRuleTokenStream *stream_K_SEMICOLON =
   1298             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   1299                                                              description:@"token K_SEMICOLON"] retain];
   1300         ANTLRRewriteRuleSubtreeStream *stream_declarator =
   1301             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1302                                                                 description:@"rule declarator"] retain];
   1303         ANTLRRewriteRuleSubtreeStream *stream_type =
   1304             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1305                                                                 description:@"rule type"] retain];
   1306         // SimpleC.g:27:5: ( type declarator K_SEMICOLON -> ^( VAR_DEF type declarator ) ) // ruleBlockSingleAlt
   1307         // SimpleC.g:27:9: type declarator K_SEMICOLON // alt
   1308         {
   1309         /* ruleRef */
   1310         [self pushFollow:FOLLOW_type_in_variable166];
   1311         type7 = [self type];
   1312 
   1313         [self popFollow];
   1314 
   1315 
   1316         [stream_type addElement:[type7 getTree]];
   1317 
   1318         /* ruleRef */
   1319         [self pushFollow:FOLLOW_declarator_in_variable168];
   1320         declarator8 = [self declarator];
   1321 
   1322         [self popFollow];
   1323 
   1324 
   1325         [stream_declarator addElement:[declarator8 getTree]];
   1326 
   1327         K_SEMICOLON9=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_variable170];
   1328             [stream_K_SEMICOLON addElement:K_SEMICOLON9];
   1329 
   1330 
   1331         // AST REWRITE
   1332         // elements: declarator, type
   1333         // token labels:
   1334         // rule labels: retval
   1335         // token list labels:
   1336         // rule list labels:
   1337         // wildcard labels:
   1338         retval.tree = root_0;
   1339 
   1340         ANTLRRewriteRuleSubtreeStream *stream_retval =
   1341             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1342                 description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   1343 
   1344         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1345 
   1346         // 27:37: -> ^( VAR_DEF type declarator )
   1347         {
   1348             // SimpleC.g:27:40: ^( VAR_DEF type declarator )
   1349             {
   1350                 ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1351                 root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
   1352                         [treeAdaptor createTree:VAR_DEF Text:@"VAR_DEF"]
   1353                  old:root_1];
   1354 
   1355                 [treeAdaptor addChild:[stream_type nextTree] toTree:root_1];
   1356 
   1357                 [treeAdaptor addChild:[stream_declarator nextTree] toTree:root_1];
   1358 
   1359                 [treeAdaptor addChild:root_1 toTree:root_0];
   1360             }
   1361 
   1362         }
   1363 
   1364 
   1365         retval.tree = root_0;
   1366 
   1367 
   1368         }
   1369 
   1370         /* ASTParser ruleCleanUp */
   1371         /* AST ruleCleanUp */
   1372         // token+rule list labels
   1373         [retval setStop:[input LT:-1]];
   1374 
   1375 
   1376         [stream_K_SEMICOLON release];
   1377         [stream_declarator release];
   1378         [stream_type release];
   1379 
   1380             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   1381             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   1382 
   1383     }
   1384     @catch (ANTLRRecognitionException *re) {
   1385         [self reportError:re];
   1386         [self recover:input Exception:re];
   1387         /* ASTParser rule.setErrorReturnValue */
   1388         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   1389 
   1390     }
   1391 
   1392     @finally {
   1393         /* Terence's stuff */
   1394 
   1395     }
   1396     return retval;
   1397 }
   1398 /* $ANTLR end variable */
   1399 
   1400 /*
   1401  * $ANTLR start declarator
   1402  * SimpleC.g:30:1: declarator : K_ID ;
   1403  */
   1404 - (SimpleCParser_declarator_return *) declarator
   1405 {
   1406     /* my ruleScopeSetUp */
   1407     /* Terence's stuff */
   1408 
   1409     /* AST ruleDeclarations */
   1410     SimpleCParser_declarator_return * retval = [SimpleCParser_declarator_return newSimpleCParser_declarator_return];
   1411     [retval setStart:[input LT:1]];
   1412 
   1413 
   1414     ANTLRCommonTree *root_0 = nil;
   1415 
   1416     @try {
   1417         /* AST ruleLabelDefs */
   1418         ANTLRCommonToken *K_ID10 = nil;
   1419 
   1420         ANTLRCommonTree *K_ID10_tree=nil;
   1421 
   1422         // SimpleC.g:31:5: ( K_ID ) // ruleBlockSingleAlt
   1423         // SimpleC.g:31:9: K_ID // alt
   1424         {
   1425         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1426 
   1427 
   1428         /* ASTParser tokenRef */
   1429         K_ID10=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_declarator199];
   1430         K_ID10_tree = /* ASTParser createNodeFromToken */
   1431         (ANTLRCommonTree *)[[treeAdaptor create:K_ID10] retain]
   1432         ;
   1433         [treeAdaptor addChild:K_ID10_tree  toTree:root_0];
   1434 
   1435 
   1436         }
   1437 
   1438         /* ASTParser ruleCleanUp */
   1439         /* AST ruleCleanUp */
   1440         // token+rule list labels
   1441         [retval setStop:[input LT:-1]];
   1442 
   1443 
   1444 
   1445             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   1446             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   1447 
   1448     }
   1449     @catch (ANTLRRecognitionException *re) {
   1450         [self reportError:re];
   1451         [self recover:input Exception:re];
   1452         /* ASTParser rule.setErrorReturnValue */
   1453         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   1454 
   1455     }
   1456 
   1457     @finally {
   1458         /* Terence's stuff */
   1459 
   1460     }
   1461     return retval;
   1462 }
   1463 /* $ANTLR end declarator */
   1464 
   1465 /*
   1466  * $ANTLR start functionHeader
   1467  * SimpleC.g:34:1: functionHeader : type K_ID K_LCURVE ( formalParameter ( K_COMMA formalParameter )* )? K_RCURVE -> ^( FUNC_HDR type K_ID ( formalParameter )+ ) ;
   1468  */
   1469 - (SimpleCParser_functionHeader_return *) functionHeader
   1470 {
   1471     /* my ruleScopeSetUp */
   1472     /* Terence's stuff */
   1473 
   1474     /* AST ruleDeclarations */
   1475     SimpleCParser_functionHeader_return * retval = [SimpleCParser_functionHeader_return newSimpleCParser_functionHeader_return];
   1476     [retval setStart:[input LT:1]];
   1477 
   1478 
   1479     ANTLRCommonTree *root_0 = nil;
   1480 
   1481     @try {
   1482         /* AST ruleLabelDefs */
   1483         ANTLRCommonToken *K_ID12 = nil;
   1484         ANTLRCommonToken *K_LCURVE13 = nil;
   1485         ANTLRCommonToken *K_COMMA15 = nil;
   1486         ANTLRCommonToken *K_RCURVE17 = nil;
   1487          SimpleCParser_type_return * type11 = nil ;
   1488 
   1489          SimpleCParser_formalParameter_return * formalParameter14 = nil ;
   1490 
   1491          SimpleCParser_formalParameter_return * formalParameter16 = nil ;
   1492 
   1493 
   1494         ANTLRCommonTree *K_ID12_tree=nil;
   1495         ANTLRCommonTree *K_LCURVE13_tree=nil;
   1496         ANTLRCommonTree *K_COMMA15_tree=nil;
   1497         ANTLRCommonTree *K_RCURVE17_tree=nil;
   1498         ANTLRRewriteRuleTokenStream *stream_K_ID =
   1499             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   1500                                                              description:@"token K_ID"] retain];
   1501         ANTLRRewriteRuleTokenStream *stream_K_LCURVE =
   1502             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   1503                                                              description:@"token K_LCURVE"] retain];
   1504         ANTLRRewriteRuleTokenStream *stream_K_RCURVE =
   1505             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   1506                                                              description:@"token K_RCURVE"] retain];
   1507         ANTLRRewriteRuleTokenStream *stream_K_COMMA =
   1508             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   1509                                                              description:@"token K_COMMA"] retain];
   1510         ANTLRRewriteRuleSubtreeStream *stream_formalParameter =
   1511             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1512                                                                 description:@"rule formalParameter"] retain];
   1513         ANTLRRewriteRuleSubtreeStream *stream_type =
   1514             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1515                                                                 description:@"rule type"] retain];
   1516         // SimpleC.g:35:5: ( type K_ID K_LCURVE ( formalParameter ( K_COMMA formalParameter )* )? K_RCURVE -> ^( FUNC_HDR type K_ID ( formalParameter )+ ) ) // ruleBlockSingleAlt
   1517         // SimpleC.g:35:9: type K_ID K_LCURVE ( formalParameter ( K_COMMA formalParameter )* )? K_RCURVE // alt
   1518         {
   1519         /* ruleRef */
   1520         [self pushFollow:FOLLOW_type_in_functionHeader219];
   1521         type11 = [self type];
   1522 
   1523         [self popFollow];
   1524 
   1525 
   1526         [stream_type addElement:[type11 getTree]];
   1527 
   1528         K_ID12=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_functionHeader221];
   1529             [stream_K_ID addElement:K_ID12];
   1530 
   1531 
   1532         K_LCURVE13=(ANTLRCommonToken *)[self match:input TokenType:K_LCURVE Follow:FOLLOW_K_LCURVE_in_functionHeader223];
   1533             [stream_K_LCURVE addElement:K_LCURVE13];
   1534 
   1535 
   1536         // SimpleC.g:35:28: ( formalParameter ( K_COMMA formalParameter )* )? // block
   1537         NSInteger alt4=2;
   1538         NSInteger LA4_0 = [input LA:1];
   1539 
   1540         if ( (LA4_0==K_CHAR||LA4_0==K_ID||LA4_0==K_INT_TYPE||LA4_0==K_VOID) ) {
   1541             alt4=1;
   1542         }
   1543         switch (alt4) {
   1544             case 1 : ;
   1545                 // SimpleC.g:35:30: formalParameter ( K_COMMA formalParameter )* // alt
   1546                 {
   1547                 /* ruleRef */
   1548                 [self pushFollow:FOLLOW_formalParameter_in_functionHeader227];
   1549                 formalParameter14 = [self formalParameter];
   1550 
   1551                 [self popFollow];
   1552 
   1553 
   1554                 [stream_formalParameter addElement:[formalParameter14 getTree]];
   1555 
   1556                 do {
   1557                     NSInteger alt3=2;
   1558                     NSInteger LA3_0 = [input LA:1];
   1559                     if ( (LA3_0==K_COMMA) ) {
   1560                         alt3=1;
   1561                     }
   1562 
   1563 
   1564                     switch (alt3) {
   1565                         case 1 : ;
   1566                             // SimpleC.g:35:48: K_COMMA formalParameter // alt
   1567                             {
   1568                             K_COMMA15=(ANTLRCommonToken *)[self match:input TokenType:K_COMMA Follow:FOLLOW_K_COMMA_in_functionHeader231];
   1569                                 [stream_K_COMMA addElement:K_COMMA15];
   1570 
   1571 
   1572                             /* ruleRef */
   1573                             [self pushFollow:FOLLOW_formalParameter_in_functionHeader233];
   1574                             formalParameter16 = [self formalParameter];
   1575 
   1576                             [self popFollow];
   1577 
   1578 
   1579                             [stream_formalParameter addElement:[formalParameter16 getTree]];
   1580 
   1581                             }
   1582                             break;
   1583 
   1584                         default :
   1585                             goto loop3;
   1586                     }
   1587                 } while (YES);
   1588                 loop3: ;
   1589 
   1590 
   1591                 }
   1592                 break;
   1593 
   1594         }
   1595 
   1596 
   1597         K_RCURVE17=(ANTLRCommonToken *)[self match:input TokenType:K_RCURVE Follow:FOLLOW_K_RCURVE_in_functionHeader241];
   1598             [stream_K_RCURVE addElement:K_RCURVE17];
   1599 
   1600 
   1601         // AST REWRITE
   1602         // elements: formalParameter, type, K_ID
   1603         // token labels:
   1604         // rule labels: retval
   1605         // token list labels:
   1606         // rule list labels:
   1607         // wildcard labels:
   1608         retval.tree = root_0;
   1609 
   1610         ANTLRRewriteRuleSubtreeStream *stream_retval =
   1611             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1612                 description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   1613 
   1614         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1615 
   1616         // 36:9: -> ^( FUNC_HDR type K_ID ( formalParameter )+ )
   1617         {
   1618             // SimpleC.g:36:12: ^( FUNC_HDR type K_ID ( formalParameter )+ )
   1619             {
   1620                 ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1621                 root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
   1622                         [treeAdaptor createTree:FUNC_HDR Text:@"FUNC_HDR"]
   1623                  old:root_1];
   1624 
   1625                 [treeAdaptor addChild:[stream_type nextTree] toTree:root_1];
   1626 
   1627                  // TODO: args:
   1628                 [treeAdaptor addChild:
   1629                             [stream_K_ID nextNode]
   1630                  toTree:root_1];
   1631 
   1632                 // SimpleC.g:36:33: ( formalParameter )+
   1633                 {
   1634                 if ( !([stream_formalParameter hasNext]) ) {
   1635                     @throw [ANTLRRewriteEarlyExitException newException];
   1636                 }
   1637                 while ( [stream_formalParameter hasNext] ) {
   1638                     [treeAdaptor addChild:[stream_formalParameter nextTree] toTree:root_1];
   1639 
   1640                 }
   1641                 [stream_formalParameter reset];
   1642 
   1643                 }
   1644                 [treeAdaptor addChild:root_1 toTree:root_0];
   1645             }
   1646 
   1647         }
   1648 
   1649 
   1650         retval.tree = root_0;
   1651 
   1652 
   1653         }
   1654 
   1655         /* ASTParser ruleCleanUp */
   1656         /* AST ruleCleanUp */
   1657         // token+rule list labels
   1658         [retval setStop:[input LT:-1]];
   1659 
   1660 
   1661         [stream_K_ID release];
   1662         [stream_K_LCURVE release];
   1663         [stream_K_RCURVE release];
   1664         [stream_K_COMMA release];
   1665         [stream_formalParameter release];
   1666         [stream_type release];
   1667 
   1668             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   1669             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   1670 
   1671     }
   1672     @catch (ANTLRRecognitionException *re) {
   1673         [self reportError:re];
   1674         [self recover:input Exception:re];
   1675         /* ASTParser rule.setErrorReturnValue */
   1676         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   1677 
   1678     }
   1679 
   1680     @finally {
   1681         /* Terence's stuff */
   1682 
   1683     }
   1684     return retval;
   1685 }
   1686 /* $ANTLR end functionHeader */
   1687 
   1688 /*
   1689  * $ANTLR start formalParameter
   1690  * SimpleC.g:39:1: formalParameter : type declarator -> ^( ARG_DEF type declarator ) ;
   1691  */
   1692 - (SimpleCParser_formalParameter_return *) formalParameter
   1693 {
   1694     /* my ruleScopeSetUp */
   1695     /* Terence's stuff */
   1696 
   1697     /* AST ruleDeclarations */
   1698     SimpleCParser_formalParameter_return * retval = [SimpleCParser_formalParameter_return newSimpleCParser_formalParameter_return];
   1699     [retval setStart:[input LT:1]];
   1700 
   1701 
   1702     ANTLRCommonTree *root_0 = nil;
   1703 
   1704     @try {
   1705         /* AST ruleLabelDefs */
   1706          SimpleCParser_type_return * type18 = nil ;
   1707 
   1708          SimpleCParser_declarator_return * declarator19 = nil ;
   1709 
   1710 
   1711         ANTLRRewriteRuleSubtreeStream *stream_declarator =
   1712             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1713                                                                 description:@"rule declarator"] retain];
   1714         ANTLRRewriteRuleSubtreeStream *stream_type =
   1715             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1716                                                                 description:@"rule type"] retain];
   1717         // SimpleC.g:40:5: ( type declarator -> ^( ARG_DEF type declarator ) ) // ruleBlockSingleAlt
   1718         // SimpleC.g:40:9: type declarator // alt
   1719         {
   1720         /* ruleRef */
   1721         [self pushFollow:FOLLOW_type_in_formalParameter281];
   1722         type18 = [self type];
   1723 
   1724         [self popFollow];
   1725 
   1726 
   1727         [stream_type addElement:[type18 getTree]];
   1728 
   1729         /* ruleRef */
   1730         [self pushFollow:FOLLOW_declarator_in_formalParameter283];
   1731         declarator19 = [self declarator];
   1732 
   1733         [self popFollow];
   1734 
   1735 
   1736         [stream_declarator addElement:[declarator19 getTree]];
   1737 
   1738         // AST REWRITE
   1739         // elements: declarator, type
   1740         // token labels:
   1741         // rule labels: retval
   1742         // token list labels:
   1743         // rule list labels:
   1744         // wildcard labels:
   1745         retval.tree = root_0;
   1746 
   1747         ANTLRRewriteRuleSubtreeStream *stream_retval =
   1748             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1749                 description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   1750 
   1751         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1752 
   1753         // 40:25: -> ^( ARG_DEF type declarator )
   1754         {
   1755             // SimpleC.g:40:28: ^( ARG_DEF type declarator )
   1756             {
   1757                 ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1758                 root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
   1759                         [treeAdaptor createTree:ARG_DEF Text:@"ARG_DEF"]
   1760                  old:root_1];
   1761 
   1762                 [treeAdaptor addChild:[stream_type nextTree] toTree:root_1];
   1763 
   1764                 [treeAdaptor addChild:[stream_declarator nextTree] toTree:root_1];
   1765 
   1766                 [treeAdaptor addChild:root_1 toTree:root_0];
   1767             }
   1768 
   1769         }
   1770 
   1771 
   1772         retval.tree = root_0;
   1773 
   1774 
   1775         }
   1776 
   1777         /* ASTParser ruleCleanUp */
   1778         /* AST ruleCleanUp */
   1779         // token+rule list labels
   1780         [retval setStop:[input LT:-1]];
   1781 
   1782 
   1783         [stream_declarator release];
   1784         [stream_type release];
   1785 
   1786             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   1787             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   1788 
   1789     }
   1790     @catch (ANTLRRecognitionException *re) {
   1791         [self reportError:re];
   1792         [self recover:input Exception:re];
   1793         /* ASTParser rule.setErrorReturnValue */
   1794         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   1795 
   1796     }
   1797 
   1798     @finally {
   1799         /* Terence's stuff */
   1800 
   1801     }
   1802     return retval;
   1803 }
   1804 /* $ANTLR end formalParameter */
   1805 
   1806 /*
   1807  * $ANTLR start type
   1808  * SimpleC.g:43:1: type : ( K_INT_TYPE | K_CHAR | K_VOID | K_ID );
   1809  */
   1810 - (SimpleCParser_type_return *) type
   1811 {
   1812     /* my ruleScopeSetUp */
   1813     /* Terence's stuff */
   1814 
   1815     /* AST ruleDeclarations */
   1816     SimpleCParser_type_return * retval = [SimpleCParser_type_return newSimpleCParser_type_return];
   1817     [retval setStart:[input LT:1]];
   1818 
   1819 
   1820     ANTLRCommonTree *root_0 = nil;
   1821 
   1822     @try {
   1823         /* AST ruleLabelDefs */
   1824         ANTLRCommonToken *set20 = nil;
   1825 
   1826         ANTLRCommonTree *set20_tree=nil;
   1827 
   1828         // SimpleC.g:44:5: ( K_INT_TYPE | K_CHAR | K_VOID | K_ID ) // ruleBlockSingleAlt
   1829         // SimpleC.g: // alt
   1830         {
   1831         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   1832 
   1833 
   1834         /* ASTParser matchRuleBlockSet */
   1835         /* ASTParser matchSet */
   1836         set20 = (ANTLRCommonToken *)[input LT:1]; /* matchSet */
   1837 
   1838         if ([input LA:1] == K_CHAR||[input LA:1] == K_ID||[input LA:1] == K_INT_TYPE||[input LA:1] == K_VOID) {
   1839             [input consume];
   1840             [treeAdaptor addChild:/* ASTParser createNodeFromToken */
   1841             (ANTLRCommonTree *)[[treeAdaptor create:set20] retain]
   1842              toTree:root_0 ];
   1843             [state setIsErrorRecovery:NO];
   1844         } else {
   1845             ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input];
   1846             @throw mse;
   1847         }
   1848 
   1849 
   1850         }
   1851 
   1852         /* ASTParser ruleCleanUp */
   1853         /* AST ruleCleanUp */
   1854         // token+rule list labels
   1855         [retval setStop:[input LT:-1]];
   1856 
   1857 
   1858 
   1859             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   1860             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   1861 
   1862     }
   1863     @catch (ANTLRRecognitionException *re) {
   1864         [self reportError:re];
   1865         [self recover:input Exception:re];
   1866         /* ASTParser rule.setErrorReturnValue */
   1867         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   1868 
   1869     }
   1870 
   1871     @finally {
   1872         /* Terence's stuff */
   1873 
   1874     }
   1875     return retval;
   1876 }
   1877 /* $ANTLR end type */
   1878 
   1879 /*
   1880  * $ANTLR start block
   1881  * SimpleC.g:50:1: block : lc= K_LCURLY ( variable )* ( stat )* K_RCURLY -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* ) ;
   1882  */
   1883 - (SimpleCParser_block_return *) block
   1884 {
   1885     /* my ruleScopeSetUp */
   1886     /* Terence's stuff */
   1887 
   1888     /* AST ruleDeclarations */
   1889     SimpleCParser_block_return * retval = [SimpleCParser_block_return newSimpleCParser_block_return];
   1890     [retval setStart:[input LT:1]];
   1891 
   1892 
   1893     ANTLRCommonTree *root_0 = nil;
   1894 
   1895     @try {
   1896         /* AST ruleLabelDefs */
   1897         ANTLRCommonToken *lc = nil;
   1898         ANTLRCommonToken *K_RCURLY23 = nil;
   1899          SimpleCParser_variable_return * variable21 = nil ;
   1900 
   1901          SimpleCParser_stat_return * stat22 = nil ;
   1902 
   1903 
   1904         ANTLRCommonTree *lc_tree=nil;
   1905         ANTLRCommonTree *K_RCURLY23_tree=nil;
   1906         ANTLRRewriteRuleTokenStream *stream_K_LCURLY =
   1907             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   1908                                                              description:@"token K_LCURLY"] retain];
   1909         ANTLRRewriteRuleTokenStream *stream_K_RCURLY =
   1910             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   1911                                                              description:@"token K_RCURLY"] retain];
   1912         ANTLRRewriteRuleSubtreeStream *stream_variable =
   1913             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1914                                                                 description:@"rule variable"] retain];
   1915         ANTLRRewriteRuleSubtreeStream *stream_stat =
   1916             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   1917                                                                 description:@"rule stat"] retain];
   1918         // SimpleC.g:51:5: (lc= K_LCURLY ( variable )* ( stat )* K_RCURLY -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* ) ) // ruleBlockSingleAlt
   1919         // SimpleC.g:51:9: lc= K_LCURLY ( variable )* ( stat )* K_RCURLY // alt
   1920         {
   1921         lc=(ANTLRCommonToken *)[self match:input TokenType:K_LCURLY Follow:FOLLOW_K_LCURLY_in_block376];
   1922             [stream_K_LCURLY addElement:lc];
   1923 
   1924 
   1925         do {
   1926             NSInteger alt5=2;
   1927             NSInteger LA5_0 = [input LA:1];
   1928             if ( (LA5_0==K_ID) ) {
   1929                 NSInteger LA5_2 = [input LA:2];
   1930                 if ( (LA5_2==K_ID) ) {
   1931                     alt5=1;
   1932                 }
   1933 
   1934 
   1935             }
   1936             else if ( (LA5_0==K_CHAR||LA5_0==K_INT_TYPE||LA5_0==K_VOID) ) {
   1937                 alt5=1;
   1938             }
   1939 
   1940 
   1941             switch (alt5) {
   1942                 case 1 : ;
   1943                     // SimpleC.g:52:13: variable // alt
   1944                     {
   1945                     /* ruleRef */
   1946                     [self pushFollow:FOLLOW_variable_in_block390];
   1947                     variable21 = [self variable];
   1948 
   1949                     [self popFollow];
   1950 
   1951 
   1952                     [stream_variable addElement:[variable21 getTree]];
   1953 
   1954                     }
   1955                     break;
   1956 
   1957                 default :
   1958                     goto loop5;
   1959             }
   1960         } while (YES);
   1961         loop5: ;
   1962 
   1963 
   1964         do {
   1965             NSInteger alt6=2;
   1966             NSInteger LA6_0 = [input LA:1];
   1967             if ( ((LA6_0 >= K_FOR && LA6_0 <= K_INT)||(LA6_0 >= K_LCURLY && LA6_0 <= K_LCURVE)||LA6_0==K_SEMICOLON) ) {
   1968                 alt6=1;
   1969             }
   1970 
   1971 
   1972             switch (alt6) {
   1973                 case 1 : ;
   1974                     // SimpleC.g:53:13: stat // alt
   1975                     {
   1976                     /* ruleRef */
   1977                     [self pushFollow:FOLLOW_stat_in_block405];
   1978                     stat22 = [self stat];
   1979 
   1980                     [self popFollow];
   1981 
   1982 
   1983                     [stream_stat addElement:[stat22 getTree]];
   1984 
   1985                     }
   1986                     break;
   1987 
   1988                 default :
   1989                     goto loop6;
   1990             }
   1991         } while (YES);
   1992         loop6: ;
   1993 
   1994 
   1995         K_RCURLY23=(ANTLRCommonToken *)[self match:input TokenType:K_RCURLY Follow:FOLLOW_K_RCURLY_in_block416];
   1996             [stream_K_RCURLY addElement:K_RCURLY23];
   1997 
   1998 
   1999         // AST REWRITE
   2000         // elements: stat, variable
   2001         // token labels:
   2002         // rule labels: retval
   2003         // token list labels:
   2004         // rule list labels:
   2005         // wildcard labels:
   2006         retval.tree = root_0;
   2007 
   2008         ANTLRRewriteRuleSubtreeStream *stream_retval =
   2009             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2010                 description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   2011 
   2012         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2013 
   2014         // 55:9: -> ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* )
   2015         {
   2016             // SimpleC.g:55:12: ^( BLOCK[$lc,@\"BLOCK\"] ( variable )* ( stat )* )
   2017             {
   2018                 ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2019                 root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
   2020                         [treeAdaptor createTree:BLOCK FromToken:lc Text:@"BLOCK"]
   2021                  old:root_1];
   2022 
   2023                 // SimpleC.g:55:34: ( variable )*
   2024                 while ( [stream_variable hasNext] ) {
   2025                     [treeAdaptor addChild:[stream_variable nextTree] toTree:root_1];
   2026 
   2027                 }
   2028                 [stream_variable reset];
   2029 
   2030                 // SimpleC.g:55:44: ( stat )*
   2031                 while ( [stream_stat hasNext] ) {
   2032                     [treeAdaptor addChild:[stream_stat nextTree] toTree:root_1];
   2033 
   2034                 }
   2035                 [stream_stat reset];
   2036 
   2037                 [treeAdaptor addChild:root_1 toTree:root_0];
   2038             }
   2039 
   2040         }
   2041 
   2042 
   2043         retval.tree = root_0;
   2044 
   2045 
   2046         }
   2047 
   2048         /* ASTParser ruleCleanUp */
   2049         /* AST ruleCleanUp */
   2050         // token+rule list labels
   2051         [retval setStop:[input LT:-1]];
   2052 
   2053 
   2054         [stream_K_LCURLY release];
   2055         [stream_K_RCURLY release];
   2056         [stream_variable release];
   2057         [stream_stat release];
   2058 
   2059             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   2060             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   2061 
   2062     }
   2063     @catch (ANTLRRecognitionException *re) {
   2064         [self reportError:re];
   2065         [self recover:input Exception:re];
   2066         /* ASTParser rule.setErrorReturnValue */
   2067         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   2068 
   2069     }
   2070 
   2071     @finally {
   2072         /* Terence's stuff */
   2073 
   2074     }
   2075     return retval;
   2076 }
   2077 /* $ANTLR end block */
   2078 
   2079 /*
   2080  * $ANTLR start stat
   2081  * SimpleC.g:58:1: stat : ( forStat | expr K_SEMICOLON !| block | assignStat K_SEMICOLON !| K_SEMICOLON !);
   2082  */
   2083 - (SimpleCParser_stat_return *) stat
   2084 {
   2085     /* my ruleScopeSetUp */
   2086     /* Terence's stuff */
   2087 
   2088     /* AST ruleDeclarations */
   2089     SimpleCParser_stat_return * retval = [SimpleCParser_stat_return newSimpleCParser_stat_return];
   2090     [retval setStart:[input LT:1]];
   2091 
   2092 
   2093     ANTLRCommonTree *root_0 = nil;
   2094 
   2095     @try {
   2096         /* AST ruleLabelDefs */
   2097         ANTLRCommonToken *K_SEMICOLON26 = nil;
   2098         ANTLRCommonToken *K_SEMICOLON29 = nil;
   2099         ANTLRCommonToken *K_SEMICOLON30 = nil;
   2100          SimpleCParser_forStat_return * forStat24 = nil ;
   2101 
   2102          SimpleCParser_expr_return * expr25 = nil ;
   2103 
   2104          SimpleCParser_block_return * block27 = nil ;
   2105 
   2106          SimpleCParser_assignStat_return * assignStat28 = nil ;
   2107 
   2108 
   2109         ANTLRCommonTree *K_SEMICOLON26_tree=nil;
   2110         ANTLRCommonTree *K_SEMICOLON29_tree=nil;
   2111         ANTLRCommonTree *K_SEMICOLON30_tree=nil;
   2112 
   2113         // SimpleC.g:58:5: ( forStat | expr K_SEMICOLON !| block | assignStat K_SEMICOLON !| K_SEMICOLON !) //ruleblock
   2114         NSInteger alt7=5;
   2115         unichar charLA7 = [input LA:1];
   2116         switch (charLA7) {
   2117             case K_FOR: ;
   2118                 {
   2119                 alt7=1;
   2120                 }
   2121                 break;
   2122             case K_ID: ;
   2123                 {
   2124                 NSInteger LA7_2 = [input LA:2];
   2125 
   2126                 if ( (LA7_2==K_EQ) ) {
   2127                     alt7=4;
   2128                 }
   2129                 else if ( (LA7_2==K_EQEQ||(LA7_2 >= K_LT && LA7_2 <= K_PLUS)||LA7_2==K_SEMICOLON) ) {
   2130                     alt7=2;
   2131                 }
   2132                 else {
   2133                     ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:7 state:2 stream:input];
   2134                     nvae.c = LA7_2;
   2135                     @throw nvae;
   2136 
   2137                 }
   2138                 }
   2139                 break;
   2140             case K_INT: ;
   2141             case K_LCURVE: ;
   2142                 {
   2143                 alt7=2;
   2144                 }
   2145                 break;
   2146             case K_LCURLY: ;
   2147                 {
   2148                 alt7=3;
   2149                 }
   2150                 break;
   2151             case K_SEMICOLON: ;
   2152                 {
   2153                 alt7=5;
   2154                 }
   2155                 break;
   2156 
   2157         default: ;
   2158             ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:7 state:0 stream:input];
   2159             nvae.c = charLA7;
   2160             @throw nvae;
   2161 
   2162         }
   2163 
   2164         switch (alt7) {
   2165             case 1 : ;
   2166                 // SimpleC.g:58:7: forStat // alt
   2167                 {
   2168                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2169 
   2170 
   2171                 /* ASTParser ruleRef */
   2172                 /* ruleRef */
   2173                 [self pushFollow:FOLLOW_forStat_in_stat449];
   2174                 forStat24 = [self forStat];
   2175 
   2176                 [self popFollow];
   2177 
   2178 
   2179                 [treeAdaptor addChild:[forStat24 getTree] toTree:root_0];
   2180 
   2181                 }
   2182                 break;
   2183             case 2 : ;
   2184                 // SimpleC.g:59:7: expr K_SEMICOLON ! // alt
   2185                 {
   2186                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2187 
   2188 
   2189                 /* ASTParser ruleRef */
   2190                 /* ruleRef */
   2191                 [self pushFollow:FOLLOW_expr_in_stat457];
   2192                 expr25 = [self expr];
   2193 
   2194                 [self popFollow];
   2195 
   2196 
   2197                 [treeAdaptor addChild:[expr25 getTree] toTree:root_0];
   2198 
   2199                 K_SEMICOLON26=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_stat459];
   2200 
   2201                 }
   2202                 break;
   2203             case 3 : ;
   2204                 // SimpleC.g:60:7: block // alt
   2205                 {
   2206                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2207 
   2208 
   2209                 /* ASTParser ruleRef */
   2210                 /* ruleRef */
   2211                 [self pushFollow:FOLLOW_block_in_stat468];
   2212                 block27 = [self block];
   2213 
   2214                 [self popFollow];
   2215 
   2216 
   2217                 [treeAdaptor addChild:[block27 getTree] toTree:root_0];
   2218 
   2219                 }
   2220                 break;
   2221             case 4 : ;
   2222                 // SimpleC.g:61:7: assignStat K_SEMICOLON ! // alt
   2223                 {
   2224                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2225 
   2226 
   2227                 /* ASTParser ruleRef */
   2228                 /* ruleRef */
   2229                 [self pushFollow:FOLLOW_assignStat_in_stat476];
   2230                 assignStat28 = [self assignStat];
   2231 
   2232                 [self popFollow];
   2233 
   2234 
   2235                 [treeAdaptor addChild:[assignStat28 getTree] toTree:root_0];
   2236 
   2237                 K_SEMICOLON29=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_stat478];
   2238 
   2239                 }
   2240                 break;
   2241             case 5 : ;
   2242                 // SimpleC.g:62:7: K_SEMICOLON ! // alt
   2243                 {
   2244                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2245 
   2246 
   2247                 K_SEMICOLON30=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_stat487];
   2248 
   2249                 }
   2250                 break;
   2251 
   2252         }
   2253         /* ASTParser ruleCleanUp */
   2254         /* AST ruleCleanUp */
   2255         // token+rule list labels
   2256         [retval setStop:[input LT:-1]];
   2257 
   2258 
   2259 
   2260             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   2261             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   2262 
   2263     }
   2264     @catch (ANTLRRecognitionException *re) {
   2265         [self reportError:re];
   2266         [self recover:input Exception:re];
   2267         /* ASTParser rule.setErrorReturnValue */
   2268         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   2269 
   2270     }
   2271 
   2272     @finally {
   2273         /* Terence's stuff */
   2274 
   2275     }
   2276     return retval;
   2277 }
   2278 /* $ANTLR end stat */
   2279 
   2280 /*
   2281  * $ANTLR start forStat
   2282  * SimpleC.g:65:1: forStat : K_FOR K_LCURVE start= assignStat K_SEMICOLON expr K_SEMICOLON next= assignStat K_RCURVE block -> ^( K_FOR $start expr $next block ) ;
   2283  */
   2284 - (SimpleCParser_forStat_return *) forStat
   2285 {
   2286     /* my ruleScopeSetUp */
   2287     /* Terence's stuff */
   2288 
   2289     /* AST ruleDeclarations */
   2290     SimpleCParser_forStat_return * retval = [SimpleCParser_forStat_return newSimpleCParser_forStat_return];
   2291     [retval setStart:[input LT:1]];
   2292 
   2293 
   2294     ANTLRCommonTree *root_0 = nil;
   2295 
   2296     @try {
   2297         /* AST ruleLabelDefs */
   2298         ANTLRCommonToken *K_FOR31 = nil;
   2299         ANTLRCommonToken *K_LCURVE32 = nil;
   2300         ANTLRCommonToken *K_SEMICOLON33 = nil;
   2301         ANTLRCommonToken *K_SEMICOLON35 = nil;
   2302         ANTLRCommonToken *K_RCURVE36 = nil;
   2303          SimpleCParser_assignStat_return * start = nil ;
   2304 
   2305          SimpleCParser_assignStat_return * next = nil ;
   2306 
   2307          SimpleCParser_expr_return * expr34 = nil ;
   2308 
   2309          SimpleCParser_block_return * block37 = nil ;
   2310 
   2311 
   2312         ANTLRCommonTree *K_FOR31_tree=nil;
   2313         ANTLRCommonTree *K_LCURVE32_tree=nil;
   2314         ANTLRCommonTree *K_SEMICOLON33_tree=nil;
   2315         ANTLRCommonTree *K_SEMICOLON35_tree=nil;
   2316         ANTLRCommonTree *K_RCURVE36_tree=nil;
   2317         ANTLRRewriteRuleTokenStream *stream_K_LCURVE =
   2318             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   2319                                                              description:@"token K_LCURVE"] retain];
   2320         ANTLRRewriteRuleTokenStream *stream_K_RCURVE =
   2321             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   2322                                                              description:@"token K_RCURVE"] retain];
   2323         ANTLRRewriteRuleTokenStream *stream_K_SEMICOLON =
   2324             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   2325                                                              description:@"token K_SEMICOLON"] retain];
   2326         ANTLRRewriteRuleTokenStream *stream_K_FOR =
   2327             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   2328                                                              description:@"token K_FOR"] retain];
   2329         ANTLRRewriteRuleSubtreeStream *stream_assignStat =
   2330             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2331                                                                 description:@"rule assignStat"] retain];
   2332         ANTLRRewriteRuleSubtreeStream *stream_block =
   2333             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2334                                                                 description:@"rule block"] retain];
   2335         ANTLRRewriteRuleSubtreeStream *stream_expr =
   2336             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2337                                                                 description:@"rule expr"] retain];
   2338         // SimpleC.g:66:5: ( K_FOR K_LCURVE start= assignStat K_SEMICOLON expr K_SEMICOLON next= assignStat K_RCURVE block -> ^( K_FOR $start expr $next block ) ) // ruleBlockSingleAlt
   2339         // SimpleC.g:66:9: K_FOR K_LCURVE start= assignStat K_SEMICOLON expr K_SEMICOLON next= assignStat K_RCURVE block // alt
   2340         {
   2341         K_FOR31=(ANTLRCommonToken *)[self match:input TokenType:K_FOR Follow:FOLLOW_K_FOR_in_forStat507];
   2342             [stream_K_FOR addElement:K_FOR31];
   2343 
   2344 
   2345         K_LCURVE32=(ANTLRCommonToken *)[self match:input TokenType:K_LCURVE Follow:FOLLOW_K_LCURVE_in_forStat509];
   2346             [stream_K_LCURVE addElement:K_LCURVE32];
   2347 
   2348 
   2349         /* ruleRef */
   2350         [self pushFollow:FOLLOW_assignStat_in_forStat513];
   2351         start = [self assignStat];
   2352 
   2353         [self popFollow];
   2354 
   2355 
   2356         [stream_assignStat addElement:[start getTree]];
   2357 
   2358         K_SEMICOLON33=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_forStat515];
   2359             [stream_K_SEMICOLON addElement:K_SEMICOLON33];
   2360 
   2361 
   2362         /* ruleRef */
   2363         [self pushFollow:FOLLOW_expr_in_forStat517];
   2364         expr34 = [self expr];
   2365 
   2366         [self popFollow];
   2367 
   2368 
   2369         [stream_expr addElement:[expr34 getTree]];
   2370 
   2371         K_SEMICOLON35=(ANTLRCommonToken *)[self match:input TokenType:K_SEMICOLON Follow:FOLLOW_K_SEMICOLON_in_forStat519];
   2372             [stream_K_SEMICOLON addElement:K_SEMICOLON35];
   2373 
   2374 
   2375         /* ruleRef */
   2376         [self pushFollow:FOLLOW_assignStat_in_forStat523];
   2377         next = [self assignStat];
   2378 
   2379         [self popFollow];
   2380 
   2381 
   2382         [stream_assignStat addElement:[next getTree]];
   2383 
   2384         K_RCURVE36=(ANTLRCommonToken *)[self match:input TokenType:K_RCURVE Follow:FOLLOW_K_RCURVE_in_forStat525];
   2385             [stream_K_RCURVE addElement:K_RCURVE36];
   2386 
   2387 
   2388         /* ruleRef */
   2389         [self pushFollow:FOLLOW_block_in_forStat527];
   2390         block37 = [self block];
   2391 
   2392         [self popFollow];
   2393 
   2394 
   2395         [stream_block addElement:[block37 getTree]];
   2396 
   2397         // AST REWRITE
   2398         // elements: start, next, expr, block, K_FOR
   2399         // token labels:
   2400         // rule labels: retval, start, next
   2401         // token list labels:
   2402         // rule list labels:
   2403         // wildcard labels:
   2404         retval.tree = root_0;
   2405 
   2406         ANTLRRewriteRuleSubtreeStream *stream_retval =
   2407             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2408                 description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   2409         ANTLRRewriteRuleSubtreeStream *stream_start =
   2410             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2411                 description:@"token start" element:start!=nil?[start getTree]:nil] retain];
   2412         ANTLRRewriteRuleSubtreeStream *stream_next =
   2413             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2414                 description:@"token next" element:next!=nil?[next getTree]:nil] retain];
   2415 
   2416         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2417 
   2418         // 67:9: -> ^( K_FOR $start expr $next block )
   2419         {
   2420             // SimpleC.g:67:12: ^( K_FOR $start expr $next block )
   2421             {
   2422                 ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2423                 root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
   2424                             [stream_K_FOR nextNode]
   2425                  old:root_1];
   2426 
   2427                 [treeAdaptor addChild:[stream_start nextTree] toTree:root_1];
   2428 
   2429                 [treeAdaptor addChild:[stream_expr nextTree] toTree:root_1];
   2430 
   2431                 [treeAdaptor addChild:[stream_next nextTree] toTree:root_1];
   2432 
   2433                 [treeAdaptor addChild:[stream_block nextTree] toTree:root_1];
   2434 
   2435                 [treeAdaptor addChild:root_1 toTree:root_0];
   2436             }
   2437 
   2438         }
   2439 
   2440 
   2441         retval.tree = root_0;
   2442 
   2443 
   2444         }
   2445 
   2446         /* ASTParser ruleCleanUp */
   2447         /* AST ruleCleanUp */
   2448         // token+rule list labels
   2449         [retval setStop:[input LT:-1]];
   2450 
   2451 
   2452         [stream_K_LCURVE release];
   2453         [stream_K_RCURVE release];
   2454         [stream_K_SEMICOLON release];
   2455         [stream_K_FOR release];
   2456         [stream_assignStat release];
   2457         [stream_block release];
   2458         [stream_expr release];
   2459 
   2460             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   2461             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   2462 
   2463     }
   2464     @catch (ANTLRRecognitionException *re) {
   2465         [self reportError:re];
   2466         [self recover:input Exception:re];
   2467         /* ASTParser rule.setErrorReturnValue */
   2468         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   2469 
   2470     }
   2471 
   2472     @finally {
   2473         /* Terence's stuff */
   2474 
   2475     }
   2476     return retval;
   2477 }
   2478 /* $ANTLR end forStat */
   2479 
   2480 /*
   2481  * $ANTLR start assignStat
   2482  * SimpleC.g:70:1: assignStat : K_ID K_EQ expr -> ^( K_EQ K_ID expr ) ;
   2483  */
   2484 - (SimpleCParser_assignStat_return *) assignStat
   2485 {
   2486     /* my ruleScopeSetUp */
   2487     /* Terence's stuff */
   2488 
   2489     /* AST ruleDeclarations */
   2490     SimpleCParser_assignStat_return * retval = [SimpleCParser_assignStat_return newSimpleCParser_assignStat_return];
   2491     [retval setStart:[input LT:1]];
   2492 
   2493 
   2494     ANTLRCommonTree *root_0 = nil;
   2495 
   2496     @try {
   2497         /* AST ruleLabelDefs */
   2498         ANTLRCommonToken *K_ID38 = nil;
   2499         ANTLRCommonToken *K_EQ39 = nil;
   2500          SimpleCParser_expr_return * expr40 = nil ;
   2501 
   2502 
   2503         ANTLRCommonTree *K_ID38_tree=nil;
   2504         ANTLRCommonTree *K_EQ39_tree=nil;
   2505         ANTLRRewriteRuleTokenStream *stream_K_ID =
   2506             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   2507                                                              description:@"token K_ID"] retain];
   2508         ANTLRRewriteRuleTokenStream *stream_K_EQ =
   2509             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   2510                                                              description:@"token K_EQ"] retain];
   2511         ANTLRRewriteRuleSubtreeStream *stream_expr =
   2512             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2513                                                                 description:@"rule expr"] retain];
   2514         // SimpleC.g:71:5: ( K_ID K_EQ expr -> ^( K_EQ K_ID expr ) ) // ruleBlockSingleAlt
   2515         // SimpleC.g:71:9: K_ID K_EQ expr // alt
   2516         {
   2517         K_ID38=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_assignStat570];
   2518             [stream_K_ID addElement:K_ID38];
   2519 
   2520 
   2521         K_EQ39=(ANTLRCommonToken *)[self match:input TokenType:K_EQ Follow:FOLLOW_K_EQ_in_assignStat572];
   2522             [stream_K_EQ addElement:K_EQ39];
   2523 
   2524 
   2525         /* ruleRef */
   2526         [self pushFollow:FOLLOW_expr_in_assignStat574];
   2527         expr40 = [self expr];
   2528 
   2529         [self popFollow];
   2530 
   2531 
   2532         [stream_expr addElement:[expr40 getTree]];
   2533 
   2534         // AST REWRITE
   2535         // elements: K_ID, K_EQ, expr
   2536         // token labels:
   2537         // rule labels: retval
   2538         // token list labels:
   2539         // rule list labels:
   2540         // wildcard labels:
   2541         retval.tree = root_0;
   2542 
   2543         ANTLRRewriteRuleSubtreeStream *stream_retval =
   2544             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2545                 description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   2546 
   2547         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2548 
   2549         // 71:24: -> ^( K_EQ K_ID expr )
   2550         {
   2551             // SimpleC.g:71:27: ^( K_EQ K_ID expr )
   2552             {
   2553                 ANTLRCommonTree *root_1 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2554                 root_1 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:
   2555                             [stream_K_EQ nextNode]
   2556                  old:root_1];
   2557 
   2558                  // TODO: args:
   2559                 [treeAdaptor addChild:
   2560                             [stream_K_ID nextNode]
   2561                  toTree:root_1];
   2562 
   2563                 [treeAdaptor addChild:[stream_expr nextTree] toTree:root_1];
   2564 
   2565                 [treeAdaptor addChild:root_1 toTree:root_0];
   2566             }
   2567 
   2568         }
   2569 
   2570 
   2571         retval.tree = root_0;
   2572 
   2573 
   2574         }
   2575 
   2576         /* ASTParser ruleCleanUp */
   2577         /* AST ruleCleanUp */
   2578         // token+rule list labels
   2579         [retval setStop:[input LT:-1]];
   2580 
   2581 
   2582         [stream_K_ID release];
   2583         [stream_K_EQ release];
   2584         [stream_expr release];
   2585 
   2586             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   2587             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   2588 
   2589     }
   2590     @catch (ANTLRRecognitionException *re) {
   2591         [self reportError:re];
   2592         [self recover:input Exception:re];
   2593         /* ASTParser rule.setErrorReturnValue */
   2594         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   2595 
   2596     }
   2597 
   2598     @finally {
   2599         /* Terence's stuff */
   2600 
   2601     }
   2602     return retval;
   2603 }
   2604 /* $ANTLR end assignStat */
   2605 
   2606 /*
   2607  * $ANTLR start expr
   2608  * SimpleC.g:74:1: expr : condExpr ;
   2609  */
   2610 - (SimpleCParser_expr_return *) expr
   2611 {
   2612     /* my ruleScopeSetUp */
   2613     /* Terence's stuff */
   2614 
   2615     /* AST ruleDeclarations */
   2616     SimpleCParser_expr_return * retval = [SimpleCParser_expr_return newSimpleCParser_expr_return];
   2617     [retval setStart:[input LT:1]];
   2618 
   2619 
   2620     ANTLRCommonTree *root_0 = nil;
   2621 
   2622     @try {
   2623         /* AST ruleLabelDefs */
   2624          SimpleCParser_condExpr_return * condExpr41 = nil ;
   2625 
   2626 
   2627 
   2628         // SimpleC.g:74:5: ( condExpr ) // ruleBlockSingleAlt
   2629         // SimpleC.g:74:9: condExpr // alt
   2630         {
   2631         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2632 
   2633 
   2634         /* ASTParser ruleRef */
   2635         /* ruleRef */
   2636         [self pushFollow:FOLLOW_condExpr_in_expr598];
   2637         condExpr41 = [self condExpr];
   2638 
   2639         [self popFollow];
   2640 
   2641 
   2642         [treeAdaptor addChild:[condExpr41 getTree] toTree:root_0];
   2643 
   2644         }
   2645 
   2646         /* ASTParser ruleCleanUp */
   2647         /* AST ruleCleanUp */
   2648         // token+rule list labels
   2649         [retval setStop:[input LT:-1]];
   2650 
   2651 
   2652 
   2653             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   2654             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   2655 
   2656     }
   2657     @catch (ANTLRRecognitionException *re) {
   2658         [self reportError:re];
   2659         [self recover:input Exception:re];
   2660         /* ASTParser rule.setErrorReturnValue */
   2661         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   2662 
   2663     }
   2664 
   2665     @finally {
   2666         /* Terence's stuff */
   2667 
   2668     }
   2669     return retval;
   2670 }
   2671 /* $ANTLR end expr */
   2672 
   2673 /*
   2674  * $ANTLR start condExpr
   2675  * SimpleC.g:77:1: condExpr : aexpr ( ( K_EQEQ ^| K_LT ^) aexpr )? ;
   2676  */
   2677 - (SimpleCParser_condExpr_return *) condExpr
   2678 {
   2679     /* my ruleScopeSetUp */
   2680     /* Terence's stuff */
   2681 
   2682     /* AST ruleDeclarations */
   2683     SimpleCParser_condExpr_return * retval = [SimpleCParser_condExpr_return newSimpleCParser_condExpr_return];
   2684     [retval setStart:[input LT:1]];
   2685 
   2686 
   2687     ANTLRCommonTree *root_0 = nil;
   2688 
   2689     @try {
   2690         /* AST ruleLabelDefs */
   2691         ANTLRCommonToken *K_EQEQ43 = nil;
   2692         ANTLRCommonToken *K_LT44 = nil;
   2693          SimpleCParser_aexpr_return * aexpr42 = nil ;
   2694 
   2695          SimpleCParser_aexpr_return * aexpr45 = nil ;
   2696 
   2697 
   2698         ANTLRCommonTree *K_EQEQ43_tree=nil;
   2699         ANTLRCommonTree *K_LT44_tree=nil;
   2700 
   2701         // SimpleC.g:78:5: ( aexpr ( ( K_EQEQ ^| K_LT ^) aexpr )? ) // ruleBlockSingleAlt
   2702         // SimpleC.g:78:9: aexpr ( ( K_EQEQ ^| K_LT ^) aexpr )? // alt
   2703         {
   2704         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2705 
   2706 
   2707         /* ASTParser ruleRef */
   2708         /* ruleRef */
   2709         [self pushFollow:FOLLOW_aexpr_in_condExpr617];
   2710         aexpr42 = [self aexpr];
   2711 
   2712         [self popFollow];
   2713 
   2714 
   2715         [treeAdaptor addChild:[aexpr42 getTree] toTree:root_0];
   2716 
   2717         // SimpleC.g:78:15: ( ( K_EQEQ ^| K_LT ^) aexpr )? // block
   2718         NSInteger alt9=2;
   2719         NSInteger LA9_0 = [input LA:1];
   2720 
   2721         if ( (LA9_0==K_EQEQ||LA9_0==K_LT) ) {
   2722             alt9=1;
   2723         }
   2724         switch (alt9) {
   2725             case 1 : ;
   2726                 // SimpleC.g:78:17: ( K_EQEQ ^| K_LT ^) aexpr // alt
   2727                 {
   2728                 // SimpleC.g:78:17: ( K_EQEQ ^| K_LT ^) // block
   2729                 NSInteger alt8=2;
   2730                 NSInteger LA8_0 = [input LA:1];
   2731 
   2732                 if ( (LA8_0==K_EQEQ) ) {
   2733                     alt8=1;
   2734                 }
   2735                 else if ( (LA8_0==K_LT) ) {
   2736                     alt8=2;
   2737                 }
   2738                 else {
   2739                     ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:8 state:0 stream:input];
   2740                     nvae.c = LA8_0;
   2741                     @throw nvae;
   2742 
   2743                 }
   2744                 switch (alt8) {
   2745                     case 1 : ;
   2746                         // SimpleC.g:78:18: K_EQEQ ^ // alt
   2747                         {
   2748                         K_EQEQ43=(ANTLRCommonToken *)[self match:input TokenType:K_EQEQ Follow:FOLLOW_K_EQEQ_in_condExpr622];
   2749                         K_EQEQ43_tree = /* ASTParser createNodeFromToken */
   2750                         (ANTLRCommonTree *)[[treeAdaptor create:K_EQEQ43] retain]
   2751                         ;
   2752                         root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_EQEQ43_tree old:root_0];
   2753 
   2754 
   2755                         }
   2756                         break;
   2757                     case 2 : ;
   2758                         // SimpleC.g:78:28: K_LT ^ // alt
   2759                         {
   2760                         K_LT44=(ANTLRCommonToken *)[self match:input TokenType:K_LT Follow:FOLLOW_K_LT_in_condExpr627];
   2761                         K_LT44_tree = /* ASTParser createNodeFromToken */
   2762                         (ANTLRCommonTree *)[[treeAdaptor create:K_LT44] retain]
   2763                         ;
   2764                         root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_LT44_tree old:root_0];
   2765 
   2766 
   2767                         }
   2768                         break;
   2769 
   2770                 }
   2771 
   2772 
   2773                 /* ASTParser ruleRef */
   2774                 /* ruleRef */
   2775                 [self pushFollow:FOLLOW_aexpr_in_condExpr631];
   2776                 aexpr45 = [self aexpr];
   2777 
   2778                 [self popFollow];
   2779 
   2780 
   2781                 [treeAdaptor addChild:[aexpr45 getTree] toTree:root_0];
   2782 
   2783                 }
   2784                 break;
   2785 
   2786         }
   2787 
   2788 
   2789         }
   2790 
   2791         /* ASTParser ruleCleanUp */
   2792         /* AST ruleCleanUp */
   2793         // token+rule list labels
   2794         [retval setStop:[input LT:-1]];
   2795 
   2796 
   2797 
   2798             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   2799             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   2800 
   2801     }
   2802     @catch (ANTLRRecognitionException *re) {
   2803         [self reportError:re];
   2804         [self recover:input Exception:re];
   2805         /* ASTParser rule.setErrorReturnValue */
   2806         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   2807 
   2808     }
   2809 
   2810     @finally {
   2811         /* Terence's stuff */
   2812 
   2813     }
   2814     return retval;
   2815 }
   2816 /* $ANTLR end condExpr */
   2817 
   2818 /*
   2819  * $ANTLR start aexpr
   2820  * SimpleC.g:81:1: aexpr : atom ( K_PLUS ^ atom )* ;
   2821  */
   2822 - (SimpleCParser_aexpr_return *) aexpr
   2823 {
   2824     /* my ruleScopeSetUp */
   2825     /* Terence's stuff */
   2826 
   2827     /* AST ruleDeclarations */
   2828     SimpleCParser_aexpr_return * retval = [SimpleCParser_aexpr_return newSimpleCParser_aexpr_return];
   2829     [retval setStart:[input LT:1]];
   2830 
   2831 
   2832     ANTLRCommonTree *root_0 = nil;
   2833 
   2834     @try {
   2835         /* AST ruleLabelDefs */
   2836         ANTLRCommonToken *K_PLUS47 = nil;
   2837          SimpleCParser_atom_return * atom46 = nil ;
   2838 
   2839          SimpleCParser_atom_return * atom48 = nil ;
   2840 
   2841 
   2842         ANTLRCommonTree *K_PLUS47_tree=nil;
   2843 
   2844         // SimpleC.g:82:5: ( atom ( K_PLUS ^ atom )* ) // ruleBlockSingleAlt
   2845         // SimpleC.g:82:9: atom ( K_PLUS ^ atom )* // alt
   2846         {
   2847         root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2848 
   2849 
   2850         /* ASTParser ruleRef */
   2851         /* ruleRef */
   2852         [self pushFollow:FOLLOW_atom_in_aexpr653];
   2853         atom46 = [self atom];
   2854 
   2855         [self popFollow];
   2856 
   2857 
   2858         [treeAdaptor addChild:[atom46 getTree] toTree:root_0];
   2859 
   2860         do {
   2861             NSInteger alt10=2;
   2862             NSInteger LA10_0 = [input LA:1];
   2863             if ( (LA10_0==K_PLUS) ) {
   2864                 alt10=1;
   2865             }
   2866 
   2867 
   2868             switch (alt10) {
   2869                 case 1 : ;
   2870                     // SimpleC.g:82:16: K_PLUS ^ atom // alt
   2871                     {
   2872                     K_PLUS47=(ANTLRCommonToken *)[self match:input TokenType:K_PLUS Follow:FOLLOW_K_PLUS_in_aexpr657];
   2873                     K_PLUS47_tree = /* ASTParser createNodeFromToken */
   2874                     (ANTLRCommonTree *)[[treeAdaptor create:K_PLUS47] retain]
   2875                     ;
   2876                     root_0 = (ANTLRCommonTree *)[treeAdaptor becomeRoot:K_PLUS47_tree old:root_0];
   2877 
   2878 
   2879                     /* ASTParser ruleRef */
   2880                     /* ruleRef */
   2881                     [self pushFollow:FOLLOW_atom_in_aexpr660];
   2882                     atom48 = [self atom];
   2883 
   2884                     [self popFollow];
   2885 
   2886 
   2887                     [treeAdaptor addChild:[atom48 getTree] toTree:root_0];
   2888 
   2889                     }
   2890                     break;
   2891 
   2892                 default :
   2893                     goto loop10;
   2894             }
   2895         } while (YES);
   2896         loop10: ;
   2897 
   2898 
   2899         }
   2900 
   2901         /* ASTParser ruleCleanUp */
   2902         /* AST ruleCleanUp */
   2903         // token+rule list labels
   2904         [retval setStop:[input LT:-1]];
   2905 
   2906 
   2907 
   2908             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   2909             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   2910 
   2911     }
   2912     @catch (ANTLRRecognitionException *re) {
   2913         [self reportError:re];
   2914         [self recover:input Exception:re];
   2915         /* ASTParser rule.setErrorReturnValue */
   2916         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   2917 
   2918     }
   2919 
   2920     @finally {
   2921         /* Terence's stuff */
   2922 
   2923     }
   2924     return retval;
   2925 }
   2926 /* $ANTLR end aexpr */
   2927 
   2928 /*
   2929  * $ANTLR start atom
   2930  * SimpleC.g:85:1: atom : ( K_ID | K_INT | K_LCURVE expr K_RCURVE -> expr );
   2931  */
   2932 - (SimpleCParser_atom_return *) atom
   2933 {
   2934     /* my ruleScopeSetUp */
   2935     /* Terence's stuff */
   2936 
   2937     /* AST ruleDeclarations */
   2938     SimpleCParser_atom_return * retval = [SimpleCParser_atom_return newSimpleCParser_atom_return];
   2939     [retval setStart:[input LT:1]];
   2940 
   2941 
   2942     ANTLRCommonTree *root_0 = nil;
   2943 
   2944     @try {
   2945         /* AST ruleLabelDefs */
   2946         ANTLRCommonToken *K_ID49 = nil;
   2947         ANTLRCommonToken *K_INT50 = nil;
   2948         ANTLRCommonToken *K_LCURVE51 = nil;
   2949         ANTLRCommonToken *K_RCURVE53 = nil;
   2950          SimpleCParser_expr_return * expr52 = nil ;
   2951 
   2952 
   2953         ANTLRCommonTree *K_ID49_tree=nil;
   2954         ANTLRCommonTree *K_INT50_tree=nil;
   2955         ANTLRCommonTree *K_LCURVE51_tree=nil;
   2956         ANTLRCommonTree *K_RCURVE53_tree=nil;
   2957         ANTLRRewriteRuleTokenStream *stream_K_LCURVE =
   2958             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   2959                                                              description:@"token K_LCURVE"] retain];
   2960         ANTLRRewriteRuleTokenStream *stream_K_RCURVE =
   2961             [[ANTLRRewriteRuleTokenStream newANTLRRewriteRuleTokenStream:treeAdaptor
   2962                                                              description:@"token K_RCURVE"] retain];
   2963         ANTLRRewriteRuleSubtreeStream *stream_expr =
   2964             [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   2965                                                                 description:@"rule expr"] retain];
   2966         // SimpleC.g:86:5: ( K_ID | K_INT | K_LCURVE expr K_RCURVE -> expr ) //ruleblock
   2967         NSInteger alt11=3;
   2968         unichar charLA11 = [input LA:1];
   2969         switch (charLA11) {
   2970             case K_ID: ;
   2971                 {
   2972                 alt11=1;
   2973                 }
   2974                 break;
   2975             case K_INT: ;
   2976                 {
   2977                 alt11=2;
   2978                 }
   2979                 break;
   2980             case K_LCURVE: ;
   2981                 {
   2982                 alt11=3;
   2983                 }
   2984                 break;
   2985 
   2986         default: ;
   2987             ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:11 state:0 stream:input];
   2988             nvae.c = charLA11;
   2989             @throw nvae;
   2990 
   2991         }
   2992 
   2993         switch (alt11) {
   2994             case 1 : ;
   2995                 // SimpleC.g:86:7: K_ID // alt
   2996                 {
   2997                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   2998 
   2999 
   3000                 /* ASTParser tokenRef */
   3001                 K_ID49=(ANTLRCommonToken *)[self match:input TokenType:K_ID Follow:FOLLOW_K_ID_in_atom680];
   3002                 K_ID49_tree = /* ASTParser createNodeFromToken */
   3003                 (ANTLRCommonTree *)[[treeAdaptor create:K_ID49] retain]
   3004                 ;
   3005                 [treeAdaptor addChild:K_ID49_tree  toTree:root_0];
   3006 
   3007 
   3008                 }
   3009                 break;
   3010             case 2 : ;
   3011                 // SimpleC.g:87:7: K_INT // alt
   3012                 {
   3013                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   3014 
   3015 
   3016                 /* ASTParser tokenRef */
   3017                 K_INT50=(ANTLRCommonToken *)[self match:input TokenType:K_INT Follow:FOLLOW_K_INT_in_atom694];
   3018                 K_INT50_tree = /* ASTParser createNodeFromToken */
   3019                 (ANTLRCommonTree *)[[treeAdaptor create:K_INT50] retain]
   3020                 ;
   3021                 [treeAdaptor addChild:K_INT50_tree  toTree:root_0];
   3022 
   3023 
   3024                 }
   3025                 break;
   3026             case 3 : ;
   3027                 // SimpleC.g:88:7: K_LCURVE expr K_RCURVE // alt
   3028                 {
   3029                 K_LCURVE51=(ANTLRCommonToken *)[self match:input TokenType:K_LCURVE Follow:FOLLOW_K_LCURVE_in_atom708];
   3030                     [stream_K_LCURVE addElement:K_LCURVE51];
   3031 
   3032 
   3033                 /* ruleRef */
   3034                 [self pushFollow:FOLLOW_expr_in_atom710];
   3035                 expr52 = [self expr];
   3036 
   3037                 [self popFollow];
   3038 
   3039 
   3040                 [stream_expr addElement:[expr52 getTree]];
   3041 
   3042                 K_RCURVE53=(ANTLRCommonToken *)[self match:input TokenType:K_RCURVE Follow:FOLLOW_K_RCURVE_in_atom712];
   3043                     [stream_K_RCURVE addElement:K_RCURVE53];
   3044 
   3045 
   3046                 // AST REWRITE
   3047                 // elements: expr
   3048                 // token labels:
   3049                 // rule labels: retval
   3050                 // token list labels:
   3051                 // rule list labels:
   3052                 // wildcard labels:
   3053                 retval.tree = root_0;
   3054 
   3055                 ANTLRRewriteRuleSubtreeStream *stream_retval =
   3056                     [[ANTLRRewriteRuleSubtreeStream newANTLRRewriteRuleSubtreeStream:treeAdaptor
   3057                         description:@"token retval" element:retval!=nil?[retval getTree]:nil] retain];
   3058 
   3059                 root_0 = (ANTLRCommonTree *)[[[treeAdaptor class] newEmptyTree] retain];
   3060 
   3061                 // 88:30: -> expr
   3062                 {
   3063                     [treeAdaptor addChild:[stream_expr nextTree] toTree:root_0];
   3064 
   3065                 }
   3066 
   3067 
   3068                 retval.tree = root_0;
   3069 
   3070 
   3071                 }
   3072                 break;
   3073 
   3074         }
   3075         /* ASTParser ruleCleanUp */
   3076         /* AST ruleCleanUp */
   3077         // token+rule list labels
   3078         [retval setStop:[input LT:-1]];
   3079 
   3080 
   3081         [stream_K_LCURVE release];
   3082         [stream_K_RCURVE release];
   3083         [stream_expr release];
   3084 
   3085             retval.tree = (ANTLRCommonTree *)[treeAdaptor rulePostProcessing:root_0];
   3086             [treeAdaptor setTokenBoundaries:retval.tree From:retval.start To:retval.stopToken];
   3087 
   3088     }
   3089     @catch (ANTLRRecognitionException *re) {
   3090         [self reportError:re];
   3091         [self recover:input Exception:re];
   3092         /* ASTParser rule.setErrorReturnValue */
   3093         retval.tree = (ANTLRCommonTree *)[treeAdaptor errorNode:input From:retval.start To:[input LT:-1] Exception:re];
   3094 
   3095     }
   3096 
   3097     @finally {
   3098         /* Terence's stuff */
   3099 
   3100     }
   3101     return retval;
   3102 }
   3103 /* $ANTLR end atom */
   3104 /* ObjC end rules */
   3105 
   3106 @end /* end of SimpleCParser implementation line 692 */
   3107