123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608 |
- /* A recursive-descent parser generated by peg 0.1.1 */
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define YYRULECOUNT 16
- #include <stdio.h>
- int vars[26];
- #ifndef YY_VARIABLE
- #define YY_VARIABLE(T) static T
- #endif
- #ifndef YY_LOCAL
- #define YY_LOCAL(T) static T
- #endif
- #ifndef YY_ACTION
- #define YY_ACTION(T) static T
- #endif
- #ifndef YY_RULE
- #define YY_RULE(T) static T
- #endif
- #ifndef YY_PARSE
- #define YY_PARSE(T) T
- #endif
- #ifndef YYPARSE
- #define YYPARSE yyparse
- #endif
- #ifndef YYPARSEFROM
- #define YYPARSEFROM yyparsefrom
- #endif
- #ifndef YY_INPUT
- #define YY_INPUT(buf, result, max_size) \
- { \
- int yyc= getchar(); \
- result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \
- yyprintf((stderr, "<%c>", yyc)); \
- }
- #endif
- #ifndef YY_BEGIN
- #define YY_BEGIN ( yybegin= yypos, 1)
- #endif
- #ifndef YY_END
- #define YY_END ( yyend= yypos, 1)
- #endif
- #ifdef YY_DEBUG
- # define yyprintf(args) fprintf args
- #else
- # define yyprintf(args)
- #endif
- #ifndef YYSTYPE
- #define YYSTYPE int
- #endif
- #ifndef YY_PART
- typedef void (*yyaction)(char *yytext, int yyleng);
- typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk;
- YY_VARIABLE(char * ) yybuf= 0;
- YY_VARIABLE(int ) yybuflen= 0;
- YY_VARIABLE(int ) yypos= 0;
- YY_VARIABLE(int ) yylimit= 0;
- YY_VARIABLE(char * ) yytext= 0;
- YY_VARIABLE(int ) yytextlen= 0;
- YY_VARIABLE(int ) yybegin= 0;
- YY_VARIABLE(int ) yyend= 0;
- YY_VARIABLE(int ) yytextmax= 0;
- YY_VARIABLE(yythunk *) yythunks= 0;
- YY_VARIABLE(int ) yythunkslen= 0;
- YY_VARIABLE(int ) yythunkpos= 0;
- YY_VARIABLE(YYSTYPE ) yy;
- YY_VARIABLE(YYSTYPE *) yyval= 0;
- YY_VARIABLE(YYSTYPE *) yyvals= 0;
- YY_VARIABLE(int ) yyvalslen= 0;
- YY_LOCAL(int) yyrefill(void)
- {
- int yyn;
- while (yybuflen - yypos < 512)
- {
- yybuflen *= 2;
- yybuf= realloc(yybuf, yybuflen);
- }
- YY_INPUT((yybuf + yypos), yyn, (yybuflen - yypos));
- if (!yyn) return 0;
- yylimit += yyn;
- return 1;
- }
- YY_LOCAL(int) yymatchDot(void)
- {
- if (yypos >= yylimit && !yyrefill()) return 0;
- ++yypos;
- return 1;
- }
- YY_LOCAL(int) yymatchChar(int c)
- {
- if (yypos >= yylimit && !yyrefill()) return 0;
- if (yybuf[yypos] == c)
- {
- ++yypos;
- yyprintf((stderr, " ok yymatchChar(%c) @ %s\n", c, yybuf+yypos));
- return 1;
- }
- yyprintf((stderr, " fail yymatchChar(%c) @ %s\n", c, yybuf+yypos));
- return 0;
- }
- YY_LOCAL(int) yymatchString(char *s)
- {
- int yysav= yypos;
- while (*s)
- {
- if (yypos >= yylimit && !yyrefill()) return 0;
- if (yybuf[yypos] != *s)
- {
- yypos= yysav;
- return 0;
- }
- ++s;
- ++yypos;
- }
- return 1;
- }
- YY_LOCAL(int) yymatchClass(unsigned char *bits)
- {
- int c;
- if (yypos >= yylimit && !yyrefill()) return 0;
- c= yybuf[yypos];
- if (bits[c >> 3] & (1 << (c & 7)))
- {
- ++yypos;
- yyprintf((stderr, " ok yymatchClass @ %s\n", yybuf+yypos));
- return 1;
- }
- yyprintf((stderr, " fail yymatchClass @ %s\n", yybuf+yypos));
- return 0;
- }
- YY_LOCAL(void) yyDo(yyaction action, int begin, int end)
- {
- while (yythunkpos >= yythunkslen)
- {
- yythunkslen *= 2;
- yythunks= realloc(yythunks, sizeof(yythunk) * yythunkslen);
- }
- yythunks[yythunkpos].begin= begin;
- yythunks[yythunkpos].end= end;
- yythunks[yythunkpos].action= action;
- ++yythunkpos;
- }
- YY_LOCAL(int) yyText(int begin, int end)
- {
- int yyleng= end - begin;
- if (yyleng <= 0)
- yyleng= 0;
- else
- {
- while (yytextlen < (yyleng - 1))
- {
- yytextlen *= 2;
- yytext= realloc(yytext, yytextlen);
- }
- memcpy(yytext, yybuf + begin, yyleng);
- }
- yytext[yyleng]= '\0';
- return yyleng;
- }
- YY_LOCAL(void) yyDone(void)
- {
- int pos;
- for (pos= 0; pos < yythunkpos; ++pos)
- {
- yythunk *thunk= &yythunks[pos];
- int yyleng= thunk->end ? yyText(thunk->begin, thunk->end) : thunk->begin;
- yyprintf((stderr, "DO [%d] %p %s\n", pos, thunk->action, yytext));
- thunk->action(yytext, yyleng);
- }
- yythunkpos= 0;
- }
- YY_LOCAL(void) yyCommit()
- {
- if ((yylimit -= yypos))
- {
- memmove(yybuf, yybuf + yypos, yylimit);
- }
- yybegin -= yypos;
- yyend -= yypos;
- yypos= yythunkpos= 0;
- }
- YY_LOCAL(int) yyAccept(int tp0)
- {
- if (tp0)
- {
- fprintf(stderr, "accept denied at %d\n", tp0);
- return 0;
- }
- else
- {
- yyDone();
- yyCommit();
- }
- return 1;
- }
- YY_LOCAL(void) yyPush(char *text, int count) { if (text) { } yyval += count; }
- YY_LOCAL(void) yyPop(char *text, int count) { if (text) { } yyval -= count; }
- YY_LOCAL(void) yySet(char *text, int count) { if (text) { } yyval[count]= yy; }
- #endif /* YY_PART */
- #define YYACCEPT yyAccept(yythunkpos0)
- YY_RULE(int) yy_CLOSE(); /* 16 */
- YY_RULE(int) yy_OPEN(); /* 15 */
- YY_RULE(int) yy_NUMBER(); /* 14 */
- YY_RULE(int) yy_DIVIDE(); /* 13 */
- YY_RULE(int) yy_TIMES(); /* 12 */
- YY_RULE(int) yy_Value(); /* 11 */
- YY_RULE(int) yy_MINUS(); /* 10 */
- YY_RULE(int) yy_PLUS(); /* 9 */
- YY_RULE(int) yy_Product(); /* 8 */
- YY_RULE(int) yy_Sum(); /* 7 */
- YY_RULE(int) yy_ASSIGN(); /* 6 */
- YY_RULE(int) yy_ID(); /* 5 */
- YY_RULE(int) yy_EOL(); /* 4 */
- YY_RULE(int) yy_Expr(); /* 3 */
- YY_RULE(int) yy__(); /* 2 */
- YY_RULE(int) yy_Stmt(); /* 1 */
- YY_ACTION(void) yy_1_ID(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- yyprintf((stderr, "do yy_1_ID\n"));
- yy= yytext[0] - 'a'; ;
- }
- YY_ACTION(void) yy_1_NUMBER(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- yyprintf((stderr, "do yy_1_NUMBER\n"));
- yy= atoi(yytext); ;
- }
- YY_ACTION(void) yy_3_Value(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define i yyval[-1]
- yyprintf((stderr, "do yy_3_Value\n"));
- yy= i; ;
- #undef i
- }
- YY_ACTION(void) yy_2_Value(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define i yyval[-1]
- yyprintf((stderr, "do yy_2_Value\n"));
- yy= vars[i]; ;
- #undef i
- }
- YY_ACTION(void) yy_1_Value(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define i yyval[-1]
- yyprintf((stderr, "do yy_1_Value\n"));
- yy= atoi(yytext); ;
- #undef i
- }
- YY_ACTION(void) yy_3_Product(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define r yyval[-1]
- #define l yyval[-2]
- yyprintf((stderr, "do yy_3_Product\n"));
- yy= l; ;
- #undef r
- #undef l
- }
- YY_ACTION(void) yy_2_Product(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define r yyval[-1]
- #define l yyval[-2]
- yyprintf((stderr, "do yy_2_Product\n"));
- l /= r; ;
- #undef r
- #undef l
- }
- YY_ACTION(void) yy_1_Product(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define r yyval[-1]
- #define l yyval[-2]
- yyprintf((stderr, "do yy_1_Product\n"));
- l *= r; ;
- #undef r
- #undef l
- }
- YY_ACTION(void) yy_3_Sum(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define r yyval[-1]
- #define l yyval[-2]
- yyprintf((stderr, "do yy_3_Sum\n"));
- yy= l; ;
- #undef r
- #undef l
- }
- YY_ACTION(void) yy_2_Sum(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define r yyval[-1]
- #define l yyval[-2]
- yyprintf((stderr, "do yy_2_Sum\n"));
- l -= r; ;
- #undef r
- #undef l
- }
- YY_ACTION(void) yy_1_Sum(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define r yyval[-1]
- #define l yyval[-2]
- yyprintf((stderr, "do yy_1_Sum\n"));
- l += r; ;
- #undef r
- #undef l
- }
- YY_ACTION(void) yy_2_Expr(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define s yyval[-1]
- #define i yyval[-2]
- yyprintf((stderr, "do yy_2_Expr\n"));
- yy= s; ;
- #undef s
- #undef i
- }
- YY_ACTION(void) yy_1_Expr(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define s yyval[-1]
- #define i yyval[-2]
- yyprintf((stderr, "do yy_1_Expr\n"));
- yy= vars[i]= s; ;
- #undef s
- #undef i
- }
- YY_ACTION(void) yy_2_Stmt(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define e yyval[-1]
- yyprintf((stderr, "do yy_2_Stmt\n"));
- printf("error\n"); ;
- #undef e
- }
- YY_ACTION(void) yy_1_Stmt(char *yytext, int yyleng)
- { if(yytext) { } if (yyleng) { }
- #define e yyval[-1]
- yyprintf((stderr, "do yy_1_Stmt\n"));
- printf("%d\n", e); ;
- #undef e
- }
- YY_RULE(int) yy_CLOSE()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "CLOSE")); if (!yymatchChar(')')) goto l1; if (!yy__()) goto l1;
- yyprintf((stderr, " ok %s @ %s\n", "CLOSE", yybuf+yypos));
- return 1;
- l1:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "CLOSE", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_OPEN()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "OPEN")); if (!yymatchChar('(')) goto l2; if (!yy__()) goto l2;
- yyprintf((stderr, " ok %s @ %s\n", "OPEN", yybuf+yypos));
- return 1;
- l2:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "OPEN", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_NUMBER()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "NUMBER")); yyText(yybegin, yyend); if (!(YY_BEGIN)) goto l3; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l3;
- l4:;
- { int yypos5= yypos, yythunkpos5= yythunkpos; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l5; goto l4;
- l5:; yypos= yypos5; yythunkpos= yythunkpos5;
- } yyText(yybegin, yyend); if (!(YY_END)) goto l3; if (!yy__()) goto l3; yyDo(yy_1_NUMBER, yybegin, yyend);
- yyprintf((stderr, " ok %s @ %s\n", "NUMBER", yybuf+yypos));
- return 1;
- l3:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "NUMBER", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_DIVIDE()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "DIVIDE")); if (!yymatchChar('/')) goto l6; if (!yy__()) goto l6;
- yyprintf((stderr, " ok %s @ %s\n", "DIVIDE", yybuf+yypos));
- return 1;
- l6:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "DIVIDE", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_TIMES()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "TIMES")); if (!yymatchChar('*')) goto l7; if (!yy__()) goto l7;
- yyprintf((stderr, " ok %s @ %s\n", "TIMES", yybuf+yypos));
- return 1;
- l7:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "TIMES", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_Value()
- { int yypos0= yypos, yythunkpos0= yythunkpos; yyDo(yyPush, 1, 0);
- yyprintf((stderr, "%s\n", "Value"));
- { int yypos9= yypos, yythunkpos9= yythunkpos; if (!yy_NUMBER()) goto l10; yyDo(yySet, -1, 0); yyDo(yy_1_Value, yybegin, yyend); goto l9;
- l10:; yypos= yypos9; yythunkpos= yythunkpos9; if (!yy_ID()) goto l11; yyDo(yySet, -1, 0);
- { int yypos12= yypos, yythunkpos12= yythunkpos; if (!yy_ASSIGN()) goto l12; goto l11;
- l12:; yypos= yypos12; yythunkpos= yythunkpos12;
- } yyDo(yy_2_Value, yybegin, yyend); goto l9;
- l11:; yypos= yypos9; yythunkpos= yythunkpos9; if (!yy_OPEN()) goto l8; if (!yy_Expr()) goto l8; yyDo(yySet, -1, 0); if (!yy_CLOSE()) goto l8; yyDo(yy_3_Value, yybegin, yyend);
- }
- l9:;
- yyprintf((stderr, " ok %s @ %s\n", "Value", yybuf+yypos)); yyDo(yyPop, 1, 0);
- return 1;
- l8:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Value", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_MINUS()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "MINUS")); if (!yymatchChar('-')) goto l13; if (!yy__()) goto l13;
- yyprintf((stderr, " ok %s @ %s\n", "MINUS", yybuf+yypos));
- return 1;
- l13:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "MINUS", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_PLUS()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "PLUS")); if (!yymatchChar('+')) goto l14; if (!yy__()) goto l14;
- yyprintf((stderr, " ok %s @ %s\n", "PLUS", yybuf+yypos));
- return 1;
- l14:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "PLUS", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_Product()
- { int yypos0= yypos, yythunkpos0= yythunkpos; yyDo(yyPush, 2, 0);
- yyprintf((stderr, "%s\n", "Product")); if (!yy_Value()) goto l15; yyDo(yySet, -2, 0);
- l16:;
- { int yypos17= yypos, yythunkpos17= yythunkpos;
- { int yypos18= yypos, yythunkpos18= yythunkpos; if (!yy_TIMES()) goto l19; if (!yy_Value()) goto l19; yyDo(yySet, -1, 0); yyDo(yy_1_Product, yybegin, yyend); goto l18;
- l19:; yypos= yypos18; yythunkpos= yythunkpos18; if (!yy_DIVIDE()) goto l17; if (!yy_Value()) goto l17; yyDo(yySet, -1, 0); yyDo(yy_2_Product, yybegin, yyend);
- }
- l18:; goto l16;
- l17:; yypos= yypos17; yythunkpos= yythunkpos17;
- } yyDo(yy_3_Product, yybegin, yyend);
- yyprintf((stderr, " ok %s @ %s\n", "Product", yybuf+yypos)); yyDo(yyPop, 2, 0);
- return 1;
- l15:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Product", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_Sum()
- { int yypos0= yypos, yythunkpos0= yythunkpos; yyDo(yyPush, 2, 0);
- yyprintf((stderr, "%s\n", "Sum")); if (!yy_Product()) goto l20; yyDo(yySet, -2, 0);
- l21:;
- { int yypos22= yypos, yythunkpos22= yythunkpos;
- { int yypos23= yypos, yythunkpos23= yythunkpos; if (!yy_PLUS()) goto l24; if (!yy_Product()) goto l24; yyDo(yySet, -1, 0); yyDo(yy_1_Sum, yybegin, yyend); goto l23;
- l24:; yypos= yypos23; yythunkpos= yythunkpos23; if (!yy_MINUS()) goto l22; if (!yy_Product()) goto l22; yyDo(yySet, -1, 0); yyDo(yy_2_Sum, yybegin, yyend);
- }
- l23:; goto l21;
- l22:; yypos= yypos22; yythunkpos= yythunkpos22;
- } yyDo(yy_3_Sum, yybegin, yyend);
- yyprintf((stderr, " ok %s @ %s\n", "Sum", yybuf+yypos)); yyDo(yyPop, 2, 0);
- return 1;
- l20:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Sum", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_ASSIGN()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "ASSIGN")); if (!yymatchChar('=')) goto l25; if (!yy__()) goto l25;
- yyprintf((stderr, " ok %s @ %s\n", "ASSIGN", yybuf+yypos));
- return 1;
- l25:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "ASSIGN", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_ID()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "ID")); yyText(yybegin, yyend); if (!(YY_BEGIN)) goto l26; if (!yymatchClass((unsigned char *)"\000\000\000\000\000\000\000\000\000\000\000\000\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l26; yyText(yybegin, yyend); if (!(YY_END)) goto l26; if (!yy__()) goto l26; yyDo(yy_1_ID, yybegin, yyend);
- yyprintf((stderr, " ok %s @ %s\n", "ID", yybuf+yypos));
- return 1;
- l26:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "ID", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_EOL()
- { int yypos0= yypos, yythunkpos0= yythunkpos;
- yyprintf((stderr, "%s\n", "EOL"));
- { int yypos28= yypos, yythunkpos28= yythunkpos; if (!yymatchChar('\n')) goto l29; goto l28;
- l29:; yypos= yypos28; yythunkpos= yythunkpos28; if (!yymatchString("\r\n")) goto l30; goto l28;
- l30:; yypos= yypos28; yythunkpos= yythunkpos28; if (!yymatchChar('\r')) goto l31; goto l28;
- l31:; yypos= yypos28; yythunkpos= yythunkpos28; if (!yymatchChar(';')) goto l27;
- }
- l28:;
- yyprintf((stderr, " ok %s @ %s\n", "EOL", yybuf+yypos));
- return 1;
- l27:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "EOL", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy_Expr()
- { int yypos0= yypos, yythunkpos0= yythunkpos; yyDo(yyPush, 2, 0);
- yyprintf((stderr, "%s\n", "Expr"));
- { int yypos33= yypos, yythunkpos33= yythunkpos; if (!yy_ID()) goto l34; yyDo(yySet, -2, 0); if (!yy_ASSIGN()) goto l34; if (!yy_Sum()) goto l34; yyDo(yySet, -1, 0); yyDo(yy_1_Expr, yybegin, yyend); goto l33;
- l34:; yypos= yypos33; yythunkpos= yythunkpos33; if (!yy_Sum()) goto l32; yyDo(yySet, -1, 0); yyDo(yy_2_Expr, yybegin, yyend);
- }
- l33:;
- yyprintf((stderr, " ok %s @ %s\n", "Expr", yybuf+yypos)); yyDo(yyPop, 2, 0);
- return 1;
- l32:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Expr", yybuf+yypos));
- return 0;
- }
- YY_RULE(int) yy__()
- {
- yyprintf((stderr, "%s\n", "_"));
- l36:;
- { int yypos37= yypos, yythunkpos37= yythunkpos; if (!yymatchClass((unsigned char *)"\000\002\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l37; goto l36;
- l37:; yypos= yypos37; yythunkpos= yythunkpos37;
- }
- yyprintf((stderr, " ok %s @ %s\n", "_", yybuf+yypos));
- return 1;
- }
- YY_RULE(int) yy_Stmt()
- { int yypos0= yypos, yythunkpos0= yythunkpos; yyDo(yyPush, 1, 0);
- yyprintf((stderr, "%s\n", "Stmt"));
- { int yypos39= yypos, yythunkpos39= yythunkpos; if (!yy__()) goto l40; if (!yy_Expr()) goto l40; yyDo(yySet, -1, 0); if (!yy_EOL()) goto l40; yyDo(yy_1_Stmt, yybegin, yyend); goto l39;
- l40:; yypos= yypos39; yythunkpos= yythunkpos39;
- l41:;
- { int yypos42= yypos, yythunkpos42= yythunkpos;
- { int yypos43= yypos, yythunkpos43= yythunkpos; if (!yy_EOL()) goto l43; goto l42;
- l43:; yypos= yypos43; yythunkpos= yythunkpos43;
- } if (!yymatchDot()) goto l42; goto l41;
- l42:; yypos= yypos42; yythunkpos= yythunkpos42;
- } if (!yy_EOL()) goto l38; yyDo(yy_2_Stmt, yybegin, yyend);
- }
- l39:;
- yyprintf((stderr, " ok %s @ %s\n", "Stmt", yybuf+yypos)); yyDo(yyPop, 1, 0);
- return 1;
- l38:; yypos= yypos0; yythunkpos= yythunkpos0;
- yyprintf((stderr, " fail %s @ %s\n", "Stmt", yybuf+yypos));
- return 0;
- }
- #ifndef YY_PART
- typedef int (*yyrule)();
- YY_PARSE(int) YYPARSEFROM(yyrule yystart)
- {
- int yyok;
- if (!yybuflen)
- {
- yybuflen= 1024;
- yybuf= malloc(yybuflen);
- yytextlen= 1024;
- yytext= malloc(yytextlen);
- yythunkslen= 32;
- yythunks= malloc(sizeof(yythunk) * yythunkslen);
- yyvalslen= 32;
- yyvals= malloc(sizeof(YYSTYPE) * yyvalslen);
- yybegin= yyend= yypos= yylimit= yythunkpos= 0;
- }
- yybegin= yyend= yypos;
- yythunkpos= 0;
- yyval= yyvals;
- yyok= yystart();
- if (yyok) yyDone();
- yyCommit();
- return yyok;
- (void)yyrefill;
- (void)yymatchDot;
- (void)yymatchChar;
- (void)yymatchString;
- (void)yymatchClass;
- (void)yyDo;
- (void)yyText;
- (void)yyDone;
- (void)yyCommit;
- (void)yyAccept;
- (void)yyPush;
- (void)yyPop;
- (void)yySet;
- (void)yytextmax;
- }
- YY_PARSE(int) YYPARSE(void)
- {
- return YYPARSEFROM(yy_Stmt);
- }
- #endif
- int main()
- {
- while (yyparse());
- return 0;
- }
|