private void inicio()
 {
     EnterRule_inicio();
     EnterRule("inicio", 2);
     TraceIn("inicio", 2);
     try { DebugEnterRule(GrammarFileName, "inicio");
           DebugLocation(8, 29);
           if (RuleLevel == 0)
           {
               DebugListener.Commence();
           }
           IncRuleLevel();
           try
           {
               // C:\\Users\\dany_\\Desktop\\antlr2020.g:8:8: ( NOMBRE START DIR '\\n' )
               DebugEnterAlt(1);
               // C:\\Users\\dany_\\Desktop\\antlr2020.g:8:10: NOMBRE START DIR '\\n'
               {
                   DebugLocation(8, 10);
                   Match(input, NOMBRE, Follow._NOMBRE_in_inicio51);
                   DebugLocation(8, 17);
                   Match(input, START, Follow._START_in_inicio53);
                   DebugLocation(8, 23);
                   Match(input, DIR, Follow._DIR_in_inicio55);
                   DebugLocation(8, 26);
                   Match(input, 17, Follow._17_in_inicio56);
               }
           }
           catch (RecognitionException re)
           {
               ReportError(re);
               Recover(input, re);
           }
           finally
           {
               TraceOut("inicio", 2);
               LeaveRule("inicio", 2);
               LeaveRule_inicio();
           }
           DebugLocation(8, 29); } finally { DebugExitRule(GrammarFileName, "inicio"); }
     DecRuleLevel();
     if (RuleLevel == 0)
     {
         DebugListener.Terminate();
     }
     return;
 }
 private void directiva()
 {
     EnterRule_directiva();
     EnterRule("directiva", 6);
     TraceIn("directiva", 6);
     try { DebugEnterRule(GrammarFileName, "directiva");
           DebugLocation(20, 1);
           if (RuleLevel == 0)
           {
               DebugListener.Commence();
           }
           IncRuleLevel();
           try
           {
               // C:\\Users\\dany_\\Desktop\\antlr2020.g:21:2: ( NOMBRE TIPODIRECTIVA OPDIRECTIVA )
               DebugEnterAlt(1);
               // C:\\Users\\dany_\\Desktop\\antlr2020.g:21:4: NOMBRE TIPODIRECTIVA OPDIRECTIVA
               {
                   DebugLocation(21, 4);
                   Match(input, NOMBRE, Follow._NOMBRE_in_directiva119);
                   DebugLocation(21, 11);
                   Match(input, TIPODIRECTIVA, Follow._TIPODIRECTIVA_in_directiva121);
                   DebugLocation(21, 25);
                   Match(input, OPDIRECTIVA, Follow._OPDIRECTIVA_in_directiva123);
               }
           }
           catch (RecognitionException re)
           {
               ReportError(re);
               Recover(input, re);
           }
           finally
           {
               TraceOut("directiva", 6);
               LeaveRule("directiva", 6);
               LeaveRule_directiva();
           }
           DebugLocation(22, 1); } finally { DebugExitRule(GrammarFileName, "directiva"); }
     DecRuleLevel();
     if (RuleLevel == 0)
     {
         DebugListener.Terminate();
     }
     return;
 }
    private void instruccion()
    {
        EnterRule_instruccion();
        EnterRule("instruccion", 5);
        TraceIn("instruccion", 5);
        try { DebugEnterRule(GrammarFileName, "instruccion");
              DebugLocation(16, 1);
              if (RuleLevel == 0)
              {
                  DebugListener.Commence();
              }
              IncRuleLevel();
              try
              {
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:17:2: ( ( NOMBRE )? OPERACION ( NOMBRE )? ( ',X' )? '\\n' )
                  DebugEnterAlt(1);
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:17:4: ( NOMBRE )? OPERACION ( NOMBRE )? ( ',X' )? '\\n'
                  {
                      DebugLocation(17, 4);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:17:4: ( NOMBRE )?
                      int alt6 = 2;
                      try { DebugEnterSubRule(6);
                            try { DebugEnterDecision(6, decisionCanBacktrack[6]);
                                  int LA6_0 = input.LA(1);

                                  if ((LA6_0 == NOMBRE))
                                  {
                                      alt6 = 1;
                                  }
                            } finally { DebugExitDecision(6); }
                            switch (alt6)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:17:4: NOMBRE
                                {
                                    DebugLocation(17, 4);
                                    Match(input, NOMBRE, Follow._NOMBRE_in_instruccion97);
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(6); }

                      DebugLocation(17, 12);
                      Match(input, OPERACION, Follow._OPERACION_in_instruccion100);
                      DebugLocation(17, 22);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:17:22: ( NOMBRE )?
                      int alt7 = 2;
                      try { DebugEnterSubRule(7);
                            try { DebugEnterDecision(7, decisionCanBacktrack[7]);
                                  int LA7_0 = input.LA(1);

                                  if ((LA7_0 == NOMBRE))
                                  {
                                      alt7 = 1;
                                  }
                            } finally { DebugExitDecision(7); }
                            switch (alt7)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:17:22: NOMBRE
                                {
                                    DebugLocation(17, 22);
                                    Match(input, NOMBRE, Follow._NOMBRE_in_instruccion102);
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(7); }

                      DebugLocation(17, 29);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:17:29: ( ',X' )?
                      int alt8 = 2;
                      try { DebugEnterSubRule(8);
                            try { DebugEnterDecision(8, decisionCanBacktrack[8]);
                                  int LA8_0 = input.LA(1);

                                  if ((LA8_0 == 15))
                                  {
                                      alt8 = 1;
                                  }
                            } finally { DebugExitDecision(8); }
                            switch (alt8)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:17:29: ',X'
                                {
                                    DebugLocation(17, 29);
                                    Match(input, 15, Follow._15_in_instruccion104);
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(8); }

                      DebugLocation(17, 35);
                      Match(input, 17, Follow._17_in_instruccion107);
                  }
              }
              catch (RecognitionException re)
              {
                  ReportError(re);
                  Recover(input, re);
              }
              finally
              {
                  TraceOut("instruccion", 5);
                  LeaveRule("instruccion", 5);
                  LeaveRule_instruccion();
              }
              DebugLocation(18, 1); } finally { DebugExitRule(GrammarFileName, "instruccion"); }
        DecRuleLevel();
        if (RuleLevel == 0)
        {
            DebugListener.Terminate();
        }
        return;
    }
    private void final()
    {
        EnterRule_final();
        EnterRule("final", 4);
        TraceIn("final", 4);
        try { DebugEnterRule(GrammarFileName, "final");
              DebugLocation(14, 27);
              if (RuleLevel == 0)
              {
                  DebugListener.Commence();
              }
              IncRuleLevel();
              try
              {
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:14:7: ( 'END' ( NOMBRE )? ( '\\n' )? )
                  DebugEnterAlt(1);
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:14:9: 'END' ( NOMBRE )? ( '\\n' )?
                  {
                      DebugLocation(14, 9);
                      Match(input, 16, Follow._16_in_final82);
                      DebugLocation(14, 15);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:14:15: ( NOMBRE )?
                      int alt4 = 2;
                      try { DebugEnterSubRule(4);
                            try { DebugEnterDecision(4, decisionCanBacktrack[4]);
                                  int LA4_0 = input.LA(1);

                                  if ((LA4_0 == NOMBRE))
                                  {
                                      alt4 = 1;
                                  }
                            } finally { DebugExitDecision(4); }
                            switch (alt4)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:14:15: NOMBRE
                                {
                                    DebugLocation(14, 15);
                                    Match(input, NOMBRE, Follow._NOMBRE_in_final84);
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(4); }

                      DebugLocation(14, 23);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:14:23: ( '\\n' )?
                      int alt5 = 2;
                      try { DebugEnterSubRule(5);
                            try { DebugEnterDecision(5, decisionCanBacktrack[5]);
                                  int LA5_0 = input.LA(1);

                                  if ((LA5_0 == 17))
                                  {
                                      alt5 = 1;
                                  }
                            } finally { DebugExitDecision(5); }
                            switch (alt5)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:14:23: '\\n'
                                {
                                    DebugLocation(14, 23);
                                    Match(input, 17, Follow._17_in_final87);
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(5); }
                  }
              }
              catch (RecognitionException re)
              {
                  ReportError(re);
                  Recover(input, re);
              }
              finally
              {
                  TraceOut("final", 4);
                  LeaveRule("final", 4);
                  LeaveRule_final();
              }
              DebugLocation(14, 27); } finally { DebugExitRule(GrammarFileName, "final"); }
        DecRuleLevel();
        if (RuleLevel == 0)
        {
            DebugListener.Terminate();
        }
        return;
    }
    private void proposicion()
    {
        EnterRule_proposicion();
        EnterRule("proposicion", 3);
        TraceIn("proposicion", 3);
        try { DebugEnterRule(GrammarFileName, "proposicion");
              DebugLocation(10, 1);
              if (RuleLevel == 0)
              {
                  DebugListener.Commence();
              }
              IncRuleLevel();
              try
              {
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:2: ( ( instruccion | directiva ) ( '\\n' )? )
                  DebugEnterAlt(1);
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:4: ( instruccion | directiva ) ( '\\n' )?
                  {
                      DebugLocation(11, 4);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:4: ( instruccion | directiva )
                      int alt2 = 2;
                      try { DebugEnterSubRule(2);
                            try { DebugEnterDecision(2, decisionCanBacktrack[2]);
                                  int LA2_0 = input.LA(1);

                                  if ((LA2_0 == NOMBRE))
                                  {
                                      int LA2_1 = input.LA(2);

                                      if ((LA2_1 == TIPODIRECTIVA))
                                      {
                                          alt2 = 2;
                                      }
                                      else if ((LA2_1 == OPERACION))
                                      {
                                          alt2 = 1;
                                      }
                                      else
                                      {
                                          NoViableAltException nvae = new NoViableAltException("", 2, 1, input);
                                          DebugRecognitionException(nvae);
                                          throw nvae;
                                      }
                                  }
                                  else if ((LA2_0 == OPERACION))
                                  {
                                      alt2 = 1;
                                  }
                                  else
                                  {
                                      NoViableAltException nvae = new NoViableAltException("", 2, 0, input);
                                      DebugRecognitionException(nvae);
                                      throw nvae;
                                  } } finally { DebugExitDecision(2); }
                            switch (alt2)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:5: instruccion
                                {
                                    DebugLocation(11, 5);
                                    PushFollow(Follow._instruccion_in_proposicion66);
                                    instruccion();
                                    PopFollow();
                                }
                                break;

                            case 2:
                                DebugEnterAlt(2);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:17: directiva
                                {
                                    DebugLocation(11, 17);
                                    PushFollow(Follow._directiva_in_proposicion68);
                                    directiva();
                                    PopFollow();
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(2); }

                      DebugLocation(11, 27);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:27: ( '\\n' )?
                      int alt3 = 2;
                      try { DebugEnterSubRule(3);
                            try { DebugEnterDecision(3, decisionCanBacktrack[3]);
                                  int LA3_0 = input.LA(1);

                                  if ((LA3_0 == 17))
                                  {
                                      alt3 = 1;
                                  }
                            } finally { DebugExitDecision(3); }
                            switch (alt3)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:27: '\\n'
                                {
                                    DebugLocation(11, 27);
                                    Match(input, 17, Follow._17_in_proposicion70);
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(3); }
                  }
              }
              catch (RecognitionException re)
              {
                  ReportError(re);
                  Recover(input, re);
              }
              finally
              {
                  TraceOut("proposicion", 3);
                  LeaveRule("proposicion", 3);
                  LeaveRule_proposicion();
              }
              DebugLocation(12, 1); } finally { DebugExitRule(GrammarFileName, "proposicion"); }
        DecRuleLevel();
        if (RuleLevel == 0)
        {
            DebugListener.Terminate();
        }
        return;
    }
    private void programa()
    {
        EnterRule_programa();
        EnterRule("programa", 1);
        TraceIn("programa", 1);
        try { DebugEnterRule(GrammarFileName, "programa");
              DebugLocation(6, 36);
              if (RuleLevel == 0)
              {
                  DebugListener.Commence();
              }
              IncRuleLevel();
              try
              {
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:6:9: ( inicio ( proposicion )* final )
                  DebugEnterAlt(1);
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:6:12: inicio ( proposicion )* final
                  {
                      DebugLocation(6, 12);
                      PushFollow(Follow._inicio_in_programa38);
                      inicio();
                      PopFollow();

                      DebugLocation(6, 19);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:6:19: ( proposicion )*
                      try { DebugEnterSubRule(1);
                            while (true)
                            {
                                int alt1 = 2;
                                try { DebugEnterDecision(1, decisionCanBacktrack[1]);
                                      int LA1_0 = input.LA(1);

                                      if ((LA1_0 == NOMBRE || LA1_0 == OPERACION))
                                      {
                                          alt1 = 1;
                                      }
                                } finally { DebugExitDecision(1); }
                                switch (alt1)
                                {
                                case 1:
                                    DebugEnterAlt(1);
                                    // C:\\Users\\dany_\\Desktop\\antlr2020.g:6:19: proposicion
                                    {
                                        DebugLocation(6, 19);
                                        PushFollow(Follow._proposicion_in_programa40);
                                        proposicion();
                                        PopFollow();
                                    }
                                    break;

                                default:
                                    goto loop1;
                                }
                            }

loop1:
                            ; } finally { DebugExitSubRule(1); }

                      DebugLocation(6, 32);
                      PushFollow(Follow._final_in_programa43);
                      final();
                      PopFollow();
                  }
              }
              catch (RecognitionException re)
              {
                  ReportError(re);
                  Recover(input, re);
              }
              finally
              {
                  TraceOut("programa", 1);
                  LeaveRule("programa", 1);
                  LeaveRule_programa();
              }
              DebugLocation(6, 36); } finally { DebugExitRule(GrammarFileName, "programa"); }
        DecRuleLevel();
        if (RuleLevel == 0)
        {
            DebugListener.Terminate();
        }
        return;
    }
Exemplo n.º 7
0
        private AstParserRuleReturnScope <object, IToken> simple()
        {
            EnterRule_simple();
            EnterRule("simple", 3);
            TraceIn("simple", 3);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);
            int simple_StartIndex = input.Index;

            object root_0 = default(object);

            IToken set6 = default(IToken);

            object set6_tree = default(object);

            try { DebugEnterRule(GrammarFileName, "simple");
                  DebugLocation(26, 55);
                  if (RuleLevel == 0)
                  {
                      DebugListener.Commence();
                  }
                  IncRuleLevel();
                  try
                  {
                      if (state.backtracking > 0 && AlreadyParsedRule(input, 3))
                      {
                          return(retval);
                      }

                      // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:26:8: ( MVLEFT | MVRIGHT | INCR | DECR | PRINT | INPUT )
                      DebugEnterAlt(1);
                      // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:
                      {
                          root_0 = (object)adaptor.Nil();

                          DebugLocation(26, 8);

                          set6 = (IToken)input.LT(1);
                          if ((input.LA(1) >= DECR && input.LA(1) <= PRINT))
                          {
                              input.Consume();
                              if (state.backtracking == 0)
                              {
                                  adaptor.AddChild(root_0, (object)adaptor.Create(set6));
                              }
                              state.errorRecovery = false; state.failed = false;
                          }
                          else
                          {
                              if (state.backtracking > 0)
                              {
                                  state.failed = true; return(retval);
                              }
                              MismatchedSetException mse = new MismatchedSetException(null, input);
                              DebugRecognitionException(mse);
                              throw mse;
                          }
                      }

                      retval.Stop = (IToken)input.LT(-1);

                      if (state.backtracking == 0)
                      {
                          retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                          adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                      }
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("simple", 3);
                      LeaveRule("simple", 3);
                      LeaveRule_simple();
                      if (state.backtracking > 0)
                      {
                          Memoize(input, 3, simple_StartIndex);
                      }
                  }
                  DebugLocation(26, 55); } finally { DebugExitRule(GrammarFileName, "simple"); }
            DecRuleLevel();
            if (RuleLevel == 0)
            {
                DebugListener.Terminate();
            }
            return(retval);
        }
Exemplo n.º 8
0
        private AstParserRuleReturnScope <object, IToken> complex()
        {
            EnterRule_complex();
            EnterRule("complex", 2);
            TraceIn("complex", 2);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);
            int complex_StartIndex = input.Index;

            object root_0 = default(object);

            IToken WHILE3    = default(IToken);
            IToken RBRACKET5 = default(IToken);
            AstParserRuleReturnScope <object, IToken> simple4 = default(AstParserRuleReturnScope <object, IToken>);

            object WHILE3_tree    = default(object);
            object RBRACKET5_tree = default(object);

            try { DebugEnterRule(GrammarFileName, "complex");
                  DebugLocation(25, 36);
                  if (RuleLevel == 0)
                  {
                      DebugListener.Commence();
                  }
                  IncRuleLevel();
                  try
                  {
                      if (state.backtracking > 0 && AlreadyParsedRule(input, 2))
                      {
                          return(retval);
                      }

                      // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:25:9: ( WHILE ( ( simple )* ) RBRACKET )
                      DebugEnterAlt(1);
                      // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:25:11: WHILE ( ( simple )* ) RBRACKET
                      {
                          root_0 = (object)adaptor.Nil();

                          DebugLocation(25, 11);
                          WHILE3 = (IToken)Match(input, WHILE, Follow._WHILE_in_complex178); if (state.failed)
                          {
                              return(retval);
                          }
                          if (state.backtracking == 0)
                          {
                              WHILE3_tree = (object)adaptor.Create(WHILE3);
                              adaptor.AddChild(root_0, WHILE3_tree);
                          }
                          DebugLocation(25, 17);
                          // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:25:17: ( ( simple )* )
                          DebugEnterAlt(1);
                          // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:25:19: ( simple )*
                          {
                              DebugLocation(25, 19);
                              // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:25:19: ( simple )*
                              try { DebugEnterSubRule(3);
                                    while (true)
                                    {
                                        int alt3 = 2;
                                        try { DebugEnterDecision(3, false);
                                              int LA3_0 = input.LA(1);

                                              if (((LA3_0 >= DECR && LA3_0 <= PRINT)))
                                              {
                                                  alt3 = 1;
                                              }
                                        } finally { DebugExitDecision(3); }
                                        switch (alt3)
                                        {
                                        case 1:
                                            DebugEnterAlt(1);
                                            // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:25:19: simple
                                            {
                                                DebugLocation(25, 19);
                                                PushFollow(Follow._simple_in_complex182);
                                                simple4 = simple();
                                                PopFollow();
                                                if (state.failed)
                                                {
                                                    return(retval);
                                                }
                                                if (state.backtracking == 0)
                                                {
                                                    adaptor.AddChild(root_0, simple4.Tree);
                                                }
                                            }
                                            break;

                                        default:
                                            goto loop3;
                                        }
                                    }

loop3:
                                    ; } finally { DebugExitSubRule(3); }
                          }

                          DebugLocation(25, 29);
                          RBRACKET5 = (IToken)Match(input, RBRACKET, Follow._RBRACKET_in_complex187); if (state.failed)
                          {
                              return(retval);
                          }
                          if (state.backtracking == 0)
                          {
                              RBRACKET5_tree = (object)adaptor.Create(RBRACKET5);
                              adaptor.AddChild(root_0, RBRACKET5_tree);
                          }
                      }

                      retval.Stop = (IToken)input.LT(-1);

                      if (state.backtracking == 0)
                      {
                          retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                          adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                      }
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("complex", 2);
                      LeaveRule("complex", 2);
                      LeaveRule_complex();
                      if (state.backtracking > 0)
                      {
                          Memoize(input, 2, complex_StartIndex);
                      }
                  }
                  DebugLocation(25, 36); } finally { DebugExitRule(GrammarFileName, "complex"); }
            DecRuleLevel();
            if (RuleLevel == 0)
            {
                DebugListener.Terminate();
            }
            return(retval);
        }
Exemplo n.º 9
0
        private AstParserRuleReturnScope <object, IToken> file()
        {
            EnterRule_file();
            EnterRule("file", 1);
            TraceIn("file", 1);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);
            int file_StartIndex = input.Index;

            object root_0 = default(object);

            AstParserRuleReturnScope <object, IToken> simple1  = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> complex2 = default(AstParserRuleReturnScope <object, IToken>);

            try { DebugEnterRule(GrammarFileName, "file");
                  DebugLocation(24, 24);
                  if (RuleLevel == 0)
                  {
                      DebugListener.Commence();
                  }
                  IncRuleLevel();
                  try
                  {
                      if (state.backtracking > 0 && AlreadyParsedRule(input, 1))
                      {
                          return(retval);
                      }

                      // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:24:6: ( simple | ( complex )? )
                      int alt2 = 2;
                      try { DebugEnterDecision(2, false);
                            int LA2_0 = input.LA(1);

                            if (((LA2_0 >= DECR && LA2_0 <= PRINT)))
                            {
                                alt2 = 1;
                            }
                            else if ((LA2_0 == EOF || LA2_0 == WHILE))
                            {
                                alt2 = 2;
                            }
                            else
                            {
                                if (state.backtracking > 0)
                                {
                                    state.failed = true; return(retval);
                                }
                                NoViableAltException nvae = new NoViableAltException("", 2, 0, input);
                                DebugRecognitionException(nvae);
                                throw nvae;
                            } } finally { DebugExitDecision(2); }
                      switch (alt2)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:24:8: simple
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(24, 8);
                              PushFollow(Follow._simple_in_file166);
                              simple1 = simple();
                              PopFollow();
                              if (state.failed)
                              {
                                  return(retval);
                              }
                              if (state.backtracking == 0)
                              {
                                  adaptor.AddChild(root_0, simple1.Tree);
                              }
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:24:17: ( complex )?
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(24, 17);
                              // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:24:17: ( complex )?
                              int alt1 = 2;
                              try { DebugEnterSubRule(1);
                                    try { DebugEnterDecision(1, false);
                                          int LA1_0 = input.LA(1);

                                          if ((LA1_0 == WHILE))
                                          {
                                              alt1 = 1;
                                          }
                                    } finally { DebugExitDecision(1); }
                                    switch (alt1)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // D:\\Data\\Projects\\Brainfucker\\Brainfucker\\Brainfucker.g:24:17: complex
                                        {
                                            DebugLocation(24, 17);
                                            PushFollow(Follow._complex_in_file170);
                                            complex2 = complex();
                                            PopFollow();
                                            if (state.failed)
                                            {
                                                return(retval);
                                            }
                                            if (state.backtracking == 0)
                                            {
                                                adaptor.AddChild(root_0, complex2.Tree);
                                            }
                                        }
                                        break;
                                    }
                              } finally { DebugExitSubRule(1); }
                          }
                          break;
                      }
                      retval.Stop = (IToken)input.LT(-1);

                      if (state.backtracking == 0)
                      {
                          retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                          adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                      }
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("file", 1);
                      LeaveRule("file", 1);
                      LeaveRule_file();
                      if (state.backtracking > 0)
                      {
                          Memoize(input, 1, file_StartIndex);
                      }
                  }
                  DebugLocation(24, 24); } finally { DebugExitRule(GrammarFileName, "file"); }
            DecRuleLevel();
            if (RuleLevel == 0)
            {
                DebugListener.Terminate();
            }
            return(retval);
        }