aboutsummaryrefslogtreecommitdiff
path: root/antlr-3.4/runtime/ObjC/Framework/examples/LL-star/SimpleCParser.m
blob: e65a14956fa1795b80ecb6d7c47e626b60030ccb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
/** \file
 *  This OBJC source file was generated by $ANTLR version ${project.version} ${buildNumber}
 *
 *     -  From the grammar source file : SimpleC.g
 *     -                            On : 2011-05-06 13:53:12
 *     -                for the parser : SimpleCParserParser
 *
 * Editing it, at least manually, is not wise.
 *
 * ObjC language generator and runtime by Alan Condit, acondit|hereisanat|ipns|dotgoeshere|com.
 *
 *
*/
// $ANTLR ${project.version} ${buildNumber} SimpleC.g 2011-05-06 13:53:12


/* -----------------------------------------
 * Include the ANTLR3 generated header file.
 */
#import "SimpleCParser.h"
/* ----------------------------------------- */


/* ============================================================================= */
/* =============================================================================
 * Start of recognizer
 */
#pragma mark Cyclic DFA implementation start DFA2
@implementation DFA2
const static NSInteger dfa2_eot[13] =
    {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
const static NSInteger dfa2_eof[13] =
    {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
const static unichar dfa2_min[13] =
    {4,4,7,4,0,4,11,8,0,0,4,4,8};
const static unichar dfa2_max[13] =
    {18,4,11,18,0,4,19,10,0,0,18,4,10};
const static NSInteger dfa2_accept[13] =
    {-1,-1,-1,-1,1,-1,-1,-1,2,3,-1,-1,-1};
const static NSInteger dfa2_special[13] =
    {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
const static NSInteger dfa2_transition[] = {};
const static NSInteger dfa2_transition0[] = {3, -1, -1, -1, 4};
const static NSInteger dfa2_transition1[] = {6, -1, 10};
const static NSInteger dfa2_transition2[] = {8, -1, -1, -1, -1, -1, -1, 
 -1, 9};
const static NSInteger dfa2_transition3[] = {2};
const static NSInteger dfa2_transition4[] = {1, -1, -1, -1, -1, -1, -1, 
 -1, -1, -1, -1, 1, -1, 1, 1};
const static NSInteger dfa2_transition5[] = {7};
const static NSInteger dfa2_transition6[] = {11, -1, -1, -1, -1, -1, -1, 
 -1, -1, -1, -1, 11, -1, 11, 11};
const static NSInteger dfa2_transition7[] = {12};
const static NSInteger dfa2_transition8[] = {5, -1, -1, -1, 6, -1, -1, -1, 
 -1, -1, -1, 5, -1, 5, 5};


+ (id) newDFA2WithRecognizer:(ANTLRBaseRecognizer *)aRecognizer
{
    return [[[DFA2 alloc] initWithRecognizer:aRecognizer] retain];
}

- (id) initWithRecognizer:(ANTLRBaseRecognizer *) theRecognizer
{
    self = [super initWithRecognizer:theRecognizer];
    if ( self != nil ) {
        decisionNumber = 2;
        eot = dfa2_eot;
        eof = dfa2_eof;
        min = dfa2_min;
        max = dfa2_max;
        accept = dfa2_accept;
        special = dfa2_special;
        if (!(transition = calloc(13, sizeof(void*)))) {
            [self release];
            return nil;
        }
        len = 13;
        transition[0] = dfa2_transition4;
        transition[1] = dfa2_transition3;
        transition[2] = dfa2_transition0;
        transition[3] = dfa2_transition8;

        transition[4] = dfa2_transition5;
        transition[5] = dfa2_transition2;
        transition[6] = dfa2_transition1;


        transition[7] = dfa2_transition6;
        transition[8] = dfa2_transition7;
        transition[9] = dfa2_transition1;
    }
    return self;
}

- (void) dealloc
{
    free(transition);
    [super dealloc];
}

- (NSString *) description
{
    return @"20:1: declaration : ( variable | functionHeader ';' | functionHeader block );";
}


@end /* end DFA2 implementation */

#pragma mark Cyclic DFA implementation end DFA2



#pragma mark Bitsets
static ANTLRBitSet *FOLLOW_declaration_in_program28;
static const unsigned long long FOLLOW_declaration_in_program28_data[] = { 0x0000000000068012LL};
static ANTLRBitSet *FOLLOW_variable_in_declaration50;
static const unsigned long long FOLLOW_variable_in_declaration50_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_functionHeader_in_declaration60;
static const unsigned long long FOLLOW_functionHeader_in_declaration60_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_declaration62;
static const unsigned long long FOLLOW_11_in_declaration62_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_functionHeader_in_declaration75;
static const unsigned long long FOLLOW_functionHeader_in_declaration75_data[] = { 0x0000000000080000LL};
static ANTLRBitSet *FOLLOW_block_in_declaration77;
static const unsigned long long FOLLOW_block_in_declaration77_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_type_in_variable99;
static const unsigned long long FOLLOW_type_in_variable99_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_declarator_in_variable101;
static const unsigned long long FOLLOW_declarator_in_variable101_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_variable103;
static const unsigned long long FOLLOW_11_in_variable103_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_ID_in_declarator122;
static const unsigned long long FOLLOW_ID_in_declarator122_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_type_in_functionHeader151;
static const unsigned long long FOLLOW_type_in_functionHeader151_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_ID_in_functionHeader153;
static const unsigned long long FOLLOW_ID_in_functionHeader153_data[] = { 0x0000000000000080LL};
static ANTLRBitSet *FOLLOW_7_in_functionHeader155;
static const unsigned long long FOLLOW_7_in_functionHeader155_data[] = { 0x0000000000068110LL};
static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader159;
static const unsigned long long FOLLOW_formalParameter_in_functionHeader159_data[] = { 0x0000000000000500LL};
static ANTLRBitSet *FOLLOW_10_in_functionHeader163;
static const unsigned long long FOLLOW_10_in_functionHeader163_data[] = { 0x0000000000068010LL};
static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader165;
static const unsigned long long FOLLOW_formalParameter_in_functionHeader165_data[] = { 0x0000000000000500LL};
static ANTLRBitSet *FOLLOW_8_in_functionHeader173;
static const unsigned long long FOLLOW_8_in_functionHeader173_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_type_in_formalParameter195;
static const unsigned long long FOLLOW_type_in_formalParameter195_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_declarator_in_formalParameter197;
static const unsigned long long FOLLOW_declarator_in_formalParameter197_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_19_in_block286;
static const unsigned long long FOLLOW_19_in_block286_data[] = { 0x00000000001F88B0LL};
static ANTLRBitSet *FOLLOW_variable_in_block300;
static const unsigned long long FOLLOW_variable_in_block300_data[] = { 0x00000000001F88B0LL};
static ANTLRBitSet *FOLLOW_stat_in_block315;
static const unsigned long long FOLLOW_stat_in_block315_data[] = { 0x00000000001908B0LL};
static ANTLRBitSet *FOLLOW_20_in_block326;
static const unsigned long long FOLLOW_20_in_block326_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_forStat_in_stat338;
static const unsigned long long FOLLOW_forStat_in_stat338_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_expr_in_stat346;
static const unsigned long long FOLLOW_expr_in_stat346_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_stat348;
static const unsigned long long FOLLOW_11_in_stat348_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_block_in_stat362;
static const unsigned long long FOLLOW_block_in_stat362_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_assignStat_in_stat370;
static const unsigned long long FOLLOW_assignStat_in_stat370_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_stat372;
static const unsigned long long FOLLOW_11_in_stat372_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_11_in_stat380;
static const unsigned long long FOLLOW_11_in_stat380_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_16_in_forStat399;
static const unsigned long long FOLLOW_16_in_forStat399_data[] = { 0x0000000000000080LL};
static ANTLRBitSet *FOLLOW_7_in_forStat401;
static const unsigned long long FOLLOW_7_in_forStat401_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_assignStat_in_forStat403;
static const unsigned long long FOLLOW_assignStat_in_forStat403_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_forStat405;
static const unsigned long long FOLLOW_11_in_forStat405_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_expr_in_forStat407;
static const unsigned long long FOLLOW_expr_in_forStat407_data[] = { 0x0000000000000800LL};
static ANTLRBitSet *FOLLOW_11_in_forStat409;
static const unsigned long long FOLLOW_11_in_forStat409_data[] = { 0x0000000000000010LL};
static ANTLRBitSet *FOLLOW_assignStat_in_forStat411;
static const unsigned long long FOLLOW_assignStat_in_forStat411_data[] = { 0x0000000000000100LL};
static ANTLRBitSet *FOLLOW_8_in_forStat413;
static const unsigned long long FOLLOW_8_in_forStat413_data[] = { 0x0000000000080000LL};
static ANTLRBitSet *FOLLOW_block_in_forStat415;
static const unsigned long long FOLLOW_block_in_forStat415_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_ID_in_assignStat442;
static const unsigned long long FOLLOW_ID_in_assignStat442_data[] = { 0x0000000000002000LL};
static ANTLRBitSet *FOLLOW_13_in_assignStat444;
static const unsigned long long FOLLOW_13_in_assignStat444_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_expr_in_assignStat446;
static const unsigned long long FOLLOW_expr_in_assignStat446_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_condExpr_in_expr468;
static const unsigned long long FOLLOW_condExpr_in_expr468_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_aexpr_in_condExpr487;
static const unsigned long long FOLLOW_aexpr_in_condExpr487_data[] = { 0x0000000000005002LL};
static ANTLRBitSet *FOLLOW_set_in_condExpr491;
static const unsigned long long FOLLOW_set_in_condExpr491_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_aexpr_in_condExpr499;
static const unsigned long long FOLLOW_aexpr_in_condExpr499_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_atom_in_aexpr521;
static const unsigned long long FOLLOW_atom_in_aexpr521_data[] = { 0x0000000000000202LL};
static ANTLRBitSet *FOLLOW_9_in_aexpr525;
static const unsigned long long FOLLOW_9_in_aexpr525_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_atom_in_aexpr527;
static const unsigned long long FOLLOW_atom_in_aexpr527_data[] = { 0x0000000000000202LL};
static ANTLRBitSet *FOLLOW_ID_in_atom547;
static const unsigned long long FOLLOW_ID_in_atom547_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_INT_in_atom561;
static const unsigned long long FOLLOW_INT_in_atom561_data[] = { 0x0000000000000002LL};
static ANTLRBitSet *FOLLOW_7_in_atom575;
static const unsigned long long FOLLOW_7_in_atom575_data[] = { 0x00000000000000B0LL};
static ANTLRBitSet *FOLLOW_expr_in_atom577;
static const unsigned long long FOLLOW_expr_in_atom577_data[] = { 0x0000000000000100LL};
static ANTLRBitSet *FOLLOW_8_in_atom579;
static const unsigned long long FOLLOW_8_in_atom579_data[] = { 0x0000000000000002LL};


#pragma mark Dynamic Global Scopes

#pragma mark Dynamic Rule Scopes

#pragma mark Rule Return Scopes start
//#pragma mark Rule return scopes start
//

#pragma mark Rule return scopes start

@implementation SimpleCParser  // line 637

/* ObjC start of ruleAttributeScope */
#pragma mark Dynamic Rule Scopes
/* ObjC end of ruleAttributeScope */
#pragma mark global Attribute Scopes
/* ObjC start globalAttributeScope */
/* ObjC end globalAttributeScope */
/* ObjC start actions.(actionScope).synthesize */
/* ObjC end actions.(actionScope).synthesize */
/* ObjC start synthesize() */
/* ObjC end synthesize() */

+ (void) initialize
{
    #pragma mark Bitsets
    FOLLOW_declaration_in_program28 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program28_data Count:(NSUInteger)1] retain];
    FOLLOW_variable_in_declaration50 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration50_data Count:(NSUInteger)1] retain];
    FOLLOW_functionHeader_in_declaration60 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration60_data Count:(NSUInteger)1] retain];
    FOLLOW_11_in_declaration62 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_declaration62_data Count:(NSUInteger)1] retain];
    FOLLOW_functionHeader_in_declaration75 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration75_data Count:(NSUInteger)1] retain];
    FOLLOW_block_in_declaration77 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration77_data Count:(NSUInteger)1] retain];
    FOLLOW_type_in_variable99 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable99_data Count:(NSUInteger)1] retain];
    FOLLOW_declarator_in_variable101 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable101_data Count:(NSUInteger)1] retain];
    FOLLOW_11_in_variable103 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_variable103_data Count:(NSUInteger)1] retain];
    FOLLOW_ID_in_declarator122 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_declarator122_data Count:(NSUInteger)1] retain];
    FOLLOW_type_in_functionHeader151 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader151_data Count:(NSUInteger)1] retain];
    FOLLOW_ID_in_functionHeader153 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_functionHeader153_data Count:(NSUInteger)1] retain];
    FOLLOW_7_in_functionHeader155 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_functionHeader155_data Count:(NSUInteger)1] retain];
    FOLLOW_formalParameter_in_functionHeader159 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader159_data Count:(NSUInteger)1] retain];
    FOLLOW_10_in_functionHeader163 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_10_in_functionHeader163_data Count:(NSUInteger)1] retain];
    FOLLOW_formalParameter_in_functionHeader165 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader165_data Count:(NSUInteger)1] retain];
    FOLLOW_8_in_functionHeader173 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_functionHeader173_data Count:(NSUInteger)1] retain];
    FOLLOW_type_in_formalParameter195 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter195_data Count:(NSUInteger)1] retain];
    FOLLOW_declarator_in_formalParameter197 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter197_data Count:(NSUInteger)1] retain];
    FOLLOW_19_in_block286 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_19_in_block286_data Count:(NSUInteger)1] retain];
    FOLLOW_variable_in_block300 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block300_data Count:(NSUInteger)1] retain];
    FOLLOW_stat_in_block315 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block315_data Count:(NSUInteger)1] retain];
    FOLLOW_20_in_block326 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_20_in_block326_data Count:(NSUInteger)1] retain];
    FOLLOW_forStat_in_stat338 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat338_data Count:(NSUInteger)1] retain];
    FOLLOW_expr_in_stat346 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat346_data Count:(NSUInteger)1] retain];
    FOLLOW_11_in_stat348 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat348_data Count:(NSUInteger)1] retain];
    FOLLOW_block_in_stat362 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat362_data Count:(NSUInteger)1] retain];
    FOLLOW_assignStat_in_stat370 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_stat370_data Count:(NSUInteger)1] retain];
    FOLLOW_11_in_stat372 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat372_data Count:(NSUInteger)1] retain];
    FOLLOW_11_in_stat380 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat380_data Count:(NSUInteger)1] retain];
    FOLLOW_16_in_forStat399 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_16_in_forStat399_data Count:(NSUInteger)1] retain];
    FOLLOW_7_in_forStat401 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_forStat401_data Count:(NSUInteger)1] retain];
    FOLLOW_assignStat_in_forStat403 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat403_data Count:(NSUInteger)1] retain];
    FOLLOW_11_in_forStat405 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat405_data Count:(NSUInteger)1] retain];
    FOLLOW_expr_in_forStat407 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat407_data Count:(NSUInteger)1] retain];
    FOLLOW_11_in_forStat409 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat409_data Count:(NSUInteger)1] retain];
    FOLLOW_assignStat_in_forStat411 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat411_data Count:(NSUInteger)1] retain];
    FOLLOW_8_in_forStat413 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_forStat413_data Count:(NSUInteger)1] retain];
    FOLLOW_block_in_forStat415 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat415_data Count:(NSUInteger)1] retain];
    FOLLOW_ID_in_assignStat442 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_assignStat442_data Count:(NSUInteger)1] retain];
    FOLLOW_13_in_assignStat444 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_13_in_assignStat444_data Count:(NSUInteger)1] retain];
    FOLLOW_expr_in_assignStat446 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_assignStat446_data Count:(NSUInteger)1] retain];
    FOLLOW_condExpr_in_expr468 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_condExpr_in_expr468_data Count:(NSUInteger)1] retain];
    FOLLOW_aexpr_in_condExpr487 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr487_data Count:(NSUInteger)1] retain];
    FOLLOW_set_in_condExpr491 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_condExpr491_data Count:(NSUInteger)1] retain];
    FOLLOW_aexpr_in_condExpr499 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr499_data Count:(NSUInteger)1] retain];
    FOLLOW_atom_in_aexpr521 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr521_data Count:(NSUInteger)1] retain];
    FOLLOW_9_in_aexpr525 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_9_in_aexpr525_data Count:(NSUInteger)1] retain];
    FOLLOW_atom_in_aexpr527 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr527_data Count:(NSUInteger)1] retain];
    FOLLOW_ID_in_atom547 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_atom547_data Count:(NSUInteger)1] retain];
    FOLLOW_INT_in_atom561 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_atom561_data Count:(NSUInteger)1] retain];
    FOLLOW_7_in_atom575 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_atom575_data Count:(NSUInteger)1] retain];
    FOLLOW_expr_in_atom577 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_atom577_data Count:(NSUInteger)1] retain];
    FOLLOW_8_in_atom579 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_atom579_data Count:(NSUInteger)1] retain];

    [ANTLRBaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>", 
 @"ID", @"INT", @"WS", @"'('", @"')'", @"'+'", @"','", @"';'", @"'<'", @"'='", 
 @"'=='", @"'char'", @"'for'", @"'int'", @"'void'", @"'{'", @"'}'", nil] retain]];
    [ANTLRBaseRecognizer setGrammarFileName:@"SimpleC.g"];
}

+ (SimpleCParser *)newSimpleCParser:(id<ANTLRTokenStream>)aStream
{
    return [[SimpleCParser alloc] initWithTokenStream:aStream];


}

- (id) initWithTokenStream:(id<ANTLRTokenStream>)aStream
{
    self = [super initWithTokenStream:aStream State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:15+1] retain]];
    if ( self != nil ) {


        dfa2 = [DFA2 newDFA2WithRecognizer:self];
        /* start of actions-actionScope-init */
        /* start of init */
    }
    return self;
}

- (void) dealloc
{
    [dfa2 release];
    [super dealloc];
}

/* ObjC start members */
/* ObjC end members */
/* ObjC start actions.(actionScope).methods */
/* ObjC end actions.(actionScope).methods */
/* ObjC start methods() */
/* ObjC end methods() */
/* ObjC start rules */
/*
 * $ANTLR start program
 * SimpleC.g:7:1: program : ( declaration )+ ;
 */
- (void) program
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:8:5: ( ( declaration )+ ) // ruleBlockSingleAlt
        // SimpleC.g:8:9: ( declaration )+ // alt
        {
        // SimpleC.g:8:9: ( declaration )+ // positiveClosureBlock
        NSInteger cnt1 = 0;
        do {
            NSInteger alt1 = 2;
            NSInteger LA1_0 = [input LA:1];
            if ( (LA1_0==ID||LA1_0==15||(LA1_0 >= 17 && LA1_0 <= 18)) ) {
                alt1=1;
            }


            switch (alt1) {
                case 1 : ;
                    // SimpleC.g:8:9: declaration // alt
                    {
                    /* ruleRef */
                    [self pushFollow:FOLLOW_declaration_in_program28];
                    [self declaration];

                    [self popFollow];



                    }
                    break;

                default :
                    if ( cnt1 >= 1 )
                        goto loop1;
                    ANTLREarlyExitException *eee =
                        [ANTLREarlyExitException newException:input decisionNumber:1];
                    @throw eee;
            }
            cnt1++;
        } while (YES);
        loop1: ;


        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end program */

/*
 * $ANTLR start declaration
 * SimpleC.g:20:1: declaration : ( variable | functionHeader ';' | functionHeader block );
 */
- (void) declaration
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
         NSString * functionHeader1 = nil ;
         
         NSString * functionHeader2 = nil ;
         

        // SimpleC.g:21:5: ( variable | functionHeader ';' | functionHeader block ) //ruleblock
        NSInteger alt2=3;
        alt2 = [dfa2 predict:input];
        switch (alt2) {
            case 1 : ;
                // SimpleC.g:21:9: variable // alt
                {
                /* ruleRef */
                [self pushFollow:FOLLOW_variable_in_declaration50];
                [self variable];

                [self popFollow];



                }
                break;
            case 2 : ;
                // SimpleC.g:22:9: functionHeader ';' // alt
                {
                /* ruleRef */
                [self pushFollow:FOLLOW_functionHeader_in_declaration60];
                functionHeader1 = [self functionHeader];

                [self popFollow];



                [self match:input TokenType:11 Follow:FOLLOW_11_in_declaration62]; 

                 NSLog(@"%@ is a declaration\n", functionHeader1
                ); 


                }
                break;
            case 3 : ;
                // SimpleC.g:24:9: functionHeader block // alt
                {
                /* ruleRef */
                [self pushFollow:FOLLOW_functionHeader_in_declaration75];
                functionHeader2 = [self functionHeader];

                [self popFollow];



                /* ruleRef */
                [self pushFollow:FOLLOW_block_in_declaration77];
                [self block];

                [self popFollow];



                 NSLog(@"%@ is a definition\n", functionHeader2
                ); 


                }
                break;

        }
        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end declaration */

/*
 * $ANTLR start variable
 * SimpleC.g:28:1: variable : type declarator ';' ;
 */
- (void) variable
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:29:5: ( type declarator ';' ) // ruleBlockSingleAlt
        // SimpleC.g:29:9: type declarator ';' // alt
        {
        /* ruleRef */
        [self pushFollow:FOLLOW_type_in_variable99];
        [self type];

        [self popFollow];



        /* ruleRef */
        [self pushFollow:FOLLOW_declarator_in_variable101];
        [self declarator];

        [self popFollow];



        [self match:input TokenType:11 Follow:FOLLOW_11_in_variable103]; 

        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end variable */

/*
 * $ANTLR start declarator
 * SimpleC.g:32:1: declarator : ID ;
 */
- (void) declarator
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:33:5: ( ID ) // ruleBlockSingleAlt
        // SimpleC.g:33:9: ID // alt
        {
        [self match:input TokenType:ID Follow:FOLLOW_ID_in_declarator122]; 

        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end declarator */

/*
 * $ANTLR start functionHeader
 * SimpleC.g:36:1: functionHeader returns [NSString *name] : type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ;
 */
- (NSString *) functionHeader
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    NSString * name = nil ;



        name=nil; // for now you must init here rather than in 'returns'

    @try {
        ANTLRCommonToken *ID3 = nil;

        // SimpleC.g:40:5: ( type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ) // ruleBlockSingleAlt
        // SimpleC.g:40:9: type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' // alt
        {
        /* ruleRef */
        [self pushFollow:FOLLOW_type_in_functionHeader151];
        [self type];

        [self popFollow];



        ID3=(ANTLRCommonToken *)[self match:input TokenType:ID Follow:FOLLOW_ID_in_functionHeader153]; 

        [self match:input TokenType:7 Follow:FOLLOW_7_in_functionHeader155]; 

        // SimpleC.g:40:21: ( formalParameter ( ',' formalParameter )* )? // block
        NSInteger alt4=2;
        NSInteger LA4_0 = [input LA:1];

        if ( (LA4_0==ID||LA4_0==15||(LA4_0 >= 17 && LA4_0 <= 18)) ) {
            alt4=1;
        }
        switch (alt4) {
            case 1 : ;
                // SimpleC.g:40:23: formalParameter ( ',' formalParameter )* // alt
                {
                /* ruleRef */
                [self pushFollow:FOLLOW_formalParameter_in_functionHeader159];
                [self formalParameter];

                [self popFollow];



                do {
                    NSInteger alt3=2;
                    NSInteger LA3_0 = [input LA:1];
                    if ( (LA3_0==10) ) {
                        alt3=1;
                    }


                    switch (alt3) {
                        case 1 : ;
                            // SimpleC.g:40:41: ',' formalParameter // alt
                            {
                            [self match:input TokenType:10 Follow:FOLLOW_10_in_functionHeader163]; 

                            /* ruleRef */
                            [self pushFollow:FOLLOW_formalParameter_in_functionHeader165];
                            [self formalParameter];

                            [self popFollow];



                            }
                            break;

                        default :
                            goto loop3;
                    }
                } while (YES);
                loop3: ;


                }
                break;

        }


        [self match:input TokenType:8 Follow:FOLLOW_8_in_functionHeader173]; 

        name =  (ID3!=nil?ID3.text:nil);



        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return name;
}
/* $ANTLR end functionHeader */

/*
 * $ANTLR start formalParameter
 * SimpleC.g:44:1: formalParameter : type declarator ;
 */
- (void) formalParameter
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:45:5: ( type declarator ) // ruleBlockSingleAlt
        // SimpleC.g:45:9: type declarator // alt
        {
        /* ruleRef */
        [self pushFollow:FOLLOW_type_in_formalParameter195];
        [self type];

        [self popFollow];



        /* ruleRef */
        [self pushFollow:FOLLOW_declarator_in_formalParameter197];
        [self declarator];

        [self popFollow];



        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end formalParameter */

/*
 * $ANTLR start type
 * SimpleC.g:48:1: type : ( 'int' | 'char' | 'void' | ID );
 */
- (void) type
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:49:5: ( 'int' | 'char' | 'void' | ID ) // ruleBlockSingleAlt
        // SimpleC.g: // alt
        {
        if ([input LA:1] == ID||[input LA:1] == 15||(([input LA:1] >= 17) && ([input LA:1] <= 18))) {
            [input consume];
            [state setIsErrorRecovery:NO];
        } else {
            ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input];
            @throw mse;
        }


        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end type */

/*
 * $ANTLR start block
 * SimpleC.g:55:1: block : '{' ( variable )* ( stat )* '}' ;
 */
- (void) block
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:56:5: ( '{' ( variable )* ( stat )* '}' ) // ruleBlockSingleAlt
        // SimpleC.g:56:9: '{' ( variable )* ( stat )* '}' // alt
        {
        [self match:input TokenType:19 Follow:FOLLOW_19_in_block286]; 

        do {
            NSInteger alt5=2;
            NSInteger LA5_0 = [input LA:1];
            if ( (LA5_0==ID) ) {
                NSInteger LA5_2 = [input LA:2];
                if ( (LA5_2==ID) ) {
                    alt5=1;
                }


            }
            else if ( (LA5_0==15||(LA5_0 >= 17 && LA5_0 <= 18)) ) {
                alt5=1;
            }


            switch (alt5) {
                case 1 : ;
                    // SimpleC.g:57:13: variable // alt
                    {
                    /* ruleRef */
                    [self pushFollow:FOLLOW_variable_in_block300];
                    [self variable];

                    [self popFollow];



                    }
                    break;

                default :
                    goto loop5;
            }
        } while (YES);
        loop5: ;


        do {
            NSInteger alt6=2;
            NSInteger LA6_0 = [input LA:1];
            if ( ((LA6_0 >= ID && LA6_0 <= INT)||LA6_0==7||LA6_0==11||LA6_0==16||LA6_0==19) ) {
                alt6=1;
            }


            switch (alt6) {
                case 1 : ;
                    // SimpleC.g:58:13: stat // alt
                    {
                    /* ruleRef */
                    [self pushFollow:FOLLOW_stat_in_block315];
                    [self stat];

                    [self popFollow];



                    }
                    break;

                default :
                    goto loop6;
            }
        } while (YES);
        loop6: ;


        [self match:input TokenType:20 Follow:FOLLOW_20_in_block326]; 

        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end block */

/*
 * $ANTLR start stat
 * SimpleC.g:62:1: stat : ( forStat | expr ';' | block | assignStat ';' | ';' );
 */
- (void) stat
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:62:5: ( forStat | expr ';' | block | assignStat ';' | ';' ) //ruleblock
        NSInteger alt7=5;
        unichar charLA7 = [input LA:1];
        switch (charLA7) {
            case 16: ;
                {
                alt7=1;
                }
                break;
            case ID: ;
                {
                NSInteger LA7_2 = [input LA:2];

                if ( (LA7_2==13) ) {
                    alt7=4;
                }
                else if ( (LA7_2==9||(LA7_2 >= 11 && LA7_2 <= 12)||LA7_2==14) ) {
                    alt7=2;
                }
                else {
                    ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:7 state:2 stream:input];
                    nvae.c = LA7_2;
                    @throw nvae;

                }
                }
                break;
            case INT: ;
            case 7: ;
                {
                alt7=2;
                }
                break;
            case 19: ;
                {
                alt7=3;
                }
                break;
            case 11: ;
                {
                alt7=5;
                }
                break;

        default: ;
            ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:7 state:0 stream:input];
            nvae.c = charLA7;
            @throw nvae;

        }

        switch (alt7) {
            case 1 : ;
                // SimpleC.g:62:7: forStat // alt
                {
                /* ruleRef */
                [self pushFollow:FOLLOW_forStat_in_stat338];
                [self forStat];

                [self popFollow];



                }
                break;
            case 2 : ;
                // SimpleC.g:63:7: expr ';' // alt
                {
                /* ruleRef */
                [self pushFollow:FOLLOW_expr_in_stat346];
                [self expr];

                [self popFollow];



                [self match:input TokenType:11 Follow:FOLLOW_11_in_stat348]; 

                }
                break;
            case 3 : ;
                // SimpleC.g:64:7: block // alt
                {
                /* ruleRef */
                [self pushFollow:FOLLOW_block_in_stat362];
                [self block];

                [self popFollow];



                }
                break;
            case 4 : ;
                // SimpleC.g:65:7: assignStat ';' // alt
                {
                /* ruleRef */
                [self pushFollow:FOLLOW_assignStat_in_stat370];
                [self assignStat];

                [self popFollow];



                [self match:input TokenType:11 Follow:FOLLOW_11_in_stat372]; 

                }
                break;
            case 5 : ;
                // SimpleC.g:66:7: ';' // alt
                {
                [self match:input TokenType:11 Follow:FOLLOW_11_in_stat380]; 

                }
                break;

        }
        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end stat */

/*
 * $ANTLR start forStat
 * SimpleC.g:69:1: forStat : 'for' '(' assignStat ';' expr ';' assignStat ')' block ;
 */
- (void) forStat
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:70:5: ( 'for' '(' assignStat ';' expr ';' assignStat ')' block ) // ruleBlockSingleAlt
        // SimpleC.g:70:9: 'for' '(' assignStat ';' expr ';' assignStat ')' block // alt
        {
        [self match:input TokenType:16 Follow:FOLLOW_16_in_forStat399]; 

        [self match:input TokenType:7 Follow:FOLLOW_7_in_forStat401]; 

        /* ruleRef */
        [self pushFollow:FOLLOW_assignStat_in_forStat403];
        [self assignStat];

        [self popFollow];



        [self match:input TokenType:11 Follow:FOLLOW_11_in_forStat405]; 

        /* ruleRef */
        [self pushFollow:FOLLOW_expr_in_forStat407];
        [self expr];

        [self popFollow];



        [self match:input TokenType:11 Follow:FOLLOW_11_in_forStat409]; 

        /* ruleRef */
        [self pushFollow:FOLLOW_assignStat_in_forStat411];
        [self assignStat];

        [self popFollow];



        [self match:input TokenType:8 Follow:FOLLOW_8_in_forStat413]; 

        /* ruleRef */
        [self pushFollow:FOLLOW_block_in_forStat415];
        [self block];

        [self popFollow];



        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end forStat */

/*
 * $ANTLR start assignStat
 * SimpleC.g:73:1: assignStat : ID '=' expr ;
 */
- (void) assignStat
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:74:5: ( ID '=' expr ) // ruleBlockSingleAlt
        // SimpleC.g:74:9: ID '=' expr // alt
        {
        [self match:input TokenType:ID Follow:FOLLOW_ID_in_assignStat442]; 

        [self match:input TokenType:13 Follow:FOLLOW_13_in_assignStat444]; 

        /* ruleRef */
        [self pushFollow:FOLLOW_expr_in_assignStat446];
        [self expr];

        [self popFollow];



        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end assignStat */

/*
 * $ANTLR start expr
 * SimpleC.g:77:1: expr : condExpr ;
 */
- (void) expr
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:77:5: ( condExpr ) // ruleBlockSingleAlt
        // SimpleC.g:77:9: condExpr // alt
        {
        /* ruleRef */
        [self pushFollow:FOLLOW_condExpr_in_expr468];
        [self condExpr];

        [self popFollow];



        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end expr */

/*
 * $ANTLR start condExpr
 * SimpleC.g:80:1: condExpr : aexpr ( ( '==' | '<' ) aexpr )? ;
 */
- (void) condExpr
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:81:5: ( aexpr ( ( '==' | '<' ) aexpr )? ) // ruleBlockSingleAlt
        // SimpleC.g:81:9: aexpr ( ( '==' | '<' ) aexpr )? // alt
        {
        /* ruleRef */
        [self pushFollow:FOLLOW_aexpr_in_condExpr487];
        [self aexpr];

        [self popFollow];



        // SimpleC.g:81:15: ( ( '==' | '<' ) aexpr )? // block
        NSInteger alt8=2;
        NSInteger LA8_0 = [input LA:1];

        if ( (LA8_0==12||LA8_0==14) ) {
            alt8=1;
        }
        switch (alt8) {
            case 1 : ;
                // SimpleC.g:81:17: ( '==' | '<' ) aexpr // alt
                {
                if ([input LA:1] == 12||[input LA:1] == 14) {
                    [input consume];
                    [state setIsErrorRecovery:NO];
                } else {
                    ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input];
                    @throw mse;
                }


                /* ruleRef */
                [self pushFollow:FOLLOW_aexpr_in_condExpr499];
                [self aexpr];

                [self popFollow];



                }
                break;

        }


        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end condExpr */

/*
 * $ANTLR start aexpr
 * SimpleC.g:84:1: aexpr : atom ( '+' atom )* ;
 */
- (void) aexpr
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:85:5: ( atom ( '+' atom )* ) // ruleBlockSingleAlt
        // SimpleC.g:85:9: atom ( '+' atom )* // alt
        {
        /* ruleRef */
        [self pushFollow:FOLLOW_atom_in_aexpr521];
        [self atom];

        [self popFollow];



        do {
            NSInteger alt9=2;
            NSInteger LA9_0 = [input LA:1];
            if ( (LA9_0==9) ) {
                alt9=1;
            }


            switch (alt9) {
                case 1 : ;
                    // SimpleC.g:85:16: '+' atom // alt
                    {
                    [self match:input TokenType:9 Follow:FOLLOW_9_in_aexpr525]; 

                    /* ruleRef */
                    [self pushFollow:FOLLOW_atom_in_aexpr527];
                    [self atom];

                    [self popFollow];



                    }
                    break;

                default :
                    goto loop9;
            }
        } while (YES);
        loop9: ;


        }

        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end aexpr */

/*
 * $ANTLR start atom
 * SimpleC.g:88:1: atom : ( ID | INT | '(' expr ')' );
 */
- (void) atom
{
    /* my ruleScopeSetUp */
    /* Terence's stuff */

    @try {
        // SimpleC.g:89:5: ( ID | INT | '(' expr ')' ) //ruleblock
        NSInteger alt10=3;
        unichar charLA10 = [input LA:1];
        switch (charLA10) {
            case ID: ;
                {
                alt10=1;
                }
                break;
            case INT: ;
                {
                alt10=2;
                }
                break;
            case 7: ;
                {
                alt10=3;
                }
                break;

        default: ;
            ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:10 state:0 stream:input];
            nvae.c = charLA10;
            @throw nvae;

        }

        switch (alt10) {
            case 1 : ;
                // SimpleC.g:89:7: ID // alt
                {
                [self match:input TokenType:ID Follow:FOLLOW_ID_in_atom547]; 

                }
                break;
            case 2 : ;
                // SimpleC.g:90:7: INT // alt
                {
                [self match:input TokenType:INT Follow:FOLLOW_INT_in_atom561]; 

                }
                break;
            case 3 : ;
                // SimpleC.g:91:7: '(' expr ')' // alt
                {
                [self match:input TokenType:7 Follow:FOLLOW_7_in_atom575]; 

                /* ruleRef */
                [self pushFollow:FOLLOW_expr_in_atom577];
                [self expr];

                [self popFollow];



                [self match:input TokenType:8 Follow:FOLLOW_8_in_atom579]; 

                }
                break;

        }
        // token+rule list labels

    }
    @catch (ANTLRRecognitionException *re) {
        [self reportError:re];
        [self recover:input Exception:re];
    }

    @finally {
        /* my stuff */
        /* Terence's stuff */

    }
    return ;
}
/* $ANTLR end atom */
/* ObjC end rules */

@end /* end of SimpleCParser implementation line 692 */