PageRenderTime 105ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 1ms

/projects/antlr-3.4/runtime/ObjC/Framework/examples/LL-star/SimpleCParser.m

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Objective C | 1438 lines | 842 code | 327 blank | 269 comment | 51 complexity | 7f1d5856e31a3fd0f67ed860ce10d0d1 MD5 | raw file
  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 13:53:12
  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 13:53:12
  15. /* -----------------------------------------
  16. * Include the ANTLR3 generated header file.
  17. */
  18. #import "SimpleCParser.h"
  19. /* ----------------------------------------- */
  20. /* ============================================================================= */
  21. /* =============================================================================
  22. * Start of recognizer
  23. */
  24. #pragma mark Cyclic DFA implementation start DFA2
  25. @implementation DFA2
  26. const static NSInteger dfa2_eot[13] =
  27. {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
  28. const static NSInteger dfa2_eof[13] =
  29. {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
  30. const static unichar dfa2_min[13] =
  31. {4,4,7,4,0,4,11,8,0,0,4,4,8};
  32. const static unichar dfa2_max[13] =
  33. {18,4,11,18,0,4,19,10,0,0,18,4,10};
  34. const static NSInteger dfa2_accept[13] =
  35. {-1,-1,-1,-1,1,-1,-1,-1,2,3,-1,-1,-1};
  36. const static NSInteger dfa2_special[13] =
  37. {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
  38. const static NSInteger dfa2_transition[] = {};
  39. const static NSInteger dfa2_transition0[] = {3, -1, -1, -1, 4};
  40. const static NSInteger dfa2_transition1[] = {6, -1, 10};
  41. const static NSInteger dfa2_transition2[] = {8, -1, -1, -1, -1, -1, -1,
  42. -1, 9};
  43. const static NSInteger dfa2_transition3[] = {2};
  44. const static NSInteger dfa2_transition4[] = {1, -1, -1, -1, -1, -1, -1,
  45. -1, -1, -1, -1, 1, -1, 1, 1};
  46. const static NSInteger dfa2_transition5[] = {7};
  47. const static NSInteger dfa2_transition6[] = {11, -1, -1, -1, -1, -1, -1,
  48. -1, -1, -1, -1, 11, -1, 11, 11};
  49. const static NSInteger dfa2_transition7[] = {12};
  50. const static NSInteger dfa2_transition8[] = {5, -1, -1, -1, 6, -1, -1, -1,
  51. -1, -1, -1, 5, -1, 5, 5};
  52. + (id) newDFA2WithRecognizer:(ANTLRBaseRecognizer *)aRecognizer
  53. {
  54. return [[[DFA2 alloc] initWithRecognizer:aRecognizer] retain];
  55. }
  56. - (id) initWithRecognizer:(ANTLRBaseRecognizer *) theRecognizer
  57. {
  58. self = [super initWithRecognizer:theRecognizer];
  59. if ( self != nil ) {
  60. decisionNumber = 2;
  61. eot = dfa2_eot;
  62. eof = dfa2_eof;
  63. min = dfa2_min;
  64. max = dfa2_max;
  65. accept = dfa2_accept;
  66. special = dfa2_special;
  67. if (!(transition = calloc(13, sizeof(void*)))) {
  68. [self release];
  69. return nil;
  70. }
  71. len = 13;
  72. transition[0] = dfa2_transition4;
  73. transition[1] = dfa2_transition3;
  74. transition[2] = dfa2_transition0;
  75. transition[3] = dfa2_transition8;
  76. transition[4] = dfa2_transition5;
  77. transition[5] = dfa2_transition2;
  78. transition[6] = dfa2_transition1;
  79. transition[7] = dfa2_transition6;
  80. transition[8] = dfa2_transition7;
  81. transition[9] = dfa2_transition1;
  82. }
  83. return self;
  84. }
  85. - (void) dealloc
  86. {
  87. free(transition);
  88. [super dealloc];
  89. }
  90. - (NSString *) description
  91. {
  92. return @"20:1: declaration : ( variable | functionHeader ';' | functionHeader block );";
  93. }
  94. @end /* end DFA2 implementation */
  95. #pragma mark Cyclic DFA implementation end DFA2
  96. #pragma mark Bitsets
  97. static ANTLRBitSet *FOLLOW_declaration_in_program28;
  98. static const unsigned long long FOLLOW_declaration_in_program28_data[] = { 0x0000000000068012LL};
  99. static ANTLRBitSet *FOLLOW_variable_in_declaration50;
  100. static const unsigned long long FOLLOW_variable_in_declaration50_data[] = { 0x0000000000000002LL};
  101. static ANTLRBitSet *FOLLOW_functionHeader_in_declaration60;
  102. static const unsigned long long FOLLOW_functionHeader_in_declaration60_data[] = { 0x0000000000000800LL};
  103. static ANTLRBitSet *FOLLOW_11_in_declaration62;
  104. static const unsigned long long FOLLOW_11_in_declaration62_data[] = { 0x0000000000000002LL};
  105. static ANTLRBitSet *FOLLOW_functionHeader_in_declaration75;
  106. static const unsigned long long FOLLOW_functionHeader_in_declaration75_data[] = { 0x0000000000080000LL};
  107. static ANTLRBitSet *FOLLOW_block_in_declaration77;
  108. static const unsigned long long FOLLOW_block_in_declaration77_data[] = { 0x0000000000000002LL};
  109. static ANTLRBitSet *FOLLOW_type_in_variable99;
  110. static const unsigned long long FOLLOW_type_in_variable99_data[] = { 0x0000000000000010LL};
  111. static ANTLRBitSet *FOLLOW_declarator_in_variable101;
  112. static const unsigned long long FOLLOW_declarator_in_variable101_data[] = { 0x0000000000000800LL};
  113. static ANTLRBitSet *FOLLOW_11_in_variable103;
  114. static const unsigned long long FOLLOW_11_in_variable103_data[] = { 0x0000000000000002LL};
  115. static ANTLRBitSet *FOLLOW_ID_in_declarator122;
  116. static const unsigned long long FOLLOW_ID_in_declarator122_data[] = { 0x0000000000000002LL};
  117. static ANTLRBitSet *FOLLOW_type_in_functionHeader151;
  118. static const unsigned long long FOLLOW_type_in_functionHeader151_data[] = { 0x0000000000000010LL};
  119. static ANTLRBitSet *FOLLOW_ID_in_functionHeader153;
  120. static const unsigned long long FOLLOW_ID_in_functionHeader153_data[] = { 0x0000000000000080LL};
  121. static ANTLRBitSet *FOLLOW_7_in_functionHeader155;
  122. static const unsigned long long FOLLOW_7_in_functionHeader155_data[] = { 0x0000000000068110LL};
  123. static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader159;
  124. static const unsigned long long FOLLOW_formalParameter_in_functionHeader159_data[] = { 0x0000000000000500LL};
  125. static ANTLRBitSet *FOLLOW_10_in_functionHeader163;
  126. static const unsigned long long FOLLOW_10_in_functionHeader163_data[] = { 0x0000000000068010LL};
  127. static ANTLRBitSet *FOLLOW_formalParameter_in_functionHeader165;
  128. static const unsigned long long FOLLOW_formalParameter_in_functionHeader165_data[] = { 0x0000000000000500LL};
  129. static ANTLRBitSet *FOLLOW_8_in_functionHeader173;
  130. static const unsigned long long FOLLOW_8_in_functionHeader173_data[] = { 0x0000000000000002LL};
  131. static ANTLRBitSet *FOLLOW_type_in_formalParameter195;
  132. static const unsigned long long FOLLOW_type_in_formalParameter195_data[] = { 0x0000000000000010LL};
  133. static ANTLRBitSet *FOLLOW_declarator_in_formalParameter197;
  134. static const unsigned long long FOLLOW_declarator_in_formalParameter197_data[] = { 0x0000000000000002LL};
  135. static ANTLRBitSet *FOLLOW_19_in_block286;
  136. static const unsigned long long FOLLOW_19_in_block286_data[] = { 0x00000000001F88B0LL};
  137. static ANTLRBitSet *FOLLOW_variable_in_block300;
  138. static const unsigned long long FOLLOW_variable_in_block300_data[] = { 0x00000000001F88B0LL};
  139. static ANTLRBitSet *FOLLOW_stat_in_block315;
  140. static const unsigned long long FOLLOW_stat_in_block315_data[] = { 0x00000000001908B0LL};
  141. static ANTLRBitSet *FOLLOW_20_in_block326;
  142. static const unsigned long long FOLLOW_20_in_block326_data[] = { 0x0000000000000002LL};
  143. static ANTLRBitSet *FOLLOW_forStat_in_stat338;
  144. static const unsigned long long FOLLOW_forStat_in_stat338_data[] = { 0x0000000000000002LL};
  145. static ANTLRBitSet *FOLLOW_expr_in_stat346;
  146. static const unsigned long long FOLLOW_expr_in_stat346_data[] = { 0x0000000000000800LL};
  147. static ANTLRBitSet *FOLLOW_11_in_stat348;
  148. static const unsigned long long FOLLOW_11_in_stat348_data[] = { 0x0000000000000002LL};
  149. static ANTLRBitSet *FOLLOW_block_in_stat362;
  150. static const unsigned long long FOLLOW_block_in_stat362_data[] = { 0x0000000000000002LL};
  151. static ANTLRBitSet *FOLLOW_assignStat_in_stat370;
  152. static const unsigned long long FOLLOW_assignStat_in_stat370_data[] = { 0x0000000000000800LL};
  153. static ANTLRBitSet *FOLLOW_11_in_stat372;
  154. static const unsigned long long FOLLOW_11_in_stat372_data[] = { 0x0000000000000002LL};
  155. static ANTLRBitSet *FOLLOW_11_in_stat380;
  156. static const unsigned long long FOLLOW_11_in_stat380_data[] = { 0x0000000000000002LL};
  157. static ANTLRBitSet *FOLLOW_16_in_forStat399;
  158. static const unsigned long long FOLLOW_16_in_forStat399_data[] = { 0x0000000000000080LL};
  159. static ANTLRBitSet *FOLLOW_7_in_forStat401;
  160. static const unsigned long long FOLLOW_7_in_forStat401_data[] = { 0x0000000000000010LL};
  161. static ANTLRBitSet *FOLLOW_assignStat_in_forStat403;
  162. static const unsigned long long FOLLOW_assignStat_in_forStat403_data[] = { 0x0000000000000800LL};
  163. static ANTLRBitSet *FOLLOW_11_in_forStat405;
  164. static const unsigned long long FOLLOW_11_in_forStat405_data[] = { 0x00000000000000B0LL};
  165. static ANTLRBitSet *FOLLOW_expr_in_forStat407;
  166. static const unsigned long long FOLLOW_expr_in_forStat407_data[] = { 0x0000000000000800LL};
  167. static ANTLRBitSet *FOLLOW_11_in_forStat409;
  168. static const unsigned long long FOLLOW_11_in_forStat409_data[] = { 0x0000000000000010LL};
  169. static ANTLRBitSet *FOLLOW_assignStat_in_forStat411;
  170. static const unsigned long long FOLLOW_assignStat_in_forStat411_data[] = { 0x0000000000000100LL};
  171. static ANTLRBitSet *FOLLOW_8_in_forStat413;
  172. static const unsigned long long FOLLOW_8_in_forStat413_data[] = { 0x0000000000080000LL};
  173. static ANTLRBitSet *FOLLOW_block_in_forStat415;
  174. static const unsigned long long FOLLOW_block_in_forStat415_data[] = { 0x0000000000000002LL};
  175. static ANTLRBitSet *FOLLOW_ID_in_assignStat442;
  176. static const unsigned long long FOLLOW_ID_in_assignStat442_data[] = { 0x0000000000002000LL};
  177. static ANTLRBitSet *FOLLOW_13_in_assignStat444;
  178. static const unsigned long long FOLLOW_13_in_assignStat444_data[] = { 0x00000000000000B0LL};
  179. static ANTLRBitSet *FOLLOW_expr_in_assignStat446;
  180. static const unsigned long long FOLLOW_expr_in_assignStat446_data[] = { 0x0000000000000002LL};
  181. static ANTLRBitSet *FOLLOW_condExpr_in_expr468;
  182. static const unsigned long long FOLLOW_condExpr_in_expr468_data[] = { 0x0000000000000002LL};
  183. static ANTLRBitSet *FOLLOW_aexpr_in_condExpr487;
  184. static const unsigned long long FOLLOW_aexpr_in_condExpr487_data[] = { 0x0000000000005002LL};
  185. static ANTLRBitSet *FOLLOW_set_in_condExpr491;
  186. static const unsigned long long FOLLOW_set_in_condExpr491_data[] = { 0x00000000000000B0LL};
  187. static ANTLRBitSet *FOLLOW_aexpr_in_condExpr499;
  188. static const unsigned long long FOLLOW_aexpr_in_condExpr499_data[] = { 0x0000000000000002LL};
  189. static ANTLRBitSet *FOLLOW_atom_in_aexpr521;
  190. static const unsigned long long FOLLOW_atom_in_aexpr521_data[] = { 0x0000000000000202LL};
  191. static ANTLRBitSet *FOLLOW_9_in_aexpr525;
  192. static const unsigned long long FOLLOW_9_in_aexpr525_data[] = { 0x00000000000000B0LL};
  193. static ANTLRBitSet *FOLLOW_atom_in_aexpr527;
  194. static const unsigned long long FOLLOW_atom_in_aexpr527_data[] = { 0x0000000000000202LL};
  195. static ANTLRBitSet *FOLLOW_ID_in_atom547;
  196. static const unsigned long long FOLLOW_ID_in_atom547_data[] = { 0x0000000000000002LL};
  197. static ANTLRBitSet *FOLLOW_INT_in_atom561;
  198. static const unsigned long long FOLLOW_INT_in_atom561_data[] = { 0x0000000000000002LL};
  199. static ANTLRBitSet *FOLLOW_7_in_atom575;
  200. static const unsigned long long FOLLOW_7_in_atom575_data[] = { 0x00000000000000B0LL};
  201. static ANTLRBitSet *FOLLOW_expr_in_atom577;
  202. static const unsigned long long FOLLOW_expr_in_atom577_data[] = { 0x0000000000000100LL};
  203. static ANTLRBitSet *FOLLOW_8_in_atom579;
  204. static const unsigned long long FOLLOW_8_in_atom579_data[] = { 0x0000000000000002LL};
  205. #pragma mark Dynamic Global Scopes
  206. #pragma mark Dynamic Rule Scopes
  207. #pragma mark Rule Return Scopes start
  208. //#pragma mark Rule return scopes start
  209. //
  210. #pragma mark Rule return scopes start
  211. @implementation SimpleCParser // line 637
  212. /* ObjC start of ruleAttributeScope */
  213. #pragma mark Dynamic Rule Scopes
  214. /* ObjC end of ruleAttributeScope */
  215. #pragma mark global Attribute Scopes
  216. /* ObjC start globalAttributeScope */
  217. /* ObjC end globalAttributeScope */
  218. /* ObjC start actions.(actionScope).synthesize */
  219. /* ObjC end actions.(actionScope).synthesize */
  220. /* ObjC start synthesize() */
  221. /* ObjC end synthesize() */
  222. + (void) initialize
  223. {
  224. #pragma mark Bitsets
  225. FOLLOW_declaration_in_program28 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declaration_in_program28_data Count:(NSUInteger)1] retain];
  226. FOLLOW_variable_in_declaration50 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_declaration50_data Count:(NSUInteger)1] retain];
  227. FOLLOW_functionHeader_in_declaration60 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration60_data Count:(NSUInteger)1] retain];
  228. FOLLOW_11_in_declaration62 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_declaration62_data Count:(NSUInteger)1] retain];
  229. FOLLOW_functionHeader_in_declaration75 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_functionHeader_in_declaration75_data Count:(NSUInteger)1] retain];
  230. FOLLOW_block_in_declaration77 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_declaration77_data Count:(NSUInteger)1] retain];
  231. FOLLOW_type_in_variable99 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_variable99_data Count:(NSUInteger)1] retain];
  232. FOLLOW_declarator_in_variable101 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_variable101_data Count:(NSUInteger)1] retain];
  233. FOLLOW_11_in_variable103 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_variable103_data Count:(NSUInteger)1] retain];
  234. FOLLOW_ID_in_declarator122 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_declarator122_data Count:(NSUInteger)1] retain];
  235. FOLLOW_type_in_functionHeader151 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_functionHeader151_data Count:(NSUInteger)1] retain];
  236. FOLLOW_ID_in_functionHeader153 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_functionHeader153_data Count:(NSUInteger)1] retain];
  237. FOLLOW_7_in_functionHeader155 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_functionHeader155_data Count:(NSUInteger)1] retain];
  238. FOLLOW_formalParameter_in_functionHeader159 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader159_data Count:(NSUInteger)1] retain];
  239. FOLLOW_10_in_functionHeader163 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_10_in_functionHeader163_data Count:(NSUInteger)1] retain];
  240. FOLLOW_formalParameter_in_functionHeader165 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_formalParameter_in_functionHeader165_data Count:(NSUInteger)1] retain];
  241. FOLLOW_8_in_functionHeader173 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_functionHeader173_data Count:(NSUInteger)1] retain];
  242. FOLLOW_type_in_formalParameter195 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_type_in_formalParameter195_data Count:(NSUInteger)1] retain];
  243. FOLLOW_declarator_in_formalParameter197 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_declarator_in_formalParameter197_data Count:(NSUInteger)1] retain];
  244. FOLLOW_19_in_block286 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_19_in_block286_data Count:(NSUInteger)1] retain];
  245. FOLLOW_variable_in_block300 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_variable_in_block300_data Count:(NSUInteger)1] retain];
  246. FOLLOW_stat_in_block315 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_stat_in_block315_data Count:(NSUInteger)1] retain];
  247. FOLLOW_20_in_block326 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_20_in_block326_data Count:(NSUInteger)1] retain];
  248. FOLLOW_forStat_in_stat338 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_forStat_in_stat338_data Count:(NSUInteger)1] retain];
  249. FOLLOW_expr_in_stat346 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_stat346_data Count:(NSUInteger)1] retain];
  250. FOLLOW_11_in_stat348 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat348_data Count:(NSUInteger)1] retain];
  251. FOLLOW_block_in_stat362 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_stat362_data Count:(NSUInteger)1] retain];
  252. FOLLOW_assignStat_in_stat370 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_stat370_data Count:(NSUInteger)1] retain];
  253. FOLLOW_11_in_stat372 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat372_data Count:(NSUInteger)1] retain];
  254. FOLLOW_11_in_stat380 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_stat380_data Count:(NSUInteger)1] retain];
  255. FOLLOW_16_in_forStat399 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_16_in_forStat399_data Count:(NSUInteger)1] retain];
  256. FOLLOW_7_in_forStat401 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_forStat401_data Count:(NSUInteger)1] retain];
  257. FOLLOW_assignStat_in_forStat403 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat403_data Count:(NSUInteger)1] retain];
  258. FOLLOW_11_in_forStat405 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat405_data Count:(NSUInteger)1] retain];
  259. FOLLOW_expr_in_forStat407 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_forStat407_data Count:(NSUInteger)1] retain];
  260. FOLLOW_11_in_forStat409 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_11_in_forStat409_data Count:(NSUInteger)1] retain];
  261. FOLLOW_assignStat_in_forStat411 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_assignStat_in_forStat411_data Count:(NSUInteger)1] retain];
  262. FOLLOW_8_in_forStat413 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_forStat413_data Count:(NSUInteger)1] retain];
  263. FOLLOW_block_in_forStat415 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_block_in_forStat415_data Count:(NSUInteger)1] retain];
  264. FOLLOW_ID_in_assignStat442 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_assignStat442_data Count:(NSUInteger)1] retain];
  265. FOLLOW_13_in_assignStat444 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_13_in_assignStat444_data Count:(NSUInteger)1] retain];
  266. FOLLOW_expr_in_assignStat446 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_assignStat446_data Count:(NSUInteger)1] retain];
  267. FOLLOW_condExpr_in_expr468 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_condExpr_in_expr468_data Count:(NSUInteger)1] retain];
  268. FOLLOW_aexpr_in_condExpr487 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr487_data Count:(NSUInteger)1] retain];
  269. FOLLOW_set_in_condExpr491 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_set_in_condExpr491_data Count:(NSUInteger)1] retain];
  270. FOLLOW_aexpr_in_condExpr499 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_aexpr_in_condExpr499_data Count:(NSUInteger)1] retain];
  271. FOLLOW_atom_in_aexpr521 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr521_data Count:(NSUInteger)1] retain];
  272. FOLLOW_9_in_aexpr525 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_9_in_aexpr525_data Count:(NSUInteger)1] retain];
  273. FOLLOW_atom_in_aexpr527 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_atom_in_aexpr527_data Count:(NSUInteger)1] retain];
  274. FOLLOW_ID_in_atom547 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_ID_in_atom547_data Count:(NSUInteger)1] retain];
  275. FOLLOW_INT_in_atom561 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_INT_in_atom561_data Count:(NSUInteger)1] retain];
  276. FOLLOW_7_in_atom575 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_7_in_atom575_data Count:(NSUInteger)1] retain];
  277. FOLLOW_expr_in_atom577 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_expr_in_atom577_data Count:(NSUInteger)1] retain];
  278. FOLLOW_8_in_atom579 = [[ANTLRBitSet newANTLRBitSetWithBits:(const unsigned long long *)FOLLOW_8_in_atom579_data Count:(NSUInteger)1] retain];
  279. [ANTLRBaseRecognizer setTokenNames:[[AMutableArray arrayWithObjects:@"<invalid>", @"<EOR>", @"<DOWN>", @"<UP>",
  280. @"ID", @"INT", @"WS", @"'('", @"')'", @"'+'", @"','", @"';'", @"'<'", @"'='",
  281. @"'=='", @"'char'", @"'for'", @"'int'", @"'void'", @"'{'", @"'}'", nil] retain]];
  282. [ANTLRBaseRecognizer setGrammarFileName:@"SimpleC.g"];
  283. }
  284. + (SimpleCParser *)newSimpleCParser:(id<ANTLRTokenStream>)aStream
  285. {
  286. return [[SimpleCParser alloc] initWithTokenStream:aStream];
  287. }
  288. - (id) initWithTokenStream:(id<ANTLRTokenStream>)aStream
  289. {
  290. self = [super initWithTokenStream:aStream State:[[ANTLRRecognizerSharedState newANTLRRecognizerSharedStateWithRuleLen:15+1] retain]];
  291. if ( self != nil ) {
  292. dfa2 = [DFA2 newDFA2WithRecognizer:self];
  293. /* start of actions-actionScope-init */
  294. /* start of init */
  295. }
  296. return self;
  297. }
  298. - (void) dealloc
  299. {
  300. [dfa2 release];
  301. [super dealloc];
  302. }
  303. /* ObjC start members */
  304. /* ObjC end members */
  305. /* ObjC start actions.(actionScope).methods */
  306. /* ObjC end actions.(actionScope).methods */
  307. /* ObjC start methods() */
  308. /* ObjC end methods() */
  309. /* ObjC start rules */
  310. /*
  311. * $ANTLR start program
  312. * SimpleC.g:7:1: program : ( declaration )+ ;
  313. */
  314. - (void) program
  315. {
  316. /* my ruleScopeSetUp */
  317. /* Terence's stuff */
  318. @try {
  319. // SimpleC.g:8:5: ( ( declaration )+ ) // ruleBlockSingleAlt
  320. // SimpleC.g:8:9: ( declaration )+ // alt
  321. {
  322. // SimpleC.g:8:9: ( declaration )+ // positiveClosureBlock
  323. NSInteger cnt1 = 0;
  324. do {
  325. NSInteger alt1 = 2;
  326. NSInteger LA1_0 = [input LA:1];
  327. if ( (LA1_0==ID||LA1_0==15||(LA1_0 >= 17 && LA1_0 <= 18)) ) {
  328. alt1=1;
  329. }
  330. switch (alt1) {
  331. case 1 : ;
  332. // SimpleC.g:8:9: declaration // alt
  333. {
  334. /* ruleRef */
  335. [self pushFollow:FOLLOW_declaration_in_program28];
  336. [self declaration];
  337. [self popFollow];
  338. }
  339. break;
  340. default :
  341. if ( cnt1 >= 1 )
  342. goto loop1;
  343. ANTLREarlyExitException *eee =
  344. [ANTLREarlyExitException newException:input decisionNumber:1];
  345. @throw eee;
  346. }
  347. cnt1++;
  348. } while (YES);
  349. loop1: ;
  350. }
  351. // token+rule list labels
  352. }
  353. @catch (ANTLRRecognitionException *re) {
  354. [self reportError:re];
  355. [self recover:input Exception:re];
  356. }
  357. @finally {
  358. /* my stuff */
  359. /* Terence's stuff */
  360. }
  361. return ;
  362. }
  363. /* $ANTLR end program */
  364. /*
  365. * $ANTLR start declaration
  366. * SimpleC.g:20:1: declaration : ( variable | functionHeader ';' | functionHeader block );
  367. */
  368. - (void) declaration
  369. {
  370. /* my ruleScopeSetUp */
  371. /* Terence's stuff */
  372. @try {
  373. NSString * functionHeader1 = nil ;
  374. NSString * functionHeader2 = nil ;
  375. // SimpleC.g:21:5: ( variable | functionHeader ';' | functionHeader block ) //ruleblock
  376. NSInteger alt2=3;
  377. alt2 = [dfa2 predict:input];
  378. switch (alt2) {
  379. case 1 : ;
  380. // SimpleC.g:21:9: variable // alt
  381. {
  382. /* ruleRef */
  383. [self pushFollow:FOLLOW_variable_in_declaration50];
  384. [self variable];
  385. [self popFollow];
  386. }
  387. break;
  388. case 2 : ;
  389. // SimpleC.g:22:9: functionHeader ';' // alt
  390. {
  391. /* ruleRef */
  392. [self pushFollow:FOLLOW_functionHeader_in_declaration60];
  393. functionHeader1 = [self functionHeader];
  394. [self popFollow];
  395. [self match:input TokenType:11 Follow:FOLLOW_11_in_declaration62];
  396. NSLog(@"%@ is a declaration\n", functionHeader1
  397. );
  398. }
  399. break;
  400. case 3 : ;
  401. // SimpleC.g:24:9: functionHeader block // alt
  402. {
  403. /* ruleRef */
  404. [self pushFollow:FOLLOW_functionHeader_in_declaration75];
  405. functionHeader2 = [self functionHeader];
  406. [self popFollow];
  407. /* ruleRef */
  408. [self pushFollow:FOLLOW_block_in_declaration77];
  409. [self block];
  410. [self popFollow];
  411. NSLog(@"%@ is a definition\n", functionHeader2
  412. );
  413. }
  414. break;
  415. }
  416. // token+rule list labels
  417. }
  418. @catch (ANTLRRecognitionException *re) {
  419. [self reportError:re];
  420. [self recover:input Exception:re];
  421. }
  422. @finally {
  423. /* my stuff */
  424. /* Terence's stuff */
  425. }
  426. return ;
  427. }
  428. /* $ANTLR end declaration */
  429. /*
  430. * $ANTLR start variable
  431. * SimpleC.g:28:1: variable : type declarator ';' ;
  432. */
  433. - (void) variable
  434. {
  435. /* my ruleScopeSetUp */
  436. /* Terence's stuff */
  437. @try {
  438. // SimpleC.g:29:5: ( type declarator ';' ) // ruleBlockSingleAlt
  439. // SimpleC.g:29:9: type declarator ';' // alt
  440. {
  441. /* ruleRef */
  442. [self pushFollow:FOLLOW_type_in_variable99];
  443. [self type];
  444. [self popFollow];
  445. /* ruleRef */
  446. [self pushFollow:FOLLOW_declarator_in_variable101];
  447. [self declarator];
  448. [self popFollow];
  449. [self match:input TokenType:11 Follow:FOLLOW_11_in_variable103];
  450. }
  451. // token+rule list labels
  452. }
  453. @catch (ANTLRRecognitionException *re) {
  454. [self reportError:re];
  455. [self recover:input Exception:re];
  456. }
  457. @finally {
  458. /* my stuff */
  459. /* Terence's stuff */
  460. }
  461. return ;
  462. }
  463. /* $ANTLR end variable */
  464. /*
  465. * $ANTLR start declarator
  466. * SimpleC.g:32:1: declarator : ID ;
  467. */
  468. - (void) declarator
  469. {
  470. /* my ruleScopeSetUp */
  471. /* Terence's stuff */
  472. @try {
  473. // SimpleC.g:33:5: ( ID ) // ruleBlockSingleAlt
  474. // SimpleC.g:33:9: ID // alt
  475. {
  476. [self match:input TokenType:ID Follow:FOLLOW_ID_in_declarator122];
  477. }
  478. // token+rule list labels
  479. }
  480. @catch (ANTLRRecognitionException *re) {
  481. [self reportError:re];
  482. [self recover:input Exception:re];
  483. }
  484. @finally {
  485. /* my stuff */
  486. /* Terence's stuff */
  487. }
  488. return ;
  489. }
  490. /* $ANTLR end declarator */
  491. /*
  492. * $ANTLR start functionHeader
  493. * SimpleC.g:36:1: functionHeader returns [NSString *name] : type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ;
  494. */
  495. - (NSString *) functionHeader
  496. {
  497. /* my ruleScopeSetUp */
  498. /* Terence's stuff */
  499. NSString * name = nil ;
  500. name=nil; // for now you must init here rather than in 'returns'
  501. @try {
  502. ANTLRCommonToken *ID3 = nil;
  503. // SimpleC.g:40:5: ( type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' ) // ruleBlockSingleAlt
  504. // SimpleC.g:40:9: type ID '(' ( formalParameter ( ',' formalParameter )* )? ')' // alt
  505. {
  506. /* ruleRef */
  507. [self pushFollow:FOLLOW_type_in_functionHeader151];
  508. [self type];
  509. [self popFollow];
  510. ID3=(ANTLRCommonToken *)[self match:input TokenType:ID Follow:FOLLOW_ID_in_functionHeader153];
  511. [self match:input TokenType:7 Follow:FOLLOW_7_in_functionHeader155];
  512. // SimpleC.g:40:21: ( formalParameter ( ',' formalParameter )* )? // block
  513. NSInteger alt4=2;
  514. NSInteger LA4_0 = [input LA:1];
  515. if ( (LA4_0==ID||LA4_0==15||(LA4_0 >= 17 && LA4_0 <= 18)) ) {
  516. alt4=1;
  517. }
  518. switch (alt4) {
  519. case 1 : ;
  520. // SimpleC.g:40:23: formalParameter ( ',' formalParameter )* // alt
  521. {
  522. /* ruleRef */
  523. [self pushFollow:FOLLOW_formalParameter_in_functionHeader159];
  524. [self formalParameter];
  525. [self popFollow];
  526. do {
  527. NSInteger alt3=2;
  528. NSInteger LA3_0 = [input LA:1];
  529. if ( (LA3_0==10) ) {
  530. alt3=1;
  531. }
  532. switch (alt3) {
  533. case 1 : ;
  534. // SimpleC.g:40:41: ',' formalParameter // alt
  535. {
  536. [self match:input TokenType:10 Follow:FOLLOW_10_in_functionHeader163];
  537. /* ruleRef */
  538. [self pushFollow:FOLLOW_formalParameter_in_functionHeader165];
  539. [self formalParameter];
  540. [self popFollow];
  541. }
  542. break;
  543. default :
  544. goto loop3;
  545. }
  546. } while (YES);
  547. loop3: ;
  548. }
  549. break;
  550. }
  551. [self match:input TokenType:8 Follow:FOLLOW_8_in_functionHeader173];
  552. name = (ID3!=nil?ID3.text:nil);
  553. }
  554. // token+rule list labels
  555. }
  556. @catch (ANTLRRecognitionException *re) {
  557. [self reportError:re];
  558. [self recover:input Exception:re];
  559. }
  560. @finally {
  561. /* my stuff */
  562. /* Terence's stuff */
  563. }
  564. return name;
  565. }
  566. /* $ANTLR end functionHeader */
  567. /*
  568. * $ANTLR start formalParameter
  569. * SimpleC.g:44:1: formalParameter : type declarator ;
  570. */
  571. - (void) formalParameter
  572. {
  573. /* my ruleScopeSetUp */
  574. /* Terence's stuff */
  575. @try {
  576. // SimpleC.g:45:5: ( type declarator ) // ruleBlockSingleAlt
  577. // SimpleC.g:45:9: type declarator // alt
  578. {
  579. /* ruleRef */
  580. [self pushFollow:FOLLOW_type_in_formalParameter195];
  581. [self type];
  582. [self popFollow];
  583. /* ruleRef */
  584. [self pushFollow:FOLLOW_declarator_in_formalParameter197];
  585. [self declarator];
  586. [self popFollow];
  587. }
  588. // token+rule list labels
  589. }
  590. @catch (ANTLRRecognitionException *re) {
  591. [self reportError:re];
  592. [self recover:input Exception:re];
  593. }
  594. @finally {
  595. /* my stuff */
  596. /* Terence's stuff */
  597. }
  598. return ;
  599. }
  600. /* $ANTLR end formalParameter */
  601. /*
  602. * $ANTLR start type
  603. * SimpleC.g:48:1: type : ( 'int' | 'char' | 'void' | ID );
  604. */
  605. - (void) type
  606. {
  607. /* my ruleScopeSetUp */
  608. /* Terence's stuff */
  609. @try {
  610. // SimpleC.g:49:5: ( 'int' | 'char' | 'void' | ID ) // ruleBlockSingleAlt
  611. // SimpleC.g: // alt
  612. {
  613. if ([input LA:1] == ID||[input LA:1] == 15||(([input LA:1] >= 17) && ([input LA:1] <= 18))) {
  614. [input consume];
  615. [state setIsErrorRecovery:NO];
  616. } else {
  617. ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input];
  618. @throw mse;
  619. }
  620. }
  621. // token+rule list labels
  622. }
  623. @catch (ANTLRRecognitionException *re) {
  624. [self reportError:re];
  625. [self recover:input Exception:re];
  626. }
  627. @finally {
  628. /* my stuff */
  629. /* Terence's stuff */
  630. }
  631. return ;
  632. }
  633. /* $ANTLR end type */
  634. /*
  635. * $ANTLR start block
  636. * SimpleC.g:55:1: block : '{' ( variable )* ( stat )* '}' ;
  637. */
  638. - (void) block
  639. {
  640. /* my ruleScopeSetUp */
  641. /* Terence's stuff */
  642. @try {
  643. // SimpleC.g:56:5: ( '{' ( variable )* ( stat )* '}' ) // ruleBlockSingleAlt
  644. // SimpleC.g:56:9: '{' ( variable )* ( stat )* '}' // alt
  645. {
  646. [self match:input TokenType:19 Follow:FOLLOW_19_in_block286];
  647. do {
  648. NSInteger alt5=2;
  649. NSInteger LA5_0 = [input LA:1];
  650. if ( (LA5_0==ID) ) {
  651. NSInteger LA5_2 = [input LA:2];
  652. if ( (LA5_2==ID) ) {
  653. alt5=1;
  654. }
  655. }
  656. else if ( (LA5_0==15||(LA5_0 >= 17 && LA5_0 <= 18)) ) {
  657. alt5=1;
  658. }
  659. switch (alt5) {
  660. case 1 : ;
  661. // SimpleC.g:57:13: variable // alt
  662. {
  663. /* ruleRef */
  664. [self pushFollow:FOLLOW_variable_in_block300];
  665. [self variable];
  666. [self popFollow];
  667. }
  668. break;
  669. default :
  670. goto loop5;
  671. }
  672. } while (YES);
  673. loop5: ;
  674. do {
  675. NSInteger alt6=2;
  676. NSInteger LA6_0 = [input LA:1];
  677. if ( ((LA6_0 >= ID && LA6_0 <= INT)||LA6_0==7||LA6_0==11||LA6_0==16||LA6_0==19) ) {
  678. alt6=1;
  679. }
  680. switch (alt6) {
  681. case 1 : ;
  682. // SimpleC.g:58:13: stat // alt
  683. {
  684. /* ruleRef */
  685. [self pushFollow:FOLLOW_stat_in_block315];
  686. [self stat];
  687. [self popFollow];
  688. }
  689. break;
  690. default :
  691. goto loop6;
  692. }
  693. } while (YES);
  694. loop6: ;
  695. [self match:input TokenType:20 Follow:FOLLOW_20_in_block326];
  696. }
  697. // token+rule list labels
  698. }
  699. @catch (ANTLRRecognitionException *re) {
  700. [self reportError:re];
  701. [self recover:input Exception:re];
  702. }
  703. @finally {
  704. /* my stuff */
  705. /* Terence's stuff */
  706. }
  707. return ;
  708. }
  709. /* $ANTLR end block */
  710. /*
  711. * $ANTLR start stat
  712. * SimpleC.g:62:1: stat : ( forStat | expr ';' | block | assignStat ';' | ';' );
  713. */
  714. - (void) stat
  715. {
  716. /* my ruleScopeSetUp */
  717. /* Terence's stuff */
  718. @try {
  719. // SimpleC.g:62:5: ( forStat | expr ';' | block | assignStat ';' | ';' ) //ruleblock
  720. NSInteger alt7=5;
  721. unichar charLA7 = [input LA:1];
  722. switch (charLA7) {
  723. case 16: ;
  724. {
  725. alt7=1;
  726. }
  727. break;
  728. case ID: ;
  729. {
  730. NSInteger LA7_2 = [input LA:2];
  731. if ( (LA7_2==13) ) {
  732. alt7=4;
  733. }
  734. else if ( (LA7_2==9||(LA7_2 >= 11 && LA7_2 <= 12)||LA7_2==14) ) {
  735. alt7=2;
  736. }
  737. else {
  738. ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:7 state:2 stream:input];
  739. nvae.c = LA7_2;
  740. @throw nvae;
  741. }
  742. }
  743. break;
  744. case INT: ;
  745. case 7: ;
  746. {
  747. alt7=2;
  748. }
  749. break;
  750. case 19: ;
  751. {
  752. alt7=3;
  753. }
  754. break;
  755. case 11: ;
  756. {
  757. alt7=5;
  758. }
  759. break;
  760. default: ;
  761. ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:7 state:0 stream:input];
  762. nvae.c = charLA7;
  763. @throw nvae;
  764. }
  765. switch (alt7) {
  766. case 1 : ;
  767. // SimpleC.g:62:7: forStat // alt
  768. {
  769. /* ruleRef */
  770. [self pushFollow:FOLLOW_forStat_in_stat338];
  771. [self forStat];
  772. [self popFollow];
  773. }
  774. break;
  775. case 2 : ;
  776. // SimpleC.g:63:7: expr ';' // alt
  777. {
  778. /* ruleRef */
  779. [self pushFollow:FOLLOW_expr_in_stat346];
  780. [self expr];
  781. [self popFollow];
  782. [self match:input TokenType:11 Follow:FOLLOW_11_in_stat348];
  783. }
  784. break;
  785. case 3 : ;
  786. // SimpleC.g:64:7: block // alt
  787. {
  788. /* ruleRef */
  789. [self pushFollow:FOLLOW_block_in_stat362];
  790. [self block];
  791. [self popFollow];
  792. }
  793. break;
  794. case 4 : ;
  795. // SimpleC.g:65:7: assignStat ';' // alt
  796. {
  797. /* ruleRef */
  798. [self pushFollow:FOLLOW_assignStat_in_stat370];
  799. [self assignStat];
  800. [self popFollow];
  801. [self match:input TokenType:11 Follow:FOLLOW_11_in_stat372];
  802. }
  803. break;
  804. case 5 : ;
  805. // SimpleC.g:66:7: ';' // alt
  806. {
  807. [self match:input TokenType:11 Follow:FOLLOW_11_in_stat380];
  808. }
  809. break;
  810. }
  811. // token+rule list labels
  812. }
  813. @catch (ANTLRRecognitionException *re) {
  814. [self reportError:re];
  815. [self recover:input Exception:re];
  816. }
  817. @finally {
  818. /* my stuff */
  819. /* Terence's stuff */
  820. }
  821. return ;
  822. }
  823. /* $ANTLR end stat */
  824. /*
  825. * $ANTLR start forStat
  826. * SimpleC.g:69:1: forStat : 'for' '(' assignStat ';' expr ';' assignStat ')' block ;
  827. */
  828. - (void) forStat
  829. {
  830. /* my ruleScopeSetUp */
  831. /* Terence's stuff */
  832. @try {
  833. // SimpleC.g:70:5: ( 'for' '(' assignStat ';' expr ';' assignStat ')' block ) // ruleBlockSingleAlt
  834. // SimpleC.g:70:9: 'for' '(' assignStat ';' expr ';' assignStat ')' block // alt
  835. {
  836. [self match:input TokenType:16 Follow:FOLLOW_16_in_forStat399];
  837. [self match:input TokenType:7 Follow:FOLLOW_7_in_forStat401];
  838. /* ruleRef */
  839. [self pushFollow:FOLLOW_assignStat_in_forStat403];
  840. [self assignStat];
  841. [self popFollow];
  842. [self match:input TokenType:11 Follow:FOLLOW_11_in_forStat405];
  843. /* ruleRef */
  844. [self pushFollow:FOLLOW_expr_in_forStat407];
  845. [self expr];
  846. [self popFollow];
  847. [self match:input TokenType:11 Follow:FOLLOW_11_in_forStat409];
  848. /* ruleRef */
  849. [self pushFollow:FOLLOW_assignStat_in_forStat411];
  850. [self assignStat];
  851. [self popFollow];
  852. [self match:input TokenType:8 Follow:FOLLOW_8_in_forStat413];
  853. /* ruleRef */
  854. [self pushFollow:FOLLOW_block_in_forStat415];
  855. [self block];
  856. [self popFollow];
  857. }
  858. // token+rule list labels
  859. }
  860. @catch (ANTLRRecognitionException *re) {
  861. [self reportError:re];
  862. [self recover:input Exception:re];
  863. }
  864. @finally {
  865. /* my stuff */
  866. /* Terence's stuff */
  867. }
  868. return ;
  869. }
  870. /* $ANTLR end forStat */
  871. /*
  872. * $ANTLR start assignStat
  873. * SimpleC.g:73:1: assignStat : ID '=' expr ;
  874. */
  875. - (void) assignStat
  876. {
  877. /* my ruleScopeSetUp */
  878. /* Terence's stuff */
  879. @try {
  880. // SimpleC.g:74:5: ( ID '=' expr ) // ruleBlockSingleAlt
  881. // SimpleC.g:74:9: ID '=' expr // alt
  882. {
  883. [self match:input TokenType:ID Follow:FOLLOW_ID_in_assignStat442];
  884. [self match:input TokenType:13 Follow:FOLLOW_13_in_assignStat444];
  885. /* ruleRef */
  886. [self pushFollow:FOLLOW_expr_in_assignStat446];
  887. [self expr];
  888. [self popFollow];
  889. }
  890. // token+rule list labels
  891. }
  892. @catch (ANTLRRecognitionException *re) {
  893. [self reportError:re];
  894. [self recover:input Exception:re];
  895. }
  896. @finally {
  897. /* my stuff */
  898. /* Terence's stuff */
  899. }
  900. return ;
  901. }
  902. /* $ANTLR end assignStat */
  903. /*
  904. * $ANTLR start expr
  905. * SimpleC.g:77:1: expr : condExpr ;
  906. */
  907. - (void) expr
  908. {
  909. /* my ruleScopeSetUp */
  910. /* Terence's stuff */
  911. @try {
  912. // SimpleC.g:77:5: ( condExpr ) // ruleBlockSingleAlt
  913. // SimpleC.g:77:9: condExpr // alt
  914. {
  915. /* ruleRef */
  916. [self pushFollow:FOLLOW_condExpr_in_expr468];
  917. [self condExpr];
  918. [self popFollow];
  919. }
  920. // token+rule list labels
  921. }
  922. @catch (ANTLRRecognitionException *re) {
  923. [self reportError:re];
  924. [self recover:input Exception:re];
  925. }
  926. @finally {
  927. /* my stuff */
  928. /* Terence's stuff */
  929. }
  930. return ;
  931. }
  932. /* $ANTLR end expr */
  933. /*
  934. * $ANTLR start condExpr
  935. * SimpleC.g:80:1: condExpr : aexpr ( ( '==' | '<' ) aexpr )? ;
  936. */
  937. - (void) condExpr
  938. {
  939. /* my ruleScopeSetUp */
  940. /* Terence's stuff */
  941. @try {
  942. // SimpleC.g:81:5: ( aexpr ( ( '==' | '<' ) aexpr )? ) // ruleBlockSingleAlt
  943. // SimpleC.g:81:9: aexpr ( ( '==' | '<' ) aexpr )? // alt
  944. {
  945. /* ruleRef */
  946. [self pushFollow:FOLLOW_aexpr_in_condExpr487];
  947. [self aexpr];
  948. [self popFollow];
  949. // SimpleC.g:81:15: ( ( '==' | '<' ) aexpr )? // block
  950. NSInteger alt8=2;
  951. NSInteger LA8_0 = [input LA:1];
  952. if ( (LA8_0==12||LA8_0==14) ) {
  953. alt8=1;
  954. }
  955. switch (alt8) {
  956. case 1 : ;
  957. // SimpleC.g:81:17: ( '==' | '<' ) aexpr // alt
  958. {
  959. if ([input LA:1] == 12||[input LA:1] == 14) {
  960. [input consume];
  961. [state setIsErrorRecovery:NO];
  962. } else {
  963. ANTLRMismatchedSetException *mse = [ANTLRMismatchedSetException newException:nil stream:input];
  964. @throw mse;
  965. }
  966. /* ruleRef */
  967. [self pushFollow:FOLLOW_aexpr_in_condExpr499];
  968. [self aexpr];
  969. [self popFollow];
  970. }
  971. break;
  972. }
  973. }
  974. // token+rule list labels
  975. }
  976. @catch (ANTLRRecognitionException *re) {
  977. [self reportError:re];
  978. [self recover:input Exception:re];
  979. }
  980. @finally {
  981. /* my stuff */
  982. /* Terence's stuff */
  983. }
  984. return ;
  985. }
  986. /* $ANTLR end condExpr */
  987. /*
  988. * $ANTLR start aexpr
  989. * SimpleC.g:84:1: aexpr : atom ( '+' atom )* ;
  990. */
  991. - (void) aexpr
  992. {
  993. /* my ruleScopeSetUp */
  994. /* Terence's stuff */
  995. @try {
  996. // SimpleC.g:85:5: ( atom ( '+' atom )* ) // ruleBlockSingleAlt
  997. // SimpleC.g:85:9: atom ( '+' atom )* // alt
  998. {
  999. /* ruleRef */
  1000. [self pushFollow:FOLLOW_atom_in_aexpr521];
  1001. [self atom];
  1002. [self popFollow];
  1003. do {
  1004. NSInteger alt9=2;
  1005. NSInteger LA9_0 = [input LA:1];
  1006. if ( (LA9_0==9) ) {
  1007. alt9=1;
  1008. }
  1009. switch (alt9) {
  1010. case 1 : ;
  1011. // SimpleC.g:85:16: '+' atom // alt
  1012. {
  1013. [self match:input TokenType:9 Follow:FOLLOW_9_in_aexpr525];
  1014. /* ruleRef */
  1015. [self pushFollow:FOLLOW_atom_in_aexpr527];
  1016. [self atom];
  1017. [self popFollow];
  1018. }
  1019. break;
  1020. default :
  1021. goto loop9;
  1022. }
  1023. } while (YES);
  1024. loop9: ;
  1025. }
  1026. // token+rule list labels
  1027. }
  1028. @catch (ANTLRRecognitionException *re) {
  1029. [self reportError:re];
  1030. [self recover:input Exception:re];
  1031. }
  1032. @finally {
  1033. /* my stuff */
  1034. /* Terence's stuff */
  1035. }
  1036. return ;
  1037. }
  1038. /* $ANTLR end aexpr */
  1039. /*
  1040. * $ANTLR start atom
  1041. * SimpleC.g:88:1: atom : ( ID | INT | '(' expr ')' );
  1042. */
  1043. - (void) atom
  1044. {
  1045. /* my ruleScopeSetUp */
  1046. /* Terence's stuff */
  1047. @try {
  1048. // SimpleC.g:89:5: ( ID | INT | '(' expr ')' ) //ruleblock
  1049. NSInteger alt10=3;
  1050. unichar charLA10 = [input LA:1];
  1051. switch (charLA10) {
  1052. case ID: ;
  1053. {
  1054. alt10=1;
  1055. }
  1056. break;
  1057. case INT: ;
  1058. {
  1059. alt10=2;
  1060. }
  1061. break;
  1062. case 7: ;
  1063. {
  1064. alt10=3;
  1065. }
  1066. break;
  1067. default: ;
  1068. ANTLRNoViableAltException *nvae = [ANTLRNoViableAltException newException:10 state:0 stream:input];
  1069. nvae.c = charLA10;
  1070. @throw nvae;
  1071. }
  1072. switch (alt10) {
  1073. case 1 : ;
  1074. // SimpleC.g:89:7: ID // alt
  1075. {
  1076. [self match:input TokenType:ID Follow:FOLLOW_ID_in_atom547];
  1077. }
  1078. break;
  1079. case 2 : ;
  1080. // SimpleC.g:90:7: INT // alt
  1081. {
  1082. [self match:input TokenType:INT Follow:FOLLOW_INT_in_atom561];
  1083. }
  1084. break;
  1085. case 3 : ;
  1086. // SimpleC.g:91:7: '(' expr ')' // alt
  1087. {
  1088. [self match:input TokenType:7 Follow:FOLLOW_7_in_atom575];
  1089. /* ruleRef */
  1090. [self pushFollow:FOLLOW_expr_in_atom577];
  1091. [self expr];
  1092. [self popFollow];
  1093. [self match:input TokenType:8 Follow:FOLLOW_8_in_atom579];
  1094. }
  1095. break;
  1096. }
  1097. // token+rule list labels
  1098. }
  1099. @catch (ANTLRRecognitionException *re) {
  1100. [self reportError:re];
  1101. [self recover:input Exception:re];
  1102. }
  1103. @finally {
  1104. /* my stuff */
  1105. /* Terence's stuff */
  1106. }
  1107. return ;
  1108. }
  1109. /* $ANTLR end atom */
  1110. /* ObjC end rules */
  1111. @end /* end of SimpleCParser implementation line 692 */