Google
Web alhem.net

rowo.cpp File Reference

#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include "robotworld.h"

Include dependency graph for rowo.cpp:

Go to the source code of this file.

Classes

union  YYSTYPE
struct  YYSTYPE::codestruct

Defines

#define YYBYACC   1
#define YYMAJOR   1
#define YYMINOR   9
#define yyclearin   (yychar=(-1))
#define yyerrok   (yyerrflag=0)
#define YYRECOVERING   (yyerrflag!=0)
#define YYPREFIX   "yy"
#define C   the_str[the_ptr]
#define C1   the_str[the_ptr+1]
#define INT   257
#define IDENTIFIER   258
#define COMMENT   259
#define Object   260
#define EnumObjectType   261
#define Cos   262
#define Sin   263
#define If   264
#define Loop   265
#define EQ   266
#define NEQ   267
#define AND   268
#define OR   269
#define YYERRCODE   256
#define YYTABLESIZE   364
#define YYFINAL   2
#define YYDEBUG   0
#define YYMAXTOKEN   270
#define YYSTACKSIZE   500
#define YYMAXDEPTH   500
#define yystacksize   YYSTACKSIZE
#define YYABORT   goto yyabort
#define YYREJECT   goto yyabort
#define YYACCEPT   goto yyaccept
#define YYERROR   goto yyerrlab

Functions

const std::string & GetCodestr ()
std::map< std::string, int > & GetCodemap ()
std::vector< VARIABLE * > & GetVariables ()
bool GetFailed ()
int yyparse ()
short reg_variable (const std::string &, int type=0)
void check_property (const std::string &, const std::string &)
void check_method (const std::string &, const std::string &)
void add_bytecode (char *, int opcode)
void add_bytecode (char *, int opcode, short val)
void add_bytecode (char *, int opcode, long val)
void add_bytecode (char *, int opcode, const std::string &object, const std::string &property_or_method)
int yyerror (char *s)
int yylex ()
void parse_file (const std::string &filename)

Variables

static char yysccsid [] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"
static char the_str [1000]
static int the_ptr
static int line
static FILE * fil
static int uniq
static std::vector< VARIABLE * > variables
static std::string codestr
static std::map< std::string,
int > 
codemap
static bool failed
static int x_ptr
short yylhs []
short yylen []
short yydefred []
short yydgoto []
short yysindex []
short yyrindex []
short yygindex []
short yytable []
short yycheck []
int yydebug
int yynerrs
int yyerrflag
int yychar
short * yyssp
YYSTYPEyyvsp
YYSTYPE yyval
YYSTYPE yylval
short yyss [YYSTACKSIZE]
YYSTYPE yyvs [YYSTACKSIZE]


Define Documentation

#define AND   268

Definition at line 69 of file rowo.cpp.

Referenced by yylex().

#define C   the_str[the_ptr]

Definition at line 19 of file rowo.cpp.

Referenced by yylex().

#define C1   the_str[the_ptr+1]

Definition at line 20 of file rowo.cpp.

Referenced by yylex().

#define COMMENT   259

Definition at line 60 of file rowo.cpp.

Referenced by yylex().

#define Cos   262

Definition at line 63 of file rowo.cpp.

#define EnumObjectType   261

Definition at line 62 of file rowo.cpp.

Referenced by yylex().

#define EQ   266

Definition at line 67 of file rowo.cpp.

Referenced by yylex().

#define IDENTIFIER   258

Definition at line 59 of file rowo.cpp.

Referenced by yylex().

#define If   264

Definition at line 65 of file rowo.cpp.

Referenced by yylex().

#define INT   257

Definition at line 58 of file rowo.cpp.

Referenced by yylex().

#define Loop   265

Definition at line 66 of file rowo.cpp.

Referenced by yylex().

#define NEQ   267

Definition at line 68 of file rowo.cpp.

Referenced by yylex().

#define Object   260

Definition at line 61 of file rowo.cpp.

Referenced by yylex().

#define OR   269

Definition at line 70 of file rowo.cpp.

Referenced by yylex().

#define Sin   263

Definition at line 64 of file rowo.cpp.

#define YYABORT   goto yyabort

Definition at line 591 of file rowo.cpp.

#define YYACCEPT   goto yyaccept

Definition at line 593 of file rowo.cpp.

#define YYBYACC   1

Definition at line 4 of file rowo.cpp.

#define yyclearin   (yychar=(-1))

Definition at line 7 of file rowo.cpp.

#define YYDEBUG   0

Definition at line 203 of file rowo.cpp.

Referenced by yyparse().

#define YYERRCODE   256

Definition at line 71 of file rowo.cpp.

Referenced by yyparse().

#define yyerrok   (yyerrflag=0)

Definition at line 8 of file rowo.cpp.

#define YYERROR   goto yyerrlab

Definition at line 594 of file rowo.cpp.

#define YYFINAL   2

Definition at line 201 of file rowo.cpp.

Referenced by yyparse().

#define YYMAJOR   1

Definition at line 5 of file rowo.cpp.

#define YYMAXDEPTH   500

Definition at line 269 of file rowo.cpp.

#define YYMAXTOKEN   270

Definition at line 205 of file rowo.cpp.

Referenced by yyparse().

#define YYMINOR   9

Definition at line 6 of file rowo.cpp.

#define YYPREFIX   "yy"

Definition at line 10 of file rowo.cpp.

Referenced by yyparse().

#define YYRECOVERING   (yyerrflag!=0)

Definition at line 9 of file rowo.cpp.

#define YYREJECT   goto yyabort

Definition at line 592 of file rowo.cpp.

#define yystacksize   YYSTACKSIZE

Definition at line 282 of file rowo.cpp.

Referenced by yyparse().

#define YYSTACKSIZE   500

Definition at line 268 of file rowo.cpp.

#define YYTABLESIZE   364

Definition at line 122 of file rowo.cpp.

Referenced by yyparse().


Function Documentation

void add_bytecode ( char *  ,
int  opcode,
const std::string &  object,
const std::string &  property_or_method 
)

Definition at line 514 of file rowo.cpp.

References failed, ROBOTOBJECT_GUN, ROBOTOBJECT_RADAR, ROBOTOBJECT_ROBOT, ROBOTOBJECT_SHIELDS, and ROBOTOBJECT_TURRET.

00515 {
00516         int objectcode = 0;
00517         int val = 0;
00518         {
00519                 // robot, radar, turret, gun, shields
00520                 if (!strcmp(object.c_str(), "robot"))
00521                 {
00522                         objectcode = ROBOTOBJECT_ROBOT;
00523                         if (property_or_method == "ok")
00524                                 val = 1;
00525                         if (property_or_method == "damage")
00526                                 val = 2;
00527                         if (property_or_method == "repair_rate")
00528                                 val = 3;
00529                         if (property_or_method == "inventory")
00530                                 val = 4;
00531                         if (property_or_method == "power")
00532                                 val = 5;
00533                         if (property_or_method == "charging")
00534                                 val = 6;
00535                 }
00536                 else
00537                 if (!strcmp(object.c_str(), "radar"))
00538                 {
00539                         objectcode = ROBOTOBJECT_RADAR;
00540                         if (property_or_method == "ok")
00541                                 val = 1;
00542                         if (property_or_method == "damage")
00543                                 val = 2;
00544                         if (property_or_method == "repair_rate")
00545                                 val = 3;
00546                 }
00547                 else
00548                 if (!strcmp(object.c_str(), "turret"))
00549                 {
00550                         objectcode = ROBOTOBJECT_TURRET;
00551                         if (property_or_method == "ok")
00552                                 val = 1;
00553                         if (property_or_method == "damage")
00554                                 val = 2;
00555                         if (property_or_method == "repair_rate")
00556                                 val = 3;
00557                 }
00558                 else
00559                 if (!strcmp(object.c_str(), "gun"))
00560                 {
00561                         objectcode = ROBOTOBJECT_GUN;
00562                         if (property_or_method == "ok")
00563                                 val = 1;
00564                         if (property_or_method == "damage")
00565                                 val = 2;
00566                         if (property_or_method == "repair_rate")
00567                                 val = 3;
00568                 }
00569                 else
00570                 if (!strcmp(object.c_str(), "shields"))
00571                 {
00572                         objectcode = ROBOTOBJECT_SHIELDS;
00573                         if (property_or_method == "ok")
00574                                 val = 1;
00575                         if (property_or_method == "damage")
00576                                 val = 2;
00577                         if (property_or_method == "repair_rate")
00578                                 val = 3;
00579                 }
00580                 else
00581                 {
00582                         printf("Unknown object: %s\n", object.c_str() );
00583                         failed = true;
00584                 }
00585         }
00586         sprintf(s + strlen(s), "%02x%02x%02x", opcode, objectcode, val);
00587 }

void add_bytecode ( char *  ,
int  opcode,
long  val 
)

Definition at line 508 of file rowo.cpp.

00509 {
00510         sprintf(s + strlen(s), "%02x%08lx", opcode, val);
00511 }

void add_bytecode ( char *  ,
int  opcode,
short  val 
)

Definition at line 492 of file rowo.cpp.

00493 {
00494         unsigned short val;
00495         if (valx < 0)
00496         {
00497                 val = -valx;
00498                 val |= 0x8000;
00499         }
00500         else
00501         {
00502                 val = valx;
00503         }
00504         sprintf(s + strlen(s), "%02x%04x", opcode, val);
00505 }

void add_bytecode ( char *  ,
int  opcode 
)

Definition at line 486 of file rowo.cpp.

Referenced by yyparse().

00487 {
00488         sprintf(s + strlen(s), "%02x", opcode);
00489 }

void check_method ( const std::string &  ,
const std::string &   
)

Definition at line 481 of file rowo.cpp.

Referenced by yyparse().

00482 {
00483 }

void check_property ( const std::string &  ,
const std::string &   
)

Definition at line 476 of file rowo.cpp.

Referenced by yyparse().

00477 {
00478 }

std::map<std::string, int>& GetCodemap (  ) 

Definition at line 35 of file rowo.cpp.

References codemap.

Referenced by main().

00035 { return codemap; }

const std::string& GetCodestr (  ) 

Definition at line 34 of file rowo.cpp.

References codestr.

Referenced by main().

00034 { return codestr; }

bool GetFailed (  ) 

Definition at line 37 of file rowo.cpp.

References failed.

Referenced by main().

00037 { return failed; }

std::vector<VARIABLE *>& GetVariables (  ) 

Definition at line 36 of file rowo.cpp.

References variables.

Referenced by main().

00036 { return variables; }

void parse_file ( const std::string &  filename  ) 

Definition at line 427 of file rowo.cpp.

References codemap, codestr, failed, fil, line, the_ptr, the_str, uniq, variables, and yyparse().

Referenced by main().

00428 {
00429         *the_str = 0;
00430         the_ptr = 0;
00431         line = 0;
00432         uniq = 1;
00433         codestr = "";
00434         failed = false;
00435         while (codemap.size())
00436         {
00437                 codemap.erase(codemap.begin());
00438         }
00439         while (variables.size())
00440         {
00441                 variables.erase(variables.begin());
00442         }
00443         if ((fil = fopen(filename.c_str(), "rt")) != NULL)
00444         {
00445                 yyparse();
00446                 fclose(fil);
00447         }
00448         else
00449         {
00450                 fprintf(stderr, "Couldn't open '%s'...\n", filename.c_str());
00451                 failed = true;
00452         }
00453 }

short reg_variable ( const std::string &  ,
int  type = 0 
)

Definition at line 456 of file rowo.cpp.

References variables.

Referenced by yyparse().

00457 {
00458         for (std::vector<VARIABLE *>::iterator it = variables.begin(); it != variables.end(); it++)
00459         {
00460                 VARIABLE *p = *it;
00461                 if (name == p -> name)
00462                 {
00463                         if (type && !p -> type)
00464                                 p -> type = type;
00465                         if (type && p -> type && type != p -> type)
00466                                 fprintf(stderr,"Variable type mismatch: '%s'\n",name.c_str());
00467                         return p -> nr;
00468                 }
00469         }
00470         VARIABLE *p = new VARIABLE(name, type, variables.size());
00471         variables.push_back(p);
00472         return p -> nr;
00473 }

int yyerror ( char *  s  ) 

Definition at line 286 of file rowo.cpp.

References failed, line, the_str, and x_ptr.

Referenced by yyparse().

00287 {
00288         int i;
00289 
00290         printf("%d>%s\n", line, the_str);
00291         printf("%d ", line);
00292         for (i = 1; i < x_ptr; i++)
00293                 printf(" ");
00294         printf("^ yyerror '%s'\n", s);
00295         failed = true;
00296         return 0;
00297 }

int yylex (  ) 

Definition at line 300 of file rowo.cpp.

References AND, C, C1, COMMENT, EnumObjectType, EQ, fil, IDENTIFIER, If, INT, YYSTYPE::l, line, Loop, MAPOBJECT_BASE, MAPOBJECT_ITEM, MAPOBJECT_NOTHING, MAPOBJECT_PORTAL, MAPOBJECT_POWERUP_UNKNOWN, MAPOBJECT_ROBOT, NEQ, Object, OR, YYSTYPE::str, the_ptr, the_str, x_ptr, and yylval.

Referenced by yyparse().

00301 {
00302         size_t x;
00303 
00304         while (C == ' ' || C == 9)
00305         {
00306                 the_ptr++;
00307         }
00308         while (!C && !feof(fil))
00309         {
00310                 fgets(the_str, 1000, fil);
00311                 the_str[strlen(the_str) - 1] = 0;
00312                 for (size_t i = 0; i < strlen(the_str); i++)
00313                         if (the_str[i] == 9)
00314                                 the_str[i] = ' ';
00315                 the_ptr = 0;
00316                 line++;
00317                 while (C == ' ' || C == 9)
00318                 {
00319                         the_ptr++;
00320                 }
00321         }
00322         if (feof(fil))
00323         {
00324                 return 0;
00325         }
00326         x_ptr = the_ptr;
00327         if (C == '=' && C1 == '=')
00328         {
00329                 the_ptr += 2;
00330                 return EQ;
00331         }
00332         if (C == '!' && C1 == '=')
00333         {
00334                 the_ptr += 2;
00335                 return NEQ;
00336         }
00337         if (C == '&' && C1 == '&')
00338         {
00339                 the_ptr += 2;
00340                 return AND;
00341         }
00342         if (C == '|' && C1 == '|')
00343         {
00344                 the_ptr += 2;
00345                 return OR;
00346         }
00347         if (C == '/' && C1 == '/')
00348         {
00349                 strcpy(yylval.str, the_str + the_ptr);
00350                 C = 0;
00351                 return COMMENT;
00352         }
00353         if (isalpha(C))
00354         {
00355                 x = the_ptr++;
00356                 while (isalnum(C) || C == '_')
00357                 {
00358                         the_ptr++;
00359                 }
00360                 std::string ord = static_cast<std::string>(the_str).substr(x, the_ptr - x);
00361                 strcpy(yylval.str, ord.c_str());
00362                 if (ord == "if")
00363                         return If;
00364                 if (ord == "radar" || ord == "turret" || ord == "gun" || ord == "robot" || ord == "shields" )
00365                 {
00366                         return Object;
00367                 }
00368                 if (ord == "Robot") // Robot, Portal, Powerup, Base, Nothing, Item
00369                 {
00370                         yylval.l = MAPOBJECT_ROBOT;
00371                         return EnumObjectType;
00372                 }
00373                 if (ord == "Portal")
00374                 {
00375                         yylval.l = MAPOBJECT_PORTAL;
00376                         return EnumObjectType;
00377                 }
00378                 if (ord == "Powerup")
00379                 {
00380                         yylval.l = MAPOBJECT_POWERUP_UNKNOWN;
00381                         return EnumObjectType;
00382                 }
00383                 if (ord == "Base")
00384                 {
00385                         yylval.l = MAPOBJECT_BASE;
00386                         return EnumObjectType;
00387                 }
00388                 if (ord == "Item")
00389                 {
00390                         yylval.l = MAPOBJECT_ITEM;
00391                         return EnumObjectType;
00392                 }
00393                 if (ord == "Nothing")
00394                 {
00395                         yylval.l = MAPOBJECT_NOTHING;
00396                         return EnumObjectType;
00397                 }
00398                 if (ord == "loop")
00399                         return Loop;
00400                 return IDENTIFIER;
00401         }
00402         if (isdigit(C))
00403         {
00404                 bool f = false;
00405                 x = the_ptr;
00406                 while (isdigit(C)) // || C == '.' || C == 'e' || C == 'E')
00407                 {
00408                         if (!isdigit(C))
00409                         f = true;
00410                         the_ptr++;
00411                 }
00412                 std::string ord = static_cast<std::string>(the_str).substr(x, the_ptr - x);
00413 /*
00414                 if (f)
00415                 {
00416                         yylval.d = atof(ord.c_str());
00417                         return FLOAT;
00418                 }
00419 */
00420                 yylval.l = atol(ord.c_str());
00421                 return INT;
00422         }
00423         return the_str[the_ptr++];
00424 }

int yyparse (  ) 

Definition at line 596 of file rowo.cpp.

References add_bytecode(), YYSTYPE::codestruct::bytecode, check_method(), check_property(), YYSTYPE::codestruct::code, YYSTYPE::code, codemap, codestr, YYSTYPE::l, reg_variable(), YYSTYPE::str, uniq, yychar, yycheck, YYDEBUG, yydebug, yydefred, yydgoto, YYERRCODE, yyerrflag, yyerror(), YYFINAL, yygindex, yylen, yylex(), yylhs, yylval, YYMAXTOKEN, yynerrs, YYPREFIX, yyrindex, yysindex, yyss, yyssp, yystacksize, yytable, YYTABLESIZE, yyval, yyvs, and yyvsp.

Referenced by parse_file().

00597 {
00598     register int yym, yyn, yystate;
00599 #if YYDEBUG
00600     register char *yys;
00601     extern char *getenv();
00602 
00603     if (yys = getenv("YYDEBUG"))
00604     {
00605         yyn = *yys;
00606         if (yyn >= '0' && yyn <= '9')
00607             yydebug = yyn - '0';
00608     }
00609 #endif
00610 
00611     yynerrs = 0;
00612     yyerrflag = 0;
00613     yychar = (-1);
00614 
00615     yyssp = yyss;
00616     yyvsp = yyvs;
00617     *yyssp = yystate = 0;
00618 
00619 yyloop:
00620     if (yyn = yydefred[yystate]) goto yyreduce;
00621     if (yychar < 0)
00622     {
00623         if ((yychar = yylex()) < 0) yychar = 0;
00624 #if YYDEBUG
00625         if (yydebug)
00626         {
00627             yys = 0;
00628             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00629             if (!yys) yys = "illegal-symbol";
00630             printf("%sdebug: state %d, reading %d (%s)\n",
00631                     YYPREFIX, yystate, yychar, yys);
00632         }
00633 #endif
00634     }
00635     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
00636             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
00637     {
00638 #if YYDEBUG
00639         if (yydebug)
00640             printf("%sdebug: state %d, shifting to state %d\n",
00641                     YYPREFIX, yystate, yytable[yyn]);
00642 #endif
00643         if (yyssp >= yyss + yystacksize - 1)
00644         {
00645             goto yyoverflow;
00646         }
00647         *++yyssp = yystate = yytable[yyn];
00648         *++yyvsp = yylval;
00649         yychar = (-1);
00650         if (yyerrflag > 0)  --yyerrflag;
00651         goto yyloop;
00652     }
00653     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
00654             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
00655     {
00656         yyn = yytable[yyn];
00657         goto yyreduce;
00658     }
00659     if (yyerrflag) goto yyinrecovery;
00660 #ifdef lint
00661     goto yynewerror;
00662 #endif
00663 yynewerror:
00664     yyerror("syntax error");
00665 #ifdef lint
00666     goto yyerrlab;
00667 #endif
00668 yyerrlab:
00669     ++yynerrs;
00670 yyinrecovery:
00671     if (yyerrflag < 3)
00672     {
00673         yyerrflag = 3;
00674         for (;;)
00675         {
00676             if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
00677                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
00678             {
00679 #if YYDEBUG
00680                 if (yydebug)
00681                     printf("%sdebug: state %d, error recovery shifting\
00682  to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
00683 #endif
00684                 if (yyssp >= yyss + yystacksize - 1)
00685                 {
00686                     goto yyoverflow;
00687                 }
00688                 *++yyssp = yystate = yytable[yyn];
00689                 *++yyvsp = yylval;
00690                 goto yyloop;
00691             }
00692             else
00693             {
00694 #if YYDEBUG
00695                 if (yydebug)
00696                     printf("%sdebug: error recovery discarding state %d\n",
00697                             YYPREFIX, *yyssp);
00698 #endif
00699                 if (yyssp <= yyss) goto yyabort;
00700                 --yyssp;
00701                 --yyvsp;
00702             }
00703         }
00704     }
00705     else
00706     {
00707         if (yychar == 0) goto yyabort;
00708 #if YYDEBUG
00709         if (yydebug)
00710         {
00711             yys = 0;
00712             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
00713             if (!yys) yys = "illegal-symbol";
00714             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
00715                     YYPREFIX, yystate, yychar, yys);
00716         }
00717 #endif
00718         yychar = (-1);
00719         goto yyloop;
00720     }
00721 yyreduce:
00722 #if YYDEBUG
00723     if (yydebug)
00724         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
00725                 YYPREFIX, yystate, yyn, yyrule[yyn]);
00726 #endif
00727     yym = yylen[yyn];
00728     yyval = yyvsp[1-yym];
00729     switch (yyn)
00730     {
00731 case 4:
00732 #line 80 "rowo.y"
00733 {
00734                 /* if (*scope) ...*/
00735                 add_bytecode(yyvsp[0].code.bytecode, 0x84); /* ret*/
00736                 /* create codestr / codemap*/
00737                 codemap[yyvsp[-1].str] = codestr.size() / 2; /* entry point*/
00738                 codestr += yyvsp[0].code.bytecode;
00739         }
00740 break;
00741 case 5:
00742 #line 88 "rowo.y"
00743 {
00744                 *yyval.code.code = 0;
00745                 *yyval.code.bytecode = 0;
00746         }
00747 break;
00748 case 6:
00749 #line 92 "rowo.y"
00750 {
00751                 strcpy(yyval.code.code, yyvsp[-1].code.code);
00752                 /* bytecode*/
00753                 strcpy(yyval.code.bytecode, yyvsp[-1].code.bytecode);
00754         }
00755 break;
00756 case 7:
00757 #line 98 "rowo.y"
00758 {
00759                 strcpy(yyval.code.code, yyvsp[0].code.code);
00760                 /* bytecode*/
00761                 strcpy(yyval.code.bytecode, yyvsp[0].code.bytecode);
00762         }
00763 break;
00764 case 8:
00765 #line 103 "rowo.y"
00766 {
00767                 strcpy(yyval.code.code, yyvsp[-1].code.code);
00768                 strcat(yyval.code.code, yyvsp[0].code.code);
00769                 /* bytecode*/
00770                 strcpy(yyval.code.bytecode, yyvsp[-1].code.bytecode);
00771                 strcat(yyval.code.bytecode, yyvsp[0].code.bytecode);
00772         }
00773 break;
00774 case 9:
00775 #line 111 "rowo.y"
00776 {
00777                 strcpy(yyval.code.code, yyvsp[0].code.code);
00778                 /* bytecode*/
00779                 strcpy(yyval.code.bytecode, yyvsp[0].code.bytecode);
00780         }
00781 break;
00782 case 10:
00783 #line 116 "rowo.y"
00784 {
00785                 strcpy(yyval.code.code, yyvsp[0].code.code);
00786                 /* bytecode*/
00787                 strcpy(yyval.code.bytecode, yyvsp[0].code.bytecode);
00788         }
00789 break;
00790 case 11:
00791 #line 121 "rowo.y"
00792 {
00793                 strcpy(yyval.code.code, yyvsp[0].code.code);
00794                 /* bytecode*/
00795                 strcpy(yyval.code.bytecode, yyvsp[0].code.bytecode);
00796         }
00797 break;
00798 case 12:
00799 #line 126 "rowo.y"
00800 {
00801                 strcpy(yyval.code.code, yyvsp[0].code.code);
00802                 /* bytecode*/
00803                 strcpy(yyval.code.bytecode, yyvsp[0].code.bytecode);
00804         }
00805 break;
00806 case 13:
00807 #line 131 "rowo.y"
00808 {       *yyval.code.code = 0;
00809                 *yyval.code.bytecode = 0;
00810         }
00811 break;
00812 case 14:
00813 #line 135 "rowo.y"
00814 {
00815                 /* if (*scope) ...*/
00816                 int x = uniq++;
00817                 *yyval.code.code = 0;
00818                 strcat(yyval.code.code, "       // if_statement\n");
00819                 strcat(yyval.code.code, yyvsp[-2].code.code);
00820                 sprintf(yyval.code.code + strlen(yyval.code.code), "    jz      label_%d\n", x);
00821                 strcat(yyval.code.code, yyvsp[0].code.code);
00822                 sprintf(yyval.code.code + strlen(yyval.code.code), "label_%d:\n", x);
00823                 /* bytecode*/
00824                 strcpy(yyval.code.bytecode, yyvsp[-2].code.bytecode); /* get expression*/
00825                 short len = strlen(yyvsp[0].code.bytecode) / 2; /* length in bytes*/
00826                 add_bytecode(yyval.code.bytecode, 0x0a, len); /* jz*/
00827                 strcat(yyval.code.bytecode, yyvsp[0].code.bytecode); /* scope*/
00828         }
00829 break;
00830 case 15:
00831 #line 151 "rowo.y"
00832 {
00833                 *yyval.code.code = 0;
00834                 strcat(