#include "oberon2.h"



static unsigned short program [] = {
 3, 4, 5, 69, 294, 865, 876, 70, 295, 1,
 1007, 8, 4, 9, 2, 6, 4, 73, 295, 1,
 4, 74, 295, 1, 284, 5, 2, 75, 301, 1,
 67, 288, 1129, 13, 1158, 5, 286, 77, 301, 1,
 67, 278, 1119, 13, 925, 5, 286, 78, 301, 1,
 67, 268, 1254, 16, 915, 5, 286, 80, 2, 1,
 81, 302, 1, 82, 294, 895, 1095, 82, 281, 868,
 302, 82, 294, 887, 1087, 82, 294, 860, 5, 803,
 5, 268, 19, 83, 299, 1, 79, 2, 1, 1066,
 2, 78, 294, 1, 4, 74, 295, 1, 288, 16,
 869, 68, 275, 1, 279, 19, 78, 294, 1, 4,
 16, 4, 20, 2, 67, 295, 1039, 2, 84, 304,
 1, 22, 1070, 74, 295, 1, 288, 23, 24, 840,
 2, 88, 311, 1, 82, 296, 1, 1018, 20, 68,
 295, 1, 289, 67, 297, 1161, 16, 822, 283, 8,
 2, 89, 297, 1, 27, 814, 2, 17, 82, 2,
 777, 2, 67, 306, 1006, 73, 296, 1, 1024, 419,
 82, 417, 1, 83, 1137, 20, 412, 91, 310, 1,
 1012, 29, 835, 93, 298, 1, 1006, 29, 829, 286,
 94, 295, 1, 824, 8, 393, 95, 328, 1, 993,
 24, 94, 297, 1, 813, 8, 382, 71, 295, 1,
 378, 96, 295, 1, 289, 977, 97, 295, 1, 973,
 74, 295, 1, 284, 16, 792, 96, 295, 1, 278,
 94, 266, 263, 98, 299, 1, 956, 36, 779, 8,
 348, 100, 298, 1, 773, 38, 946, 341, 102, 307,
 1, 4, 10, 939, 27, 937, 103, 295, 1, 933,
 36, 756, 8, 325, 104, 297, 1, 750, 8, 319,
 105, 310, 1, 1043, 36, 742, 96, 298, 1, 1037,
 36, 736, 286, 94, 295, 1, 731, 8, 300, 106,
 295, 1, 296, 107, 294, 1, 68, 2, 1, 155,
 4, 72, 294, 1, 4, 2, 4, 108, 295, 1,
 2, 109, 2, 1, 2, 4, 72, 296, 1, 4,
 851, 85, 297, 1, 987, 23, 282, 81, 295, 1,
 278, 82, 2, 1, 821, 20, 272, 882, 76, 294,
 313, 110, 294, 310, 111, 294, 307, 112, 294, 304,
 113, 294, 301, 114, 294, 298, 115, 294, 295, 76,
 2, 1, 857, 2, 116, 371, 1, 296, 109, 294,
 1, 117, 295, 1, 289, 118, 295, 1, 339, 119,
 295, 1, 335, 120, 295, 1, 331, 121, 295, 1,
 327, 82, 297, 1, 798, 20, 321, 122, 309, 1,
 123, 295, 1, 314, 788, 97, 295, 1, 784, 74,
 295, 1, 284, 60, 303, 755, 82, 300, 1, 83,
 295, 1, 295, 888, 20, 108, 294, 304, 124, 294,
 301, 125, 294, 298, 126, 294, 295, 127, 295, 1,
 223, 116, 294, 288, 109, 294, 285, 128, 2, 1,
 213, 710, 74, 2, 1, 288, 736, 74, 2, 1,
 288, 694, 16, 692, 2, 0, 0
};



int yyparse () {
  int yychar = yylex (), pc = 0, code;
  unsigned short call_stack [YYCALLSTACK_SIZE];
  unsigned short *free = call_stack;

  *free++ = sizeof (program) / sizeof (program [0]) - 1;
  while ((code = program [pc]) != 0 && yychar > 0) {
    pc++;
    if (code == 1)
      yychar = yylex ();
    else if (code == 2) /*return*/
      pc = *--free;
    else if ((code -= 2) < 63) {/*match*/
      if (yychar == code)
        pc++;
      else {
        yyerror ("Syntax error");
        return 1;
      }
    } else if ((code -= 63) < 63) {
      if (yychar == code)
        pc++; /*skipif*/
    } else if ((code -= 63) <= 562) /*goto*/
      pc += code + -163;
    else if ((code -= 563) <= 562) { /*gosub*/
      if (free >= call_stack + YYCALLSTACK_SIZE) {
        yyerror ("Call stack overflow");
        return 1;
      }
      pc += code + -163;
      *free++ = pc;
    } else {
      yyerror ("Internal error");
      return 1;
    }
  }
  if (code != 0 || yychar > 0) {
    if (code != 0)
      yyerror ("Unexpected EOF");
    else
      yyerror ("Garbage after end of program");
    return 1;
  }
  return 0;
}
