README100644 765 144 21062 6264112146 10502 0ustar kevinusersIntroduction: *** This program is at an initial Version 1.2, and really *** *** could use a complete rewrite, but it may, nonetheless *** *** prove useful to someone trying to convert VAX/BASIC *** *** source code. I make NO (none at all) guarantees about *** *** anything this program may do. It may even cause *** *** little green elephants to attack you! *** This directory contains am implementation of a program to help convert VAX-BASIC programs into C++. It is meant as a helper program, and not a complete translator. There will still be a lot of hand editing of the source, but this translates it about 72% of the way. (It can also handle many RSTS/E Basic+2 programs to the same percentage) It is written in a combination of C++, FLEX, and BISON. I haven't checked it against other LEX/YACC variants and believe that there are probibly problems in the way included files are handled. It is not a full blown VAX-BASIC compiler, because there are many BASIC features that do not translate easily to C++ (such as ON ERROR GOTO, GOSUB, STRINGS, ...), but it can actually handle many simple programs completely. (Try shellsort.bas and bubblesort.bas for examples) I've developed this program for my own entertainment, and have happily used its output as a starting point for my own work. It usually takes a lot of editing to get something usefull, but it's often easier than starting from scratch. This program is really just a toy for me to play with, so please don't expect production quality code herin. Usage: The command line is as follows: btran [-o output-file] [-t] [-t1] [-t2] [-v] [-p] [-c] input-file where -o specifies the output file name (must be entered before an input file name) If there is no -o defined, it outputs to standard output. -t dump out the parse tree both before & after block processing. (Useful only for debugging) -t1 dump out the parse tree both before block processing. (Useful only for debugging) -t2 dump out the parse tree both after block processing. (Useful only for debugging) -v dump out the variable table periodically. (Useful only for debugging) -c Output code from include files (Compiler vs translation). -p Output position inside compiler (For debugging purposes). input-file specifies the source file name, and requires the ".bas" extension. The parser is fussy about the formatting used in BASIC programs, since VAX-BASIC wasn't originally designed to be parsed with a YACC grammar. You may need to reformat the BASIC programs a little to be able to parse them, or modify the grammar (parse.y) to handle your particular needs. Internals: The parser operated on the source in several passes (only reads the actual source on the first pass) 1. Initial parsing pass. Create an initial parse tree. This is done using FLEX (lex.l) and BISON (parse.y) grammars. 2. Modify the parse tree to put blocks of code under the the main statement. (block out IF, FOR, WHILE, FUNCTION, SUB, DEF, ...) This is done in main.cc. 3. Scan functions/subroutines for all variables referenced and/or defined, then work up some kind of translation of those names to C++. This is done in nodes.cc 4. Write out the translated functions/subroutines in C++. This is also done in nodes.cc. I encourage others to enhance this program. Some things that need working on include: * Features added to BASIC after V2.4. (The only version I have available to me) * Looking into CDD data structures for variable definitions. Maybe by extracting to a text file first, then parsing (using popen or some such to do the extract)? * Enhancements to the variable table. (Structures and such) * Code generation. * Files. * Strings (Started, uses 'str' library). * Decimal data type. * Pass mechanism (by value, descriptors, ...) * Return values from functions. * ON ERROR trapping. * GOSUB. * Data Statements: data itself, reading, reset, ... * Functions built into basic. (Need C versions, ...) * Include files require a blank line (or comment) as the first line. (flex/bison interface problem, line comes in as '#include xxx first-line-of-include\n') * Error trapping. * Too many different things are being done in nodes.cc. Split this up somehow? * Speed inprovements. * Break up long output lines. * Comments may float around a bit. * An empty 'main' function is generated when compiling a function. * Parsing of 'DECIMAL' and 'DECIMAL(10,2)'. * Print formatting differs from VAX/BASIC. See especially comma's in print, and spacing between numbers. * Variable nmumber of arguements for System Functions. * Case of external function calls. * Input statements don't handle text prompts, or print the question mark prompt. * And much, much, much more If you make any enhancements to the program, please drop me a line so that I can try to merge everyones changes together. Please use the same formatting as is currently used in the program. It's hard to find changes when the source is reformatted, and I'll probably have other changes from other people that I need to merge together, as well as my own modifications. Don't modify the files lex.cc or parse.cc directly. Make changes to lex.l and parse.y, then regenerate the .cc files. (using FLEX and BISON). History: I have a huge number of programs written in VAX-BASIC (V2.4), that I want to convert to C, or C++. After converting several of the simpler functions into C (giving me mixed BASIC and C programs) I decided that there had to be a better way, and thus started creating this program. I started with a very, very simple program to help convert to C, which did little more than convert comments to /*...*/ format and letters to lower case. It has slowly grown to parse the source code, and convert it into C++ instead of C. I am converting to C++ instead of C because: print statements are easier to convert to "cout << ..." instead of "printf(...)" which requires a format statement, strings can be implemented using a class, errors can possibly be converted into exceptions, etc.. Overall, it seemed to be a lot simpler to translate to. I have only implemented those items that I needed to convert my programs, and thus am probably missing large chunks of the language. It still requires a lot of hand processing on most programs. The version numbering in the history works as follows: major . minor . file where 'major' is the major package version, 'minor' is the release version, and 'file' is the file's edit revision. 'major' and 'minor' change in all files at once, 'file' is unique to each source module. All pretty formatting done in the original basic source will be lost, and the output C++ format will be based upon my preferences, which may not be yours. Files: README. This file MAKEFILE Last makefile that I used (Usually Linux) MAKEFILE.LINUX Makefile for Linux/Unix MAKEFILE.VMS Make file for VAX/VMS BASIC.H Headers NODES.H "" PARSE.H "" VARIABLE.H "" LEX.L Source Code Lexical analyzer MAIN.CC "" Main routine NODES.CC "" Processing on nodes PARSE.Y "" Grammer parser VARIABLE.CC "" Processing on single variables VARLIST.CC "" Handling the variable tables LEX.CC lex.l after running through flex PARSE.CC parse.y after running through bison BSTRINGN.H Runtime library for translated programs BASICFUN.H "" DATALIST.H "" BUBBLESORT.BAS Test programs that convert completely CPU.BAS "" SHELLSORT.BAS "" WORKS.BAS "" YUCK.BAS Strange code that actually runs like vax'n Bugs: To compile on Messy-dos/Borland C, you may need to change the include in lex.cc from to It doesn't handle all basic statements, and some statements need to be reformatted for it to understand them. Print statements may output differently in c++ than they do under Basic. (Spacing, float format, ...) VAX/BASIC was never really designed to be parsed with a BISON and FLEX combination, but it seems to work to some extent anyway. Author: Kevin Handy (kth@srv.net) (208)528-7275 Software Solutions, Inc. http://srv.net/~kth 589 4th Street Idaho Falls, Idaho 83401 Please drop me a line if you play with this. Any feedback at all would be welcome. -->******************************************************<-- --> Customized business accounting software for VAX/VMS. <-- --> Including A/R, A/P, General Ledger, Payroll, <-- --> Inventory, POS, Order entry, and much more <-- -->******************************************************<-- Enjoy basic.h100644 765 144 3045 6242161014 11027 0ustar kevinusers/******************************************************************************* Program: Basic.h 01.01.00 Title: Basic Translater Main Header File Description: This is the main header file for the basic translater. Bugs: History: 01.01.01 - 10/22/1996 - Kevin Handy Added variables 'IntegerType' and 'RealType'. *******************************************************************************/ #ifndef _BASIC_H_ #define _BASIC_H_ #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif // // Include files // #include #include "nodes.h" #include "variable.h" // // Format for transfering info between flex and yacc // #define YYSTYPE Node * // // Required by Lex and Yacc // extern FILE *yyin; extern int xline; extern int yydebug; // // External stuff in basic_main.c // extern VariableList *Variables; extern int CompileFlag; extern int NeedIostreamH; extern int NeedStdlibH; extern int NeedStringH; extern int NeedMathH; extern int NeedErrorH; extern int NeedRFA; extern int NeedBasicFun; extern int NeedTimeH; extern int NeedDataList; extern int IntegerType; extern int RealType; extern int DebugDump; extern int DebugDumpOne; extern int VariableDump; extern int PositionDump; void DoProgram(Node *Program); #ifndef __MSDOS__ char *strupr(char *s); char *strlwr(char *s); #endif // // Parsing stuff // extern int xline; extern int include_stack_pointer; extern Node* CommentList; extern char* include_name[]; int yyparse(); int yyerror(char *s); int yylex( void ); #ifdef __MSDOS__ extern "C" { void* alloca(int); } #endif #endif basicfun.h100644 765 144 2667 6242161014 11551 0ustar kevinusers// // Header file for special routines written to handle basic // functions that do not have a direct C++ equivelent. // // History: // // 01.01.01 - 09/20/1996 - Kevin Handy // Put '#ifdef' around entire include file. // #ifndef _BASICFUN_H_ #define _BASICFUN_H_ // // Instr search function. // inline int instr(int Start, char* Base, char* Search) { char* test = strstr((Base + Start - 1), Search); return (test != NULL) ? (int)(test - Base + 1) : 0; } // // Rnd (random number between 0 and 1) // This is a real nasty hack, and may not produce as // wide a range of random numbers as basic desires. // inline double floatrand() { return ((double) rand()) / ((double) RAND_MAX); } // // BasicChannel class (I/O functions) // // Note: Only have basic layout defined. // Functions are not cefined anywhere yet. // class BasicChannel { public: BasicChannel(); ~BasicChannel(); void Open(char* FileName); void Close(); void Reset(); void Put(); void Get(); void Delete(); void Find(); void Unlock(); void SetRecordSize(); void SetFileSize(); void SetExtendSize(); void SetWindowSize(); void etBlockSize(); void SetBucketSize(); void SetMode(); void SetBuffer(); void SetDefaultName(); void SetKey(); void SetTemporary(); void SetContiguous(); void SetRewind(); void SetSpan(); void SetOrginization(); void SetAccess(); void SetAllow(); void SetConnect(); void SetMap(); void SetRecordType(); void GoofyOpenStuff(); }; #endif bstring.h100644 765 144 17333 6264103312 11444 0ustar kevinusers// // bstring.h // // String class for Basic to C++ translator // // Description: // // This file impliments a string class for my Basic // translater using VMS style descriptors and string // functions. This allows the programs to interface // with the VMS routines as easily as under the // real VAX/BASIC compiler. // // This is really nothing more than a wrapper around // the STR$xxx functions, and the DSC$DESCRIPTOR_S // stuff. // // History: // // 01.00.00 - 09/19/1996 - Kevin Handy // Original version. Very minimal. Assignment and output // only exist. All code contained in '.h' file (easier // to debug). // // 01.02.01 - 09/20/1996 - Kevin Handy // Added in '+' operator for BString and char. // // 01.02.02 - 01/01/1997 - Kevin Handy // Added sever string functions, including left, // right, pos, mid, string, space, strlen. // // 01.02.03 - 01/04/1997 - Kevin Handy // Added comparison operators (Bstring to Bstring) // // 01.02.04 - 01/05/1997 - Kevin Handy // Added more functions. Qnum, Qnum1 // #ifndef _bstring_h_ #define _bstring_h_ // // Include files // extern "C" { #include #include "descrip.h" #include "strdef.h" } #include /* * Define some simple types that vary from machine to machine */ typedef short int intx; // Default integer type typedef double floatx; // Default float type // // Hard coded constants // static const char BEL = 7; // Bell static const char BS = 8; // Backspace static const char HT = 9; // Horizontal tab static const char LF = 10; // Line feed static const char VT = 11; // Vertical tab static const char FF = 12; // Form feed static const char CR = 13; // Carriage return static const char SO = 14; // Shift out static const char SI = 15; // Shift in static const char ESC = 27; // Escape static const char SP = 32; // Space static const char DEL = 127; // Delete //static const double PI = 3.1415926535;// Pi (Someone else already defined this) // // BString class // class BString : public dsc$descriptor_s { public: BString(); BString(const char* Text); ~BString(); // // Operators // BString& operator = (const char* Text); BString& operator = (const BString& Source) { str$copy_dx(this, &Source); return *this; } // // Functions // // // I/O functions (Hack, needs lots of work) // friend ostream& operator<< (ostream& os, BString& bs) { if (bs.dsc$a_pointer != NULL) {for (int loop=0; loop> (istream& is, BString& bs) { char inputstr[128]; is >> inputstr; bs = inputstr; } // // Operators // friend BString& operator + (const BString& Text1, const BString& Text2); friend BString& operator + (const BString& Text1, const char* Text2); friend int operator == (const BString& Text1, const BString& Text2); friend int operator < (const BString& Text1, const BString& Text2); friend int operator <= (const BString& Text1, const BString& Text2); friend int operator > (const BString& Text1, const BString& Text2); friend int operator >= (const BString& Text1, const BString& Text2); friend int operator != (const BString& Text1, const BString& Text2); }; // // Constructor // BString::BString() { // cout << "MakeD" << endl; dsc$b_dtype = DSC$K_DTYPE_T; // Text class dsc$b_class = DSC$K_CLASS_D; // Dynamic dsc$w_length = 0; // Length = 0 dsc$a_pointer = NULL; // No allocation } BString::BString(const char* Text) { // cout << "MakeS" << endl; dsc$b_dtype = DSC$K_DTYPE_T; // Text class dsc$b_class = DSC$K_CLASS_S; // Static dsc$w_length = strlen(Text); // Length dsc$a_pointer = (char*)Text; // Point at origional string } // // Destructor // BString::~BString() { // cout << "Killed" << endl; // // Release memory allocation if this is a string class // if ((dsc$b_class == DSC$K_CLASS_D) && (dsc$a_pointer != NULL)) { str$free1_dx(this); } } // // Assignment // BString& BString::operator = (const char* Text) { short Length = strlen(Text); str$copy_r(this, &Length, Text); return *this; } // // Left() // inline BString& left(const BString& Source, long Length) { BString* NewString = new BString; str$left(NewString, &Source, &Length); return *NewString; } // // Right() // inline BString& right(const BString& Source, long Length) { BString* NewString = new BString; str$right(NewString, &Source, &Length); return *NewString; } // // pos() // inline BString& pos(const BString& Source, long Start, long End) { BString* NewString = new BString; str$pos_extr(NewString, &Source, &Start, &End); return *NewString; } // // mid() // inline BString& mid(const BString& Source, long Start, long Length) { BString* NewString = new BString; long End = Start + Length - 1; str$pos_extr(NewString, &Source, &Start, &End); return *NewString; } // // string // inline BString& Qstring(long Count, int Character) { BString* NewString = new BString; char Source = Character; str$dupl_char(NewString, &Count, &Source); return *NewString; } // // space // inline BString& Qspace(long Count) { BString* NewString = new BString; char XSpace = ' '; str$dupl_char(NewString, &Count, &XSpace); return *NewString; } // // Qnum(integer) // inline BString& Qnum(long Number) { char Result[32]; BString* NewString = new BString; sprintf(Result, "%ld ", Number); *NewString = Result; return *NewString; } // // Qnum(float) // inline BString& Qnum(double Number) { char Result[32]; BString* NewString = new BString; sprintf(Result, "%f ", Number); *NewString = Result; return *NewString; } // // Qnum1(integer) // inline BString& Qnum1(long Number) { char Result[32]; BString* NewString = new BString; sprintf(Result, "%ld", Number); *NewString = Result; return *NewString; } // // Qnum1(float) // inline BString& Qnum1(double Number) { char Result[64]; BString* NewString = new BString; sprintf(Result, "%f", Number); *NewString = Result; return *NewString; } // // trm // inline BString trm(const BString& Source) { BString* NewString = new BString; unsigned short Length; str$trim(NewString, &Source, &Length); return *NewString; } // // strlen // inline long strlen(const BString& Source) { unsigned short Length; char* Address; str$analyze_sdesc(&Source, &Length, &Address); return Length; } // // Addition // BString& operator + (const BString& Text1, const BString& Text2) { // // Allocate a new string // BString* NewString = new BString; // // Combine strings together. // Using copy,aappend instead of concat, because varargs // won't give me information about number of paramaters. // str$copy_dx(NewString, &Text1); str$append(NewString, &Text2); // // Give back the new string // return *NewString; } BString& operator + (const BString& Text1, const char* Text2) { // // Allocate a new string // BString* NewString = new BString; BString Transform(Text2); // // Combine strings together // str$copy_dx(NewString, &Text1); str$append(NewString, &Transform); // // Give back the string // return *NewString; } int operator == (const BString& Text1, const BString& Text2) { return !str$compare_eql(&Text1, &Text2); } int operator < (const BString& Text1, const BString& Text2) { return str$compare(&Text1, &Text2) == -1; } int operator <= (const BString& Text1, const BString& Text2) { return str$compare(&Text1, &Text2) <= 0; } int operator > (const BString& Text1, const BString& Text2) { return str$compare(&Text1, &Text2) == 1; } int operator >= (const BString& Text1, const BString& Text2) { return str$compare(&Text1, &Text2) >= 0; } int operator != (const BString& Text1, const BString& Text2) { return str$compare(&Text1, &Text2) != 0; } // // Various string type functions // static inline int Ascii(const char x) { return x; } static inline int Ascii(const char* x) { return *x; } #endif bubblesort.bas100644 765 144 452 6227567704 12431 0ustar kevinusers10 dim a%(1000%) n% = 200% a%(i%) = rnd * 10000. for i% = 1% to n% 100 for i% = 1% to n% for j% = 1% to n% - 1% if (a%(j%) > a%(j%+1%)) then temp% = a%(j%) a%(j%) = a%(j% + 1%) a%(j% + 1%) = temp% end if next j% next i% print a%(i%) for i% = 1% to n% 32767 end changelog100644 765 144 2577 6263654737 11506 0ustar kevinusersPrevious to Version 1.0 Initial version. Written in C, FLEX, BISON. Trial to see if Flex/Bison could possibly be used to parse Vax/Basic, RSTS/Basic+, RSTS/Basic+2. Really lousy variable table. Outputs C code. No library of code to link against. Version 1.0 Converted C parts to C++. Broke source code into several files and stuffed functions into classes. Rough code generation. Two variable tables: Local and global. (Still lousy) Now outputs C++ code. (Can now define my own variable types!) Only '#include' header file that links into program. Not using STL (Not available for VMS/G++) Version 1.1 Now Parses 99.9% of VAX/BASIC (2.4), RSTS/Basic+, RSTS/BASIC+2 source code that I've tried it on, although code generation doesn't output code for everything yet. Handles 'THEN' 'ELSE' and 'END IF' like line breaks, instead of program statements. Somewhat better code generation. Still needs work. Broke variable table into two parts: 'variable' and 'varlist'. Only a couple more items in '#include' file. Version 1.2 Create a better string package, using the 'str' package to handle VAX style strings. Create simple string io statements. Create many string functions, including 'left', 'right', 'mid', 'pos', 'trm', 'string'. Generate string operations '=', '+', '<', '<=', '>', '>=', and '!='. Fix bug in 'OPTION SIZE' processing. Ignored what the user asked for. changev0100100644 765 144 24147 6212166722 11472 0ustar kevinusersmain.cc 01.00.00 - 09/11/1993 - Kevin Handy Original 01.00.01 - 10/20/1995 - Kevin Handy Added variable NeedRFA to flag need for RFA definition. 01.00.02 - 11/28/1995 - Kevin Handy Fixed messages to use "cerr" instead of "cout". 01.00.03 - 11/28/1995 - Kevin Handy Added "NeedBasicFun" stuff, to include special basic header. 01.00.04 - 11/28/1995 - Kevin Handy Added "NeedTimeH" code. 01.00.05 - 02/08/1996 - Kevin Handy Added 'CompileFlag' option to select between translation (where include files are not output), and compile (where they are). 01.00.06 - 07/15/1996 - Kevin Handy Fixed so it would delete more of the nodes that were dropped in the 'ScanForLoops' 01.00.07 - 07/24/1996 - Kevin Handy Don't delete ELSE nodes. They get linked onto. 01.00.08 - 08/13/1996 - Kevin Handy Added "PosotionDump" flag to optionally display position of the program. Change a 'fprintf' to a 'cerr' 01.00.09 - 08/15/1996 - Kevin Handy Initialize line counter. nodes.cc (Since split into basenode.cc and decnode.cc) 01.00.00 - 09/10/1993 - Kevin Handy 01.00.01 - 11/09/1995 - Kevin Handy Remove trailing colon on label names. 01.00.02 - 11/15/1995 - Kevin Handy Fix handling of DIM statements. Was mostly ignored. 01.00.03 - 11/16/1995 - Kevin Handy Fix DIM statements so it will output a variable type (i.e. output "int a[10]" instead of "DIM a[10]"). 01.00.04 - 11/16/1995 - Kevin Handy Fix record structures so that variables used inside of a structure don't also get defined outside of the structure. 01.00.04 - 11/16/1995 - Kevin Handy Fix so that functions don't output two variable types "int void main()". 01.00.05 - 11/16/1995 - Kevin Handy Modified to handle "INSTR" specially. 01.00.06 - 11/20/1995 - Kevin Handy Modified to output a definition for RmsRfa if used within the program. 01.00.07 - 11/20/1995 - Kevin Handy Created function OutputCodeNoParen to reduce amount of duplicated code, and to allow losing more than one level of parentheses. 01.00.08 - 11/28/1995 - Kevin Handy Fixed bug where bare "PRINT" came out as "cout;" instead of "cout << endl;". 01.00.09 - 11/28/1995 - Kevin Handy Lose modification for "instr". Make special function in "basicfun.h" for instr. 01.00.10 - 11/29/1995 - Kevin Handy Removed "?OPTION(????)" from source code output. 01.00.11 - 12/07/1995 - Kevin Handy Allowed empty parentheses (array references), because some functions may be called with an entire array. 01.00.12 - 12/12/1995 - Kevin Handy Check ThisVar being NULL in OutputVarName when putting out possible array reference. 01.00.13 - 12/14/1995 - Kevin Handy Output of need to zero NeedStdlibH instead of NeedIostreamH. 01.00.14 - 12/27/1995 - Kevin Handy Modified to seperate out an assignment list from a regular list. 01.00.15 - 01/02/1995 - Kevin Handy Created function OutputArrayParam to output array references. 01.00.16 - 01/02/1995 - Kevin Handy Modified handling of BAS_N_LIST, so that we no longer have the SepChar to specify the seperator character. It is no longer needed. 01.00.17 - 02/08/1996 - Kevin Handy Handle 'CompileFlag'. 01.00.18 - 02/13/1996 - Kevin Handy Removed VariableFixup call in VariableScan, and made sure that all main calls to VariableScan have a call to VariableFixup afterwards. (Speed up attempt). 01.00.19 - 02/20/1996 - Kevin Handy Worked on print statements. 01.00.20 - 07/12/1996 - Kevin Handy Fixed DEF FN... statements to work like FUNCTION ... statements. (copied code from one to the other) 01.00.21 - 08/08/1996 - Kevin Handy Handle I/O channels as an array 'BasicChannel[]' instead of trying to assign to the channel, which may be a number. Don't call 'ClearLocal' in a 'DEF'. Causes errors. 01.00.22 - 08/09/1996 - Kevin Handy Handle Tree[3] on definitions as a size specification. Handle BAS_S_DECIMAL. Changed 'basic_return' to 'GosubReturn'. Changed 'basic_resume' to 'BasicResume'. 01.00.23 - 08/20/1996 - Kevin Handy Use a class for a data list, instead of an array. (This is much easier to read and find in the source) 01.00.24 - 08/21/1996 - Kevin Handy Work on Open, Get, ..., and related calls. 01.00.25 - 08/27/1996 - Kevin Handy Output "BString" instead of "String" so we won't clash with other's string classes. variable.cc 01.00.00 - 09/11/1993 - Kevin Handy Original 01.00.01 - 11/28/1995 - Kevin Handy Modified to output "floatrand()" instead of "rand()", because of the float/integer range problem. 01.00.02 - 01/03/1995 - Kevin Handy Clean up processing of array dimensions. Output "[11]" on one line of code instead of using several lines from old methods. 01.00.03 - 02/15/1996 - Kevin Handy Change "Down" item to "Left" and "Right" items, in an attempt at speeding up things a little. 01.00.04 - 08/14/1996 - Kevin Handy Added 'DECIMAL' data type. 01.00.05 - 08/27/1996 - Kevin Handy Change "String" to "BString" so it doesn't clash with other's string classes. varlist.cc 01.00.00 - 02/14/96 - Kevin Handy Split off from variable.cc 01.00.01 - 02/15/96 - Kevin Handy Modified to store VariableList as a tree, instead of a simple list. Went from 96.72 seconds in VariableList::Lookup to 14.41 Seconds on the same code (Using profiler option in G++). 01.00.02 - 02/15/1996 - Kevin Handy Use 'NULL' in several places instead of 'o'. 01.00.03 - 02/15/1996 - Kevin Handy Move constructor and destructor to top of this file. Was down in the middle somewhere. 01.00.04 - 06/25/1996 - Kevin Handy Fix bug where it sometimes wouldn't find a variable in it's list, thus adding it in several times. 01.00.05 - 06/26/1996 - Kevin Handy Fixed LookupCppTree to return Node instead of VarTable in first case. 01.00.06 - 07/12/1996 - Kevin Handy Any variable that starts with the two characters "FN" must be a funciton. 01.00.07 - 08/08/1996 - Kevin Handy Define function "ASCII" as "(char)". Added CVT?? functions so you could tell what they were in the output. 01.00.08 - 08/13/1996 - Kevin Handy Change 'printf' to 'cerr' in several places. 01.01.00 - 08/30/1996 - Kevin Handy Update version to 1.1, and install on internet. parse.y 01.00.00 - 09/11/1993 - Kevin Handy Original 01.00.01 - 11/19/1995 - Kevin Handy Modification to DIM statement so it filled in the structure to match how a declare does. 01.00.02 - 11/30/1995 - Kevin Handy Created BAS_V_RMSRECORD type so that NODES.CC won't get confused between a structure definition and a "get..., record..." type clause. 01.00.03 - 12/27/1995 - Kevin Handy Modified to split out an assignment list from a regular list. Create new node BAS_N_ASSIGNLIST. Created new terminal printlist from exprlist, and lost semicolon option in exprlist. Created new terminal paramlist from exprlist which uses expressionx, modified everything else to use expression instead of expressionx, Use exprlist in close#, instead of expression. 01.00.04 - 01/05/1996 - Kevin Handy Fix so it handles definitions seperated by commas. 01.00.05 - 01/24/1996 - Kevin Handy Changed how THEN and ELSE are managed. Allows much greater freedom, but does allow really strange and useless statements. 01.00.06 - 02/14/1996 - Kevin Handy Added "MODE" option to open statement. 01.00.07 - 02/16/1996 - Kevin Handy Added ability to handle "THEN 100" type of statements. 01.00.08 - 02/19/1996 - Kevin Handy Added "$$ = NULL;" to several "empty" items. Was causing some odd errors. 01.00.09 - 02/19/1996 - Kevin Handy Rewrote handling of input/output statements. Caused loss of printlist terminal. 01.00.10 - 02/20/1996 - Kevin Handy More modifications to how print statements work. 01.00.11 - 08/02/1996 - Kevin Handy Added "EXTEND" keyword 01.00.12 - 08/02/1996 - Kevin Handy Allow negitive numbers in data statements. 01.00.13 - 08/13/1996 - Kevin Handy Allow "CASE = x". Use 'cerr' instead of 'fprintf'. Allow 'EXIT label' (pretend it's a goto). 01.00.14 - 08/14/1996 - Kevin Handy Use Tree[3] as size specifier on definition. Allow 'BY ...' in sub definition, as in 'SUB xxx BY yyy(xxx%)' Added keyword "DECIMAL" Added Unary plus Added 'NODUPLICATES'. Allow "PRIMARY" as well as "PRIMARY KEY". Added "MOVE..." code. Added "MARGIN..." code. 01.00.14 - 08/15/96 - Kevin Handy Added 'DECLARE xxx FUNCTION xxx' Rewrote handling of comments. Added 'NOCAHNGES'. Display include file name on error (if in one) 01.00.15 - 08/16/96 - Kevin Handy Added "COUNT xxx" to 'put' and 'print' statements. Modified handling of 'THEN', 'ELSE', and 'END IF' so they didn't need to be on seperate lines or require so much code to handle. 01.00.16 - 08/20/1996 - Kevin Handy Set flag NeedDataList as necessary. lex.l 01.00.01 - 11/16/1995 - Kevin Handy Modified to seperate out INSTR function. 01.00.02 - 11/20/1995 - Kevin Handy Modified to flag usage of RFA keyword. 01.00.03 - 11/20/1995 - Kevin Handy Changed handling of random, randomize, rnd. 01.00.04 - 12/27/1995 - Kevin Handy Fixup include_stack_pointer when done with one file, so that is doesn't go negative when multiple files are processed. 01.00.05 - 02/14/1996 - Kevin Handy Added "MODE" as a reserved word. 01.00.06 - 08/02/1996 - Kevin Handy Added "EXTEND" keyword 01.00.07 - 08/13/1996 - Kevin Handy Added check for "PositionDump" flag. Use "cerr" instead of "fprintf". 01.00.08 - 08/14/1996 - Kevin Handy Added keyword "DECIMAL". Added keyword "NODUPLICATES". Added keyword "FROM". 01.00.09 - 08/15/1995 - Kevin Handy Make 'CountLine' an inline function. (Speed up?) Change define 'SETRETURN' from a '#define' to an inline function. Return type of remark for comment ended with an &. Changed handling of comments. Added keyword "NOCHANGES". Remember names of include files. 01.00.10 - 08/16/1996 - Kevin Handy Added 'END IF' as it's own code, so the Parser wouldn't be geting so upset about the 'END IF' statement. Lose 'CountLine()' call on comment terminated by '&', since the new line gets counted later. 01.00.11 - 08/17/1996 - Kevin Handy Fixed handleing of "~...&\n" format comments. cpu.bas100644 765 144 733 6227567705 11060 0ustar kevinusers1 ! CPU Test program - See which cpu is faster option size = integer long Total = 0.0 Counter% = 0% Summ = 1.0 Siner = 0.0 for i% = 1% to 65000% Total = Total + 1.0 / i% next i% print Total for i% = 1% to 65000% Counter% = Counter% + i% next i% print Counter% for i% = 1% to 65000% Summ = Summ * (1.0 + 1.0 / i%) next i% print Summ for i% = 1% to 65000% Siner = Siner + sin((1.0 * i%) / 3.1415926535) next i% print Siner 32767 end datalist.h100644 765 0 154 6232606746 11321 0ustar kevinroot class DataListClass { private: int count; public: DataListClass() { count = 0; } ~DataListClass(); }; lex.cc100644 765 144 360473 6242161030 10745 0ustar kevinusers/* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.89 96/05/25 21:02:21 vern Exp $ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 293 #define YY_END_OF_BUFFER 294 static yyconst short int yy_accept[880] = { 0, 0, 0, 0, 0, 294, 293, 3, 1, 293, 293, 21, 293, 293, 293, 11, 12, 13, 16, 20, 17, 293, 14, 289, 18, 19, 25, 23, 26, 15, 22, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 282, 283, 293, 293, 293, 3, 0, 10, 8, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 5, 27, 287, 290, 287, 289, 0, 28, 33, 30, 34, 24, 32, 29, 31, 291, 291, 291, 0, 291, 291, 291, 291, 291, 177, 291, 0, 0, 291, 291, 291, 259, 291, 46, 291, 291, 291, 291, 291, 264, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 71, 291, 291, 291, 263, 291, 291, 291, 291, 291, 96, 291, 98, 101, 291, 260, 102, 291, 291, 291, 291, 291, 291, 261, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 125, 291, 128, 291, 291, 270, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 266, 291, 265, 268, 291, 291, 291, 291, 291, 291, 291, 291, 291, 192, 291, 291, 291, 291, 291, 291, 291, 262, 291, 291, 291, 291, 291, 291, 291, 282, 0, 285, 0, 0, 286, 9, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 287, 0, 288, 292, 197, 291, 291, 291, 38, 39, 291, 212, 199, 0, 0, 0, 0, 291, 258, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 54, 291, 200, 291, 291, 291, 291, 62, 269, 291, 291, 66, 291, 291, 291, 291, 291, 69, 72, 73, 74, 291, 267, 291, 201, 291, 291, 291, 291, 202, 291, 89, 291, 291, 291, 97, 291, 291, 291, 291, 103, 291, 291, 291, 203, 291, 107, 291, 291, 250, 109, 291, 291, 251, 205, 291, 291, 113, 230, 253, 291, 291, 291, 291, 291, 291, 291, 291, 124, 291, 291, 291, 291, 291, 291, 291, 291, 254, 291, 134, 291, 291, 291, 291, 291, 141, 291, 291, 291, 291, 188, 291, 195, 291, 291, 291, 291, 291, 237, 206, 291, 291, 291, 208, 291, 291, 291, 158, 291, 242, 243, 209, 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 211, 291, 291, 291, 291, 291, 291, 291, 291, 176, 0, 273, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 287, 198, 291, 291, 291, 291, 291, 41, 291, 291, 291, 291, 178, 47, 49, 291, 291, 291, 216, 291, 291, 291, 291, 291, 291, 291, 291, 291, 59, 291, 291, 291, 291, 291, 65, 224, 291, 291, 291, 225, 291, 180, 0, 291, 291, 227, 76, 291, 291, 181, 82, 85, 291, 291, 291, 291, 291, 91, 92, 291, 291, 291, 291, 100, 291, 291, 291, 291, 291, 291, 108, 249, 185, 291, 111, 291, 186, 112, 291, 252, 115, 291, 117, 118, 119, 291, 291, 122, 291, 231, 291, 291, 126, 291, 291, 291, 291, 291, 291, 291, 235, 291, 291, 137, 187, 291, 291, 291, 291, 291, 291, 291, 291, 148, 291, 257, 291, 291, 291, 152, 291, 291, 154, 207, 155, 156, 239, 291, 291, 291, 291, 291, 191, 245, 246, 162, 291, 291, 291, 291, 291, 291, 210, 291, 291, 291, 172, 291, 291, 194, 291, 291, 0, 0, 272, 0, 0, 280, 0, 0, 274, 0, 0, 291, 36, 291, 291, 213, 42, 291, 291, 291, 0, 291, 215, 50, 291, 53, 291, 217, 291, 291, 58, 218, 219, 221, 220, 222, 223, 291, 291, 291, 291, 291, 291, 291, 226, 0, 70, 75, 291, 291, 80, 291, 84, 83, 86, 87, 291, 291, 291, 291, 291, 291, 99, 291, 291, 105, 196, 291, 291, 248, 291, 204, 291, 291, 291, 291, 291, 232, 291, 291, 291, 291, 291, 291, 291, 133, 291, 291, 291, 291, 291, 144, 291, 291, 291, 256, 291, 291, 291, 291, 153, 291, 291, 291, 291, 291, 241, 291, 244, 291, 291, 291, 166, 291, 193, 168, 291, 291, 173, 291, 175, 247, 284, 278, 277, 0, 0, 0, 276, 275, 35, 291, 40, 291, 291, 45, 214, 0, 291, 52, 55, 291, 291, 291, 291, 291, 64, 291, 179, 291, 70, 77, 291, 291, 88, 291, 291, 291, 229, 182, 183, 291, 291, 291, 110, 114, 116, 291, 291, 123, 233, 127, 291, 291, 130, 234, 291, 135, 236, 138, 291, 291, 291, 146, 147, 255, 291, 150, 291, 189, 238, 157, 190, 159, 291, 291, 291, 164, 165, 167, 291, 291, 291, 291, 0, 0, 281, 291, 291, 291, 0, 291, 51, 291, 291, 60, 61, 291, 291, 291, 291, 291, 291, 228, 90, 291, 104, 184, 106, 291, 291, 291, 291, 132, 291, 291, 291, 291, 291, 145, 149, 291, 240, 160, 291, 291, 291, 170, 171, 291, 271, 279, 291, 291, 291, 0, 48, 56, 291, 291, 291, 291, 291, 79, 81, 93, 291, 291, 291, 291, 291, 291, 291, 291, 143, 291, 291, 291, 169, 291, 37, 43, 291, 48, 291, 291, 67, 291, 291, 291, 120, 291, 291, 129, 136, 291, 291, 291, 291, 161, 163, 291, 44, 57, 291, 68, 78, 291, 291, 291, 291, 140, 139, 142, 151, 174, 63, 94, 291, 291, 291, 95, 121, 131, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, 21, 21, 21, 21, 21, 22, 23, 24, 25, 26, 1, 1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 1, 27, 1, 28, 29, 1, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[56] = { 0, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 2, 2, 4, 4, 4, 2, 4, 4, 4, 2, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2 } ; static yyconst short int yy_base[893] = { 0, 0, 0, 54, 58, 522, 3530, 516, 3530, 66, 507, 3530, 39, 507, 498, 3530, 3530, 493, 3530, 3530, 3530, 70, 3530, 75, 480, 3530, 47, 73, 54, 3530, 3530, 103, 148, 196, 83, 241, 288, 132, 70, 150, 94, 125, 171, 187, 211, 309, 221, 330, 348, 373, 232, 263, 153, 270, 494, 3530, 490, 452, 458, 457, 97, 3530, 3530, 138, 450, 0, 34, 402, 43, 409, 399, 406, 401, 393, 3530, 406, 0, 3530, 296, 3530, 385, 404, 152, 3530, 3530, 3530, 3530, 3530, 3530, 3530, 3530, 407, 3530, 132, 0, 184, 301, 385, 318, 209, 397, 276, 409, 403, 403, 409, 297, 342, 421, 422, 431, 396, 430, 437, 441, 445, 449, 456, 468, 472, 476, 480, 490, 491, 497, 498, 504, 513, 505, 521, 520, 533, 537, 544, 549, 551, 552, 561, 562, 569, 575, 576, 582, 583, 589, 599, 598, 608, 615, 614, 622, 636, 632, 626, 643, 649, 653, 659, 673, 666, 681, 693, 642, 688, 695, 687, 704, 703, 712, 713, 720, 721, 741, 748, 749, 755, 761, 765, 775, 774, 781, 794, 782, 801, 800, 806, 820, 824, 790, 828, 832, 836, 840, 813, 844, 848, 857, 864, 856, 870, 876, 877, 888, 889, 895, 899, 907, 911, 915, 407, 396, 3530, 352, 386, 3530, 3530, 3530, 362, 347, 344, 347, 335, 309, 61, 319, 301, 299, 3530, 442, 945, 191, 271, 3530, 927, 937, 943, 947, 951, 955, 959, 963, 967, 332, 0, 326, 0, 973, 974, 982, 983, 989, 995, 1001, 1002, 1008, 1016, 1026, 1012, 1020, 1027, 1034, 1035, 1077, 1057, 1063, 1073, 1047, 1077, 1081, 1085, 1092, 1091, 1098, 1102, 1110, 1111, 1117, 1118, 1124, 1131, 1130, 1137, 1144, 1150, 1156, 1162, 1169, 1175, 1163, 1179, 1191, 1187, 1199, 1198, 1205, 1209, 1217, 1223, 1227, 1235, 1231, 1239, 1251, 1250, 1257, 1263, 1264, 1271, 1272, 1284, 1285, 1278, 1302, 1295, 1303, 1294, 1313, 1317, 1321, 1329, 1333, 1337, 1346, 1325, 1345, 1352, 1353, 1364, 1360, 1368, 1372, 1376, 1380, 1384, 1390, 1391, 1398, 1399, 1411, 1412, 1405, 1425, 1419, 1426, 1435, 1442, 1442, 1450, 1436, 1451, 1458, 1459, 1467, 1468, 1475, 1474, 1482, 1490, 1494, 1498, 1502, 1506, 1513, 1514, 1529, 1530, 1523, 1536, 1537, 1543, 1544, 1550, 1556, 1562, 1563, 1569, 1581, 1575, 1579, 1583, 1592, 1591, 1598, 1605, 1614, 1618, 1625, 1626, 1633, 1640, 290, 3530, 280, 285, 282, 281, 269, 266, 271, 272, 254, 261, 350, 356, 3530, 1641, 1647, 1653, 1659, 1665, 1666, 1672, 1682, 1688, 1681, 1689, 1695, 1716, 1696, 1703, 1709, 291, 1715, 1722, 1734, 1726, 1735, 1741, 115, 279, 1748, 1749, 1755, 1759, 1765, 1766, 1772, 1779, 277, 1780, 1788, 1792, 1796, 1805, 1804, 124, 1811, 1815, 275, 1821, 1825, 1832, 1831, 1874, 1840, 1854, 1860, 1866, 1841, 1847, 1867, 1873, 1874, 1885, 1894, 1895, 1884, 1901, 1902, 1908, 1915, 1916, 1924, 1923, 1934, 1930, 1938, 1942, 1946, 1950, 1954, 1958, 271, 1962, 1969, 1968, 1975, 1976, 1985, 1984, 1991, 1992, 270, 2001, 2005, 2009, 2015, 2019, 2023, 2029, 2035, 2043, 2044, 264, 2051, 2057, 2058, 2064, 2068, 2074, 2075, 2082, 2089, 2093, 2097, 2103, 2110, 2111, 262, 2118, 2128, 2124, 2132, 2136, 2140, 2144, 2148, 2152, 2156, 261, 2160, 2164, 2168, 2174, 2180, 2184, 2191, 245, 2190, 2202, 2198, 2208, 2214, 2215, 2225, 3530, 2231, 2224, 2232, 2238, 2244, 2250, 2254, 2262, 2266, 209, 202, 3530, 195, 192, 3530, 195, 190, 3530, 194, 200, 2258, 2270, 2274, 2283, 2282, 2289, 2290, 2297, 2298, 130, 2306, 2307, 2313, 2314, 2320, 2321, 3530, 2330, 2331, 2337, 222, 3530, 216, 3530, 215, 208, 2341, 2345, 2353, 2357, 2361, 2365, 2371, 206, 173, 2372, 2378, 2379, 2385, 2386, 2394, 193, 3530, 2393, 2400, 2401, 2408, 2417, 2416, 2425, 2426, 2433, 2434, 2446, 2442, 2450, 2454, 2458, 187, 2465, 2472, 2473, 2479, 2480, 2489, 2493, 180, 2497, 2503, 2509, 2510, 2516, 2524, 2523, 2530, 2534, 2540, 2547, 2548, 2556, 2555, 2562, 2563, 2569, 2579, 2570, 2580, 2587, 2597, 2591, 2609, 2601, 2605, 2618, 2617, 3530, 2624, 178, 2630, 2631, 2637, 2638, 2650, 2644, 2651, 2657, 2661, 2665, 2669, 2675, 2679, 3530, 3530, 3530, 146, 113, 108, 3530, 3530, 2683, 2689, 2690, 2698, 2697, 2704, 2705, 104, 2711, 2712, 2718, 2719, 2725, 2731, 2735, 2739, 2746, 2747, 2753, 2763, 3530, 2754, 2770, 2762, 2771, 2779, 2778, 2785, 2789, 2793, 2797, 2806, 2805, 2812, 2813, 2819, 2820, 2830, 2831, 2837, 2838, 2844, 2845, 2853, 2854, 128, 2860, 2868, 2864, 2872, 2881, 2880, 2893, 2887, 2894, 122, 2903, 2902, 2909, 2916, 110, 2917, 2926, 2925, 2932, 2942, 2941, 2948, 2949, 2955, 2961, 2962, 2971, 2970, 82, 67, 3530, 2977, 2984, 2985, 64, 2997, 2993, 3001, 3008, 3012, 3016, 3020, 3026, 3030, 3038, 3039, 3051, 99, 3045, 3052, 3058, 3059, 3065, 3071, 3077, 3081, 3085, 3089, 3093, 3097, 3101, 3109, 3113, 3117, 3121, 3125, 95, 3129, 3133, 3141, 3145, 3149, 3153, 3157, 3530, 3530, 3165, 3169, 3161, 51, 3175, 3176, 3182, 3192, 3183, 3199, 3191, 3200, 3206, 3207, 3213, 3223, 3214, 3230, 3231, 3237, 3224, 3238, 3245, 3254, 3246, 3262, 3253, 3261, 3269, 3270, 3277, 3530, 3276, 3284, 3285, 3291, 3297, 3298, 3304, 3305, 3317, 3313, 3321, 3325, 3329, 3333, 3339, 3340, 3346, 3352, 3353, 3359, 3365, 3366, 3372, 3373, 3381, 3388, 3394, 3380, 3387, 3398, 3402, 3406, 3410, 3414, 3418, 3425, 3426, 3432, 3433, 3439, 3530, 3487, 3491, 3495, 3499, 3502, 3506, 3510, 61, 54, 3513, 3517, 3521, 3525 } ; static yyconst short int yy_def[893] = { 0, 879, 1, 880, 880, 879, 879, 879, 879, 881, 882, 879, 879, 879, 883, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 884, 884, 884, 32, 884, 884, 884, 37, 37, 37, 37, 37, 37, 37, 34, 36, 37, 37, 37, 37, 37, 49, 34, 879, 879, 885, 879, 886, 879, 881, 879, 879, 881, 882, 887, 879, 879, 879, 879, 879, 879, 879, 879, 879, 883, 888, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 889, 879, 50, 890, 50, 50, 50, 50, 50, 50, 50, 891, 892, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 37, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 37, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 37, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 885, 879, 879, 886, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 891, 887, 892, 888, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 884, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 37, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 37, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 889, 879, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 879, 50, 50, 889, 50, 50, 50, 50, 884, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 50, 50, 50, 50, 50, 50, 879, 50, 50, 50, 889, 879, 889, 879, 889, 889, 50, 50, 50, 50, 50, 50, 50, 889, 879, 50, 50, 50, 50, 50, 50, 889, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 879, 879, 879, 879, 879, 879, 879, 50, 50, 50, 50, 50, 50, 50, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 879, 879, 50, 50, 50, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 889, 50, 50, 50, 50, 50, 50, 50, 879, 879, 50, 50, 50, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 879, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 0, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879 } ; static yyconst short int yy_nxt[3586] = { 0, 6, 7, 8, 9, 10, 11, 6, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 23, 23, 24, 25, 26, 27, 28, 29, 30, 6, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 40, 47, 48, 49, 50, 51, 52, 53, 40, 40, 54, 55, 227, 56, 54, 55, 57, 56, 58, 216, 57, 217, 58, 61, 62, 66, 84, 85, 67, 63, 220, 68, 89, 90, 69, 218, 70, 79, 71, 838, 221, 72, 73, 78, 78, 78, 80, 397, 81, 81, 81, 86, 87, 88, 61, 62, 398, 92, 93, 140, 63, 92, 82, 82, 91, 92, 810, 117, 93, 806, 805, 118, 92, 141, 91, 119, 586, 587, 93, 94, 445, 120, 93, 93, 92, 93, 575, 121, 95, 96, 92, 93, 93, 91, 92, 215, 62, 93, 97, 765, 98, 63, 99, 91, 588, 100, 101, 102, 94, 91, 92, 761, 103, 146, 93, 760, 600, 147, 692, 91, 136, 137, 230, 93, 94, 231, 231, 231, 93, 93, 138, 93, 104, 759, 93, 139, 105, 202, 93, 142, 92, 93, 92, 106, 203, 204, 143, 144, 93, 92, 107, 205, 108, 145, 206, 92, 109, 91, 92, 148, 149, 93, 705, 150, 231, 231, 231, 91, 92, 151, 92, 153, 94, 152, 93, 93, 93, 92, 92, 154, 110, 93, 111, 93, 92, 155, 233, 112, 684, 683, 93, 113, 682, 681, 114, 156, 680, 115, 679, 157, 93, 116, 91, 92, 678, 677, 93, 92, 239, 158, 93, 93, 91, 165, 93, 159, 166, 94, 93, 167, 93, 93, 168, 92, 92, 169, 92, 122, 123, 196, 93, 197, 92, 92, 198, 93, 124, 92, 125, 92, 589, 126, 127, 128, 231, 231, 231, 199, 129, 91, 92, 93, 93, 92, 93, 200, 565, 564, 93, 91, 563, 93, 93, 562, 94, 207, 201, 561, 208, 78, 78, 78, 560, 241, 93, 93, 559, 130, 93, 558, 131, 557, 556, 228, 228, 132, 133, 234, 555, 134, 245, 243, 135, 93, 93, 248, 93, 93, 93, 93, 93, 93, 401, 93, 400, 237, 160, 93, 161, 399, 162, 396, 163, 164, 170, 93, 171, 93, 172, 173, 93, 395, 174, 403, 403, 403, 238, 175, 93, 403, 403, 403, 176, 93, 177, 394, 178, 93, 179, 93, 180, 93, 393, 181, 93, 392, 182, 183, 184, 391, 214, 185, 186, 390, 187, 211, 188, 189, 229, 229, 229, 190, 93, 209, 191, 192, 79, 245, 243, 92, 76, 193, 228, 228, 194, 80, 93, 81, 81, 81, 235, 195, 93, 240, 93, 226, 225, 93, 236, 246, 224, 82, 82, 93, 93, 254, 93, 223, 93, 93, 93, 222, 93, 219, 247, 93, 93, 249, 93, 65, 250, 93, 402, 59, 255, 403, 403, 403, 93, 93, 93, 93, 214, 93, 93, 251, 252, 93, 93, 93, 93, 256, 93, 253, 93, 257, 93, 258, 259, 93, 93, 212, 93, 260, 93, 261, 93, 93, 93, 211, 209, 93, 262, 93, 264, 93, 83, 265, 93, 263, 77, 268, 76, 266, 74, 93, 65, 93, 269, 93, 267, 93, 59, 93, 93, 93, 879, 93, 93, 271, 270, 272, 93, 273, 879, 275, 879, 93, 93, 93, 93, 280, 93, 93, 93, 93, 93, 93, 879, 274, 93, 93, 93, 93, 93, 879, 93, 93, 277, 276, 93, 879, 93, 281, 278, 93, 279, 93, 93, 93, 282, 284, 93, 93, 283, 288, 879, 879, 285, 879, 286, 879, 93, 879, 93, 93, 93, 290, 93, 93, 287, 93, 879, 93, 879, 289, 93, 291, 292, 93, 93, 93, 93, 93, 93, 293, 294, 879, 93, 93, 93, 93, 879, 93, 295, 296, 93, 879, 93, 879, 297, 93, 93, 93, 93, 93, 299, 93, 93, 93, 93, 93, 298, 879, 93, 93, 93, 303, 300, 879, 879, 301, 302, 879, 879, 93, 93, 93, 93, 879, 93, 93, 879, 305, 306, 93, 304, 93, 879, 879, 93, 93, 307, 93, 93, 879, 93, 93, 308, 309, 314, 93, 311, 93, 310, 315, 312, 316, 93, 93, 317, 93, 331, 313, 93, 93, 318, 879, 93, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 320, 93, 93, 93, 879, 319, 93, 93, 879, 93, 322, 323, 93, 327, 93, 879, 93, 321, 879, 93, 328, 324, 879, 93, 879, 879, 325, 326, 879, 93, 332, 93, 329, 93, 93, 93, 93, 93, 93, 334, 93, 93, 93, 93, 879, 93, 879, 330, 93, 333, 879, 93, 93, 93, 93, 336, 335, 93, 338, 879, 93, 93, 93, 93, 879, 93, 93, 337, 339, 93, 93, 93, 879, 93, 93, 340, 341, 879, 342, 879, 879, 343, 344, 348, 879, 879, 879, 345, 879, 93, 349, 93, 879, 350, 346, 347, 93, 93, 93, 93, 351, 93, 93, 93, 879, 93, 879, 879, 93, 93, 879, 93, 879, 93, 93, 93, 353, 352, 93, 879, 879, 354, 356, 93, 93, 93, 355, 93, 93, 357, 93, 93, 93, 359, 93, 93, 360, 879, 93, 879, 93, 358, 93, 367, 93, 362, 93, 93, 93, 93, 93, 93, 361, 93, 93, 363, 365, 879, 364, 366, 93, 93, 879, 93, 368, 879, 93, 879, 93, 879, 93, 879, 93, 93, 93, 371, 369, 93, 93, 370, 93, 93, 93, 879, 93, 93, 93, 372, 93, 93, 93, 373, 93, 93, 93, 375, 93, 93, 374, 379, 879, 93, 378, 376, 93, 93, 93, 93, 879, 93, 93, 377, 93, 879, 93, 879, 380, 93, 93, 879, 93, 879, 381, 93, 93, 93, 93, 93, 382, 93, 93, 383, 384, 879, 879, 879, 93, 93, 93, 93, 404, 93, 93, 385, 879, 93, 388, 93, 93, 93, 387, 386, 93, 879, 879, 93, 879, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 389, 93, 229, 229, 229, 879, 879, 879, 93, 405, 93, 879, 879, 93, 879, 879, 228, 228, 93, 407, 93, 879, 879, 93, 93, 406, 93, 879, 93, 93, 93, 408, 93, 93, 93, 879, 93, 93, 93, 409, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 410, 411, 93, 93, 93, 93, 93, 879, 93, 93, 412, 413, 93, 93, 93, 93, 415, 93, 93, 93, 421, 93, 879, 417, 414, 93, 879, 93, 879, 416, 93, 93, 93, 93, 93, 879, 93, 93, 93, 418, 93, 419, 93, 93, 93, 879, 420, 422, 93, 423, 93, 93, 424, 879, 879, 93, 93, 93, 93, 93, 879, 93, 425, 426, 93, 427, 93, 93, 436, 93, 93, 428, 429, 879, 431, 438, 879, 93, 432, 93, 879, 91, 93, 879, 879, 879, 94, 93, 433, 93, 435, 434, 93, 93, 879, 93, 437, 879, 93, 430, 445, 879, 879, 93, 879, 93, 439, 93, 93, 93, 440, 93, 93, 93, 879, 93, 93, 93, 879, 441, 93, 93, 93, 93, 93, 448, 93, 93, 93, 442, 93, 444, 93, 93, 93, 879, 446, 93, 443, 879, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 447, 93, 879, 879, 93, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 450, 93, 449, 93, 879, 93, 879, 879, 93, 93, 879, 93, 452, 451, 93, 93, 879, 93, 454, 453, 93, 93, 456, 93, 93, 455, 93, 93, 93, 879, 93, 879, 457, 93, 93, 879, 93, 458, 93, 93, 93, 460, 879, 93, 459, 461, 93, 462, 93, 879, 93, 93, 93, 879, 879, 93, 879, 93, 93, 93, 93, 463, 93, 93, 93, 464, 93, 879, 93, 93, 93, 879, 879, 93, 879, 465, 93, 466, 93, 879, 879, 93, 93, 467, 93, 468, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 469, 93, 93, 93, 471, 879, 93, 470, 879, 879, 879, 879, 93, 93, 93, 93, 472, 93, 93, 93, 879, 93, 879, 473, 93, 93, 93, 93, 93, 879, 93, 93, 474, 93, 93, 93, 93, 475, 93, 93, 93, 478, 93, 482, 879, 93, 93, 93, 476, 93, 479, 93, 93, 477, 879, 879, 93, 93, 93, 93, 879, 93, 93, 879, 93, 93, 93, 93, 481, 93, 93, 480, 879, 879, 483, 93, 879, 93, 484, 93, 93, 93, 485, 93, 93, 93, 486, 93, 93, 93, 492, 93, 93, 93, 489, 93, 93, 93, 490, 93, 93, 93, 488, 493, 93, 487, 879, 93, 93, 93, 93, 494, 93, 93, 93, 93, 491, 93, 879, 93, 93, 879, 93, 879, 93, 497, 93, 93, 93, 496, 495, 93, 93, 498, 93, 93, 93, 503, 93, 93, 93, 500, 93, 93, 93, 879, 93, 93, 499, 879, 879, 93, 93, 93, 93, 93, 879, 93, 93, 501, 502, 93, 93, 93, 504, 93, 93, 93, 879, 93, 879, 505, 93, 93, 93, 93, 93, 506, 93, 93, 879, 93, 508, 93, 509, 507, 93, 93, 93, 93, 93, 510, 93, 93, 518, 511, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 515, 879, 93, 512, 513, 93, 93, 93, 93, 517, 93, 93, 514, 93, 93, 93, 93, 879, 93, 93, 516, 519, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 520, 93, 521, 93, 522, 879, 93, 879, 523, 93, 524, 93, 529, 93, 93, 93, 879, 93, 93, 93, 879, 525, 93, 93, 879, 93, 93, 93, 879, 879, 93, 526, 93, 93, 527, 528, 879, 93, 93, 530, 532, 879, 93, 531, 533, 537, 879, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 534, 536, 93, 93, 535, 879, 93, 879, 538, 93, 93, 545, 93, 879, 539, 93, 93, 93, 93, 93, 543, 93, 93, 93, 542, 93, 540, 93, 93, 93, 879, 93, 879, 93, 93, 93, 541, 544, 93, 93, 547, 93, 93, 879, 879, 93, 93, 93, 93, 879, 93, 93, 93, 546, 93, 879, 879, 93, 548, 93, 879, 93, 551, 879, 93, 549, 550, 879, 93, 552, 93, 879, 93, 93, 93, 879, 879, 93, 879, 93, 93, 93, 93, 879, 93, 93, 553, 93, 879, 93, 879, 879, 93, 554, 93, 93, 93, 93, 879, 93, 566, 93, 879, 93, 879, 879, 93, 93, 879, 93, 567, 568, 93, 569, 570, 93, 879, 879, 93, 93, 93, 93, 93, 571, 93, 93, 93, 572, 93, 575, 574, 93, 879, 573, 879, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 582, 93, 577, 579, 578, 879, 93, 580, 576, 93, 93, 879, 93, 590, 879, 93, 93, 93, 93, 93, 591, 93, 93, 93, 581, 93, 879, 93, 93, 93, 879, 584, 93, 583, 879, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 879, 93, 585, 93, 93, 93, 93, 593, 93, 93, 93, 879, 93, 592, 93, 93, 93, 879, 879, 93, 93, 93, 93, 93, 599, 93, 93, 93, 594, 93, 879, 879, 93, 595, 93, 596, 93, 93, 879, 93, 93, 597, 598, 93, 879, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 879, 93, 879, 601, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 93, 93, 93, 879, 602, 93, 93, 605, 93, 879, 603, 93, 93, 612, 604, 93, 93, 93, 93, 93, 879, 606, 93, 607, 608, 93, 93, 93, 93, 609, 93, 93, 93, 91, 93, 610, 613, 93, 94, 93, 879, 93, 879, 879, 93, 93, 611, 93, 879, 879, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 615, 93, 93, 614, 616, 879, 617, 93, 93, 93, 93, 618, 93, 93, 879, 879, 879, 93, 93, 93, 93, 624, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 622, 93, 623, 619, 93, 620, 93, 93, 93, 93, 621, 93, 93, 626, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 625, 93, 93, 93, 879, 93, 93, 93, 627, 93, 93, 93, 879, 93, 93, 93, 628, 93, 93, 93, 632, 879, 93, 93, 93, 93, 93, 629, 93, 93, 93, 93, 93, 93, 631, 93, 93, 879, 879, 93, 93, 630, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 879, 633, 879, 93, 879, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 879, 93, 93, 634, 93, 879, 635, 93, 93, 879, 93, 93, 93, 638, 636, 93, 93, 639, 93, 879, 879, 93, 93, 637, 93, 879, 879, 93, 879, 879, 93, 93, 93, 93, 879, 93, 93, 640, 93, 641, 93, 879, 642, 93, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 93, 93, 93, 879, 643, 93, 93, 93, 93, 93, 644, 93, 93, 645, 93, 879, 93, 879, 879, 93, 646, 93, 647, 93, 648, 93, 93, 93, 879, 93, 93, 93, 879, 649, 93, 93, 879, 93, 879, 652, 93, 650, 93, 93, 93, 93, 879, 93, 93, 651, 93, 653, 93, 879, 654, 93, 93, 879, 93, 879, 93, 93, 93, 656, 93, 93, 93, 879, 93, 93, 655, 661, 93, 93, 93, 879, 93, 93, 93, 657, 93, 93, 93, 879, 93, 93, 93, 663, 93, 93, 93, 879, 93, 93, 93, 879, 658, 93, 93, 879, 659, 93, 93, 879, 879, 93, 93, 879, 93, 879, 660, 93, 93, 662, 93, 879, 93, 93, 93, 879, 879, 93, 93, 93, 93, 93, 664, 93, 93, 666, 93, 879, 93, 879, 93, 665, 93, 879, 879, 93, 93, 879, 93, 671, 667, 93, 93, 93, 93, 93, 669, 93, 93, 668, 670, 879, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 673, 93, 93, 93, 672, 93, 879, 879, 93, 93, 879, 93, 879, 879, 93, 93, 674, 93, 675, 93, 93, 93, 676, 93, 93, 93, 879, 93, 685, 93, 879, 93, 93, 93, 879, 93, 93, 93, 687, 686, 93, 93, 879, 879, 93, 879, 879, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 688, 93, 689, 93, 93, 93, 93, 690, 93, 93, 693, 694, 93, 93, 93, 93, 691, 93, 93, 93, 93, 93, 93, 696, 93, 93, 93, 695, 93, 93, 697, 93, 93, 879, 698, 879, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 93, 93, 93, 879, 93, 93, 93, 701, 699, 93, 700, 879, 93, 879, 93, 703, 93, 93, 93, 704, 93, 93, 93, 879, 93, 702, 93, 879, 706, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 707, 93, 93, 93, 708, 93, 93, 879, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 711, 93, 93, 709, 93, 879, 93, 712, 713, 93, 710, 879, 93, 93, 93, 93, 879, 93, 93, 879, 879, 93, 93, 93, 93, 879, 93, 93, 714, 93, 93, 93, 93, 716, 93, 93, 715, 879, 93, 879, 93, 717, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 879, 93, 718, 93, 879, 93, 879, 879, 93, 719, 93, 720, 93, 93, 879, 93, 93, 93, 722, 93, 93, 879, 93, 93, 879, 723, 730, 93, 721, 93, 879, 724, 93, 93, 879, 93, 93, 93, 879, 725, 93, 726, 727, 93, 879, 879, 93, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 728, 879, 93, 729, 93, 93, 93, 93, 731, 93, 93, 93, 879, 93, 732, 93, 93, 93, 734, 735, 93, 93, 733, 93, 740, 879, 93, 879, 93, 93, 93, 93, 736, 93, 93, 738, 93, 93, 93, 93, 741, 93, 93, 93, 93, 93, 93, 737, 93, 93, 739, 93, 93, 93, 745, 93, 93, 879, 879, 879, 93, 93, 93, 93, 879, 93, 93, 742, 743, 744, 93, 879, 93, 93, 93, 879, 879, 93, 93, 747, 93, 746, 93, 93, 93, 879, 93, 93, 93, 748, 93, 93, 93, 749, 879, 93, 879, 879, 93, 93, 93, 93, 879, 93, 93, 93, 751, 93, 879, 750, 93, 93, 93, 93, 93, 753, 93, 752, 93, 93, 93, 93, 754, 93, 93, 93, 755, 93, 879, 757, 93, 93, 93, 93, 93, 879, 93, 93, 756, 879, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 879, 93, 93, 762, 93, 758, 93, 93, 93, 879, 93, 93, 93, 879, 879, 93, 93, 93, 93, 93, 763, 93, 93, 879, 93, 93, 93, 93, 879, 764, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 766, 767, 93, 768, 93, 93, 879, 93, 93, 93, 771, 93, 879, 770, 93, 93, 769, 93, 879, 93, 93, 93, 879, 93, 93, 93, 773, 778, 93, 772, 93, 93, 93, 93, 774, 93, 93, 93, 93, 93, 93, 776, 93, 775, 879, 879, 93, 93, 93, 93, 879, 93, 93, 879, 93, 93, 93, 93, 777, 93, 93, 879, 779, 93, 93, 93, 879, 93, 93, 93, 780, 93, 879, 93, 93, 93, 879, 93, 93, 93, 781, 93, 93, 93, 879, 879, 93, 783, 879, 93, 93, 93, 93, 782, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 784, 93, 93, 785, 879, 879, 879, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 787, 93, 93, 879, 879, 93, 93, 93, 93, 786, 93, 93, 93, 879, 93, 789, 93, 93, 93, 879, 93, 93, 93, 788, 93, 93, 93, 879, 879, 790, 791, 792, 93, 93, 93, 93, 794, 93, 93, 93, 793, 93, 797, 879, 93, 93, 93, 93, 93, 795, 93, 93, 879, 879, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 879, 93, 796, 93, 93, 93, 93, 879, 93, 93, 879, 879, 93, 93, 93, 93, 799, 93, 93, 93, 879, 93, 879, 879, 93, 798, 879, 879, 800, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 801, 93, 93, 93, 93, 93, 879, 93, 93, 802, 803, 93, 93, 93, 93, 879, 804, 93, 93, 879, 93, 809, 879, 93, 807, 93, 93, 93, 93, 811, 93, 93, 879, 879, 93, 879, 93, 808, 93, 93, 93, 879, 93, 93, 93, 879, 879, 93, 812, 93, 813, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 814, 93, 93, 879, 879, 93, 93, 815, 93, 879, 93, 93, 93, 817, 879, 93, 816, 818, 93, 93, 93, 93, 819, 93, 93, 93, 879, 93, 879, 879, 93, 93, 820, 93, 93, 879, 93, 93, 93, 93, 93, 93, 821, 93, 93, 93, 822, 93, 823, 879, 93, 93, 879, 93, 879, 879, 93, 93, 879, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 824, 93, 826, 93, 93, 93, 879, 93, 93, 93, 828, 93, 93, 93, 829, 825, 93, 879, 879, 93, 879, 93, 827, 93, 93, 93, 879, 93, 93, 93, 830, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 832, 93, 93, 93, 833, 831, 93, 879, 879, 93, 879, 93, 879, 93, 93, 93, 879, 93, 93, 93, 834, 93, 93, 93, 835, 93, 93, 93, 836, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 837, 93, 93, 93, 93, 93, 840, 93, 93, 93, 841, 93, 93, 879, 93, 93, 839, 842, 93, 93, 93, 93, 879, 93, 93, 844, 93, 93, 93, 93, 843, 93, 93, 93, 93, 93, 93, 846, 93, 93, 93, 93, 93, 93, 879, 845, 93, 847, 848, 849, 93, 93, 93, 851, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 853, 93, 852, 879, 93, 93, 93, 93, 850, 93, 93, 855, 93, 93, 93, 93, 854, 93, 93, 879, 93, 93, 93, 93, 879, 93, 93, 857, 93, 93, 93, 93, 856, 93, 93, 93, 93, 93, 93, 879, 858, 93, 859, 93, 93, 93, 93, 861, 93, 93, 93, 879, 93, 879, 879, 860, 93, 862, 93, 93, 879, 93, 93, 93, 93, 93, 93, 863, 93, 93, 864, 865, 93, 879, 93, 866, 93, 93, 93, 867, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 869, 868, 93, 93, 93, 93, 870, 93, 93, 93, 879, 93, 879, 879, 93, 93, 93, 93, 93, 871, 93, 93, 93, 879, 93, 879, 872, 93, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 873, 93, 93, 874, 93, 93, 93, 93, 879, 93, 93, 93, 93, 93, 93, 879, 93, 93, 93, 875, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 93, 93, 93, 879, 879, 93, 876, 93, 878, 93, 93, 879, 877, 93, 93, 93, 93, 93, 879, 93, 93, 93, 879, 93, 879, 879, 93, 6, 6, 6, 6, 60, 60, 60, 60, 64, 64, 64, 64, 75, 75, 75, 75, 93, 93, 93, 210, 210, 210, 210, 213, 213, 213, 213, 91, 879, 91, 232, 232, 879, 232, 242, 242, 242, 242, 244, 244, 244, 244, 5, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879 } ; static yyconst short int yy_chk[3586] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 888, 3, 4, 4, 3, 4, 3, 887, 4, 66, 4, 9, 9, 12, 26, 26, 12, 9, 68, 12, 28, 28, 12, 66, 12, 23, 12, 810, 68, 12, 12, 21, 21, 21, 23, 223, 23, 23, 23, 27, 27, 27, 60, 60, 223, 797, 38, 38, 60, 778, 23, 23, 31, 31, 765, 34, 38, 760, 759, 34, 745, 38, 31, 34, 428, 428, 34, 31, 445, 34, 40, 40, 740, 34, 575, 34, 31, 31, 730, 34, 40, 37, 37, 63, 63, 40, 31, 692, 31, 63, 31, 37, 428, 31, 31, 32, 37, 32, 32, 682, 32, 41, 41, 681, 445, 41, 575, 32, 37, 37, 82, 41, 32, 82, 82, 82, 41, 93, 37, 93, 32, 680, 93, 37, 32, 52, 39, 39, 663, 52, 632, 32, 52, 52, 39, 39, 39, 624, 32, 52, 32, 39, 52, 607, 32, 33, 33, 42, 42, 52, 600, 42, 230, 230, 230, 33, 599, 42, 591, 43, 33, 42, 42, 43, 43, 590, 588, 43, 33, 95, 33, 95, 586, 43, 95, 33, 565, 564, 43, 33, 562, 561, 33, 44, 559, 33, 558, 44, 44, 33, 35, 35, 556, 555, 99, 537, 99, 44, 46, 99, 35, 46, 44, 44, 46, 35, 46, 46, 50, 50, 46, 529, 518, 46, 503, 35, 35, 50, 50, 50, 492, 482, 50, 50, 35, 448, 35, 438, 429, 35, 35, 35, 231, 231, 231, 51, 35, 36, 36, 51, 51, 421, 53, 51, 401, 400, 53, 36, 399, 51, 53, 398, 36, 53, 51, 397, 53, 78, 78, 78, 396, 101, 53, 101, 395, 36, 101, 394, 36, 393, 392, 78, 78, 36, 36, 96, 390, 36, 244, 242, 36, 45, 106, 106, 106, 45, 96, 106, 96, 45, 226, 96, 225, 98, 45, 45, 45, 224, 45, 222, 45, 45, 47, 98, 47, 98, 47, 47, 98, 221, 47, 402, 402, 402, 98, 47, 47, 403, 403, 403, 47, 47, 48, 220, 48, 48, 48, 107, 48, 107, 219, 48, 107, 218, 48, 48, 48, 217, 213, 48, 48, 212, 48, 210, 48, 49, 80, 80, 80, 49, 49, 209, 49, 49, 81, 103, 102, 91, 75, 49, 80, 80, 49, 81, 49, 81, 81, 81, 97, 49, 97, 100, 97, 73, 72, 97, 97, 104, 71, 81, 81, 111, 100, 111, 100, 70, 111, 100, 104, 69, 104, 67, 105, 104, 105, 108, 105, 64, 108, 105, 228, 59, 112, 228, 228, 228, 108, 109, 108, 109, 58, 108, 109, 109, 110, 112, 110, 112, 110, 112, 112, 110, 113, 113, 113, 114, 114, 113, 114, 57, 115, 114, 115, 114, 116, 115, 116, 56, 54, 116, 116, 117, 118, 117, 24, 118, 117, 117, 17, 119, 14, 118, 13, 118, 10, 118, 119, 119, 118, 119, 7, 120, 119, 120, 5, 121, 120, 121, 120, 122, 121, 123, 0, 125, 0, 122, 123, 122, 123, 128, 122, 123, 124, 125, 124, 125, 0, 124, 125, 126, 128, 126, 128, 0, 126, 128, 127, 126, 127, 0, 127, 129, 127, 127, 127, 130, 129, 130, 129, 131, 130, 129, 129, 132, 0, 0, 131, 0, 131, 0, 131, 0, 132, 131, 132, 134, 134, 132, 131, 133, 0, 133, 0, 133, 133, 134, 135, 136, 135, 136, 134, 135, 136, 136, 137, 0, 137, 138, 137, 138, 0, 137, 138, 138, 139, 0, 139, 0, 140, 139, 140, 141, 140, 141, 144, 140, 141, 142, 143, 142, 143, 0, 142, 143, 144, 145, 144, 0, 0, 144, 144, 0, 0, 146, 145, 146, 145, 0, 146, 145, 0, 147, 148, 147, 146, 147, 0, 0, 147, 149, 148, 149, 148, 0, 149, 148, 148, 150, 152, 150, 151, 153, 150, 153, 151, 153, 153, 152, 154, 152, 162, 151, 152, 151, 155, 0, 151, 162, 154, 162, 154, 0, 162, 154, 155, 0, 155, 156, 156, 155, 156, 0, 155, 156, 157, 0, 157, 158, 158, 157, 159, 159, 0, 159, 157, 0, 159, 160, 158, 0, 158, 0, 0, 158, 158, 0, 160, 163, 160, 161, 161, 160, 165, 163, 165, 163, 166, 165, 163, 161, 164, 0, 164, 0, 161, 164, 164, 0, 167, 166, 167, 166, 168, 167, 166, 170, 0, 168, 169, 168, 169, 0, 168, 169, 169, 170, 171, 170, 171, 0, 170, 171, 171, 172, 0, 172, 0, 0, 172, 172, 173, 0, 0, 0, 172, 0, 172, 174, 172, 0, 175, 172, 172, 173, 174, 173, 174, 176, 173, 174, 175, 0, 175, 0, 0, 175, 176, 0, 176, 0, 177, 176, 177, 178, 177, 177, 0, 0, 178, 179, 178, 179, 178, 178, 179, 178, 180, 182, 180, 182, 181, 180, 182, 183, 0, 188, 0, 188, 180, 181, 188, 181, 185, 185, 181, 184, 183, 184, 183, 184, 184, 183, 185, 186, 0, 185, 187, 185, 193, 0, 193, 189, 0, 193, 0, 186, 0, 186, 0, 187, 186, 187, 191, 189, 187, 189, 190, 190, 189, 190, 0, 191, 190, 191, 192, 192, 191, 192, 194, 194, 192, 194, 196, 195, 194, 195, 198, 0, 195, 197, 196, 198, 196, 198, 196, 0, 198, 196, 196, 197, 0, 197, 0, 199, 197, 199, 0, 199, 0, 199, 199, 200, 201, 200, 201, 200, 200, 201, 202, 203, 0, 0, 0, 202, 203, 202, 203, 233, 202, 203, 204, 0, 204, 207, 205, 204, 205, 206, 205, 205, 0, 0, 206, 0, 206, 0, 207, 206, 207, 0, 208, 207, 208, 0, 208, 208, 229, 229, 229, 0, 0, 0, 233, 234, 233, 0, 0, 233, 0, 0, 229, 229, 234, 236, 234, 0, 0, 234, 235, 235, 235, 0, 236, 235, 236, 239, 237, 236, 237, 0, 238, 237, 238, 240, 239, 238, 239, 0, 240, 239, 240, 0, 241, 240, 241, 246, 248, 241, 246, 247, 246, 247, 0, 246, 247, 249, 250, 248, 249, 248, 249, 251, 248, 249, 250, 256, 250, 0, 253, 250, 251, 0, 251, 0, 252, 251, 252, 253, 252, 253, 0, 252, 253, 254, 254, 254, 255, 257, 254, 257, 0, 255, 257, 255, 258, 258, 255, 258, 0, 0, 258, 256, 259, 256, 259, 0, 256, 259, 259, 260, 261, 260, 261, 266, 260, 261, 262, 262, 0, 263, 268, 0, 266, 263, 266, 0, 262, 266, 0, 0, 0, 262, 263, 264, 263, 265, 264, 263, 264, 0, 264, 267, 0, 264, 262, 275, 0, 0, 265, 0, 265, 269, 267, 265, 267, 270, 268, 267, 268, 0, 269, 268, 269, 0, 271, 269, 271, 270, 271, 270, 279, 271, 270, 272, 272, 272, 274, 273, 272, 273, 0, 275, 273, 273, 0, 274, 275, 274, 275, 0, 274, 275, 276, 277, 276, 277, 0, 276, 277, 278, 278, 278, 0, 0, 278, 280, 279, 280, 279, 0, 280, 279, 281, 0, 281, 0, 283, 281, 281, 282, 0, 282, 0, 0, 282, 283, 0, 283, 285, 284, 283, 284, 0, 284, 286, 285, 284, 285, 288, 285, 288, 287, 285, 288, 286, 0, 286, 0, 288, 286, 287, 0, 287, 289, 289, 287, 289, 290, 0, 289, 289, 291, 291, 292, 291, 0, 290, 291, 290, 0, 0, 290, 0, 293, 292, 293, 292, 293, 293, 292, 294, 294, 294, 0, 295, 294, 295, 0, 0, 295, 0, 295, 296, 296, 296, 0, 0, 296, 297, 297, 297, 299, 298, 297, 298, 0, 300, 298, 300, 0, 299, 300, 299, 300, 301, 299, 301, 302, 0, 301, 301, 0, 0, 0, 0, 303, 302, 303, 302, 303, 303, 302, 304, 0, 304, 0, 305, 304, 305, 306, 305, 306, 0, 305, 306, 306, 307, 308, 307, 308, 309, 307, 308, 311, 312, 311, 317, 0, 311, 309, 310, 309, 310, 313, 309, 310, 310, 0, 0, 315, 313, 315, 313, 0, 315, 313, 0, 312, 314, 312, 314, 316, 312, 314, 314, 0, 0, 318, 316, 0, 316, 318, 317, 316, 317, 319, 318, 317, 318, 320, 323, 318, 323, 327, 319, 323, 319, 323, 320, 319, 320, 324, 321, 320, 321, 322, 327, 321, 321, 0, 324, 322, 324, 322, 328, 324, 322, 325, 326, 325, 326, 0, 325, 326, 0, 328, 0, 328, 331, 327, 328, 327, 330, 329, 327, 329, 332, 330, 329, 330, 338, 331, 330, 331, 334, 332, 331, 332, 0, 333, 332, 333, 0, 0, 333, 334, 335, 334, 335, 0, 334, 335, 336, 336, 337, 336, 337, 339, 336, 337, 340, 0, 340, 0, 340, 340, 338, 339, 338, 339, 341, 338, 339, 0, 342, 342, 342, 344, 341, 342, 341, 343, 341, 343, 345, 341, 343, 353, 346, 346, 344, 348, 344, 348, 0, 344, 348, 345, 346, 345, 349, 0, 345, 346, 346, 347, 349, 347, 349, 352, 347, 349, 347, 350, 351, 350, 351, 0, 350, 351, 351, 354, 352, 353, 352, 353, 0, 352, 353, 355, 354, 355, 354, 0, 355, 354, 355, 356, 357, 356, 358, 0, 356, 0, 359, 357, 360, 357, 364, 358, 357, 358, 0, 359, 358, 359, 0, 360, 359, 360, 0, 361, 360, 361, 0, 0, 361, 361, 362, 363, 362, 363, 0, 362, 363, 364, 365, 0, 366, 364, 366, 373, 0, 366, 364, 365, 364, 365, 0, 364, 365, 367, 368, 367, 368, 0, 367, 368, 369, 370, 369, 370, 372, 369, 370, 371, 0, 371, 0, 374, 371, 372, 380, 372, 0, 375, 372, 373, 374, 373, 374, 378, 373, 374, 375, 377, 375, 376, 376, 375, 377, 0, 377, 0, 378, 377, 378, 376, 379, 378, 379, 381, 376, 379, 0, 0, 381, 380, 381, 380, 0, 381, 380, 382, 380, 382, 0, 0, 382, 382, 383, 0, 383, 385, 0, 383, 383, 384, 0, 384, 386, 384, 0, 385, 384, 385, 0, 0, 385, 0, 386, 387, 386, 387, 0, 386, 387, 387, 388, 0, 388, 0, 0, 388, 388, 389, 405, 389, 405, 0, 389, 405, 406, 0, 406, 0, 0, 406, 407, 0, 407, 406, 407, 407, 408, 409, 408, 0, 0, 408, 409, 410, 409, 410, 411, 409, 410, 411, 412, 411, 417, 414, 411, 0, 413, 0, 414, 412, 414, 412, 0, 414, 412, 413, 415, 413, 415, 0, 413, 415, 416, 418, 416, 418, 424, 416, 418, 420, 419, 0, 419, 422, 417, 419, 420, 0, 420, 430, 0, 420, 422, 417, 422, 417, 432, 422, 417, 423, 423, 423, 0, 425, 423, 425, 0, 426, 425, 425, 0, 424, 426, 424, 426, 0, 424, 426, 427, 0, 427, 0, 0, 427, 427, 430, 431, 430, 431, 434, 430, 431, 432, 0, 432, 433, 433, 432, 433, 0, 0, 433, 434, 435, 434, 435, 443, 434, 435, 436, 435, 436, 0, 0, 436, 436, 437, 439, 437, 439, 0, 437, 439, 440, 441, 440, 0, 440, 0, 441, 440, 441, 0, 442, 441, 442, 0, 0, 442, 0, 446, 444, 443, 444, 443, 0, 444, 443, 446, 0, 446, 0, 447, 446, 447, 0, 447, 447, 449, 451, 449, 0, 450, 449, 450, 458, 450, 450, 452, 451, 452, 451, 0, 452, 451, 453, 453, 454, 458, 454, 458, 455, 454, 458, 459, 453, 459, 456, 459, 459, 453, 455, 0, 455, 0, 0, 455, 456, 457, 456, 0, 0, 456, 457, 460, 457, 460, 0, 457, 460, 461, 462, 461, 462, 463, 461, 462, 462, 464, 0, 465, 466, 463, 466, 463, 467, 466, 463, 0, 0, 0, 464, 465, 464, 465, 474, 464, 465, 467, 468, 467, 468, 0, 467, 468, 469, 471, 469, 472, 468, 469, 469, 470, 471, 470, 471, 470, 470, 471, 478, 473, 472, 473, 472, 0, 473, 472, 475, 0, 475, 0, 474, 475, 474, 0, 476, 474, 476, 0, 477, 476, 477, 476, 478, 477, 478, 0, 479, 478, 479, 481, 480, 479, 480, 0, 481, 480, 481, 484, 483, 481, 483, 493, 0, 483, 485, 484, 485, 484, 488, 485, 484, 486, 487, 486, 487, 491, 486, 487, 0, 0, 489, 488, 489, 488, 0, 489, 488, 490, 491, 490, 491, 0, 490, 491, 0, 494, 0, 493, 0, 493, 0, 494, 493, 494, 0, 495, 494, 495, 0, 0, 495, 496, 496, 496, 0, 497, 496, 497, 0, 498, 497, 498, 500, 498, 498, 499, 501, 499, 0, 0, 499, 500, 499, 500, 0, 0, 500, 0, 0, 501, 502, 501, 502, 0, 501, 502, 502, 504, 504, 504, 0, 505, 504, 505, 506, 505, 506, 0, 505, 506, 507, 0, 507, 0, 508, 507, 508, 0, 508, 508, 509, 510, 509, 510, 509, 509, 510, 510, 511, 0, 511, 0, 0, 511, 511, 512, 512, 512, 513, 513, 512, 513, 0, 514, 513, 514, 0, 514, 514, 515, 0, 515, 0, 519, 515, 515, 516, 517, 516, 517, 0, 516, 517, 517, 519, 520, 519, 0, 521, 519, 521, 0, 521, 0, 520, 521, 520, 524, 522, 520, 522, 0, 523, 522, 523, 533, 524, 523, 524, 0, 525, 524, 525, 530, 526, 525, 526, 0, 527, 526, 527, 536, 528, 527, 528, 0, 530, 528, 530, 0, 531, 530, 531, 0, 532, 531, 532, 0, 0, 532, 533, 0, 533, 0, 532, 533, 534, 534, 534, 0, 535, 534, 535, 0, 0, 535, 538, 536, 538, 536, 539, 538, 536, 541, 540, 0, 540, 0, 539, 540, 539, 0, 0, 539, 541, 0, 541, 547, 542, 541, 542, 543, 542, 543, 544, 542, 543, 543, 546, 0, 547, 544, 547, 544, 0, 547, 544, 546, 548, 546, 548, 550, 546, 548, 549, 548, 549, 0, 0, 549, 550, 0, 550, 0, 0, 550, 551, 551, 551, 553, 552, 551, 552, 554, 566, 552, 566, 0, 553, 566, 553, 0, 554, 553, 554, 0, 567, 554, 567, 569, 568, 567, 568, 0, 0, 568, 0, 0, 570, 569, 570, 569, 0, 570, 569, 571, 572, 571, 572, 0, 571, 572, 572, 573, 574, 573, 574, 573, 573, 574, 576, 579, 576, 577, 576, 577, 574, 576, 577, 578, 579, 578, 579, 583, 578, 579, 580, 581, 580, 581, 584, 580, 581, 0, 592, 0, 583, 584, 583, 584, 0, 583, 584, 585, 0, 585, 0, 592, 585, 592, 0, 593, 592, 593, 595, 593, 593, 594, 0, 594, 0, 594, 597, 595, 594, 595, 598, 596, 595, 596, 0, 597, 596, 597, 0, 603, 597, 598, 601, 598, 601, 0, 598, 601, 602, 603, 602, 603, 0, 602, 603, 604, 605, 604, 605, 606, 604, 605, 0, 609, 606, 609, 606, 0, 609, 606, 610, 611, 610, 611, 613, 610, 611, 611, 612, 0, 612, 614, 615, 612, 612, 0, 614, 613, 614, 613, 0, 614, 613, 0, 0, 615, 616, 615, 616, 0, 615, 616, 616, 617, 618, 617, 618, 619, 617, 618, 618, 0, 620, 0, 620, 622, 619, 620, 619, 0, 621, 619, 621, 0, 622, 621, 622, 0, 623, 622, 623, 0, 0, 623, 623, 625, 0, 625, 0, 0, 625, 625, 626, 627, 626, 627, 0, 626, 627, 628, 629, 628, 629, 0, 628, 629, 0, 630, 638, 630, 628, 630, 0, 631, 630, 631, 0, 633, 631, 633, 0, 633, 633, 634, 635, 634, 0, 0, 634, 635, 636, 635, 636, 0, 635, 636, 637, 0, 637, 636, 0, 637, 637, 639, 638, 639, 638, 639, 639, 638, 640, 0, 640, 641, 641, 640, 641, 643, 644, 641, 642, 642, 642, 650, 0, 642, 0, 643, 644, 643, 644, 645, 643, 644, 648, 646, 645, 646, 645, 651, 646, 645, 647, 648, 647, 648, 647, 647, 648, 649, 651, 649, 651, 656, 649, 651, 0, 0, 0, 650, 652, 650, 652, 0, 650, 652, 652, 653, 654, 653, 0, 655, 653, 655, 0, 0, 655, 654, 658, 654, 657, 657, 654, 657, 0, 658, 657, 658, 659, 656, 658, 656, 660, 0, 656, 0, 0, 660, 659, 660, 659, 0, 660, 659, 662, 664, 662, 0, 662, 662, 664, 665, 664, 665, 666, 664, 665, 666, 667, 666, 667, 668, 666, 667, 669, 671, 669, 0, 672, 669, 668, 670, 668, 670, 0, 668, 670, 671, 0, 671, 0, 672, 671, 672, 0, 673, 672, 673, 0, 674, 673, 674, 0, 0, 674, 675, 686, 675, 674, 676, 675, 676, 0, 685, 676, 685, 0, 0, 685, 686, 687, 686, 687, 688, 686, 687, 0, 689, 688, 689, 688, 0, 689, 688, 690, 691, 690, 691, 0, 690, 691, 693, 694, 693, 694, 0, 693, 694, 695, 696, 695, 696, 0, 695, 696, 697, 699, 697, 0, 698, 697, 698, 697, 698, 0, 699, 698, 699, 0, 700, 699, 700, 702, 710, 700, 700, 701, 702, 701, 702, 704, 701, 702, 703, 706, 703, 706, 707, 703, 706, 0, 0, 708, 704, 708, 704, 0, 708, 704, 0, 707, 709, 707, 709, 708, 707, 709, 0, 711, 710, 711, 710, 0, 711, 710, 712, 712, 712, 0, 713, 712, 713, 0, 714, 713, 714, 716, 715, 714, 715, 0, 0, 715, 718, 0, 717, 716, 717, 716, 717, 717, 716, 718, 719, 718, 719, 0, 718, 719, 720, 721, 720, 721, 722, 720, 721, 723, 0, 0, 0, 722, 723, 722, 723, 0, 722, 723, 724, 725, 724, 725, 0, 724, 725, 726, 727, 726, 727, 728, 726, 727, 0, 0, 728, 729, 728, 729, 727, 728, 729, 731, 0, 731, 732, 733, 731, 733, 0, 732, 733, 732, 731, 734, 732, 734, 0, 0, 734, 734, 735, 736, 735, 736, 735, 737, 736, 735, 738, 736, 738, 747, 0, 738, 737, 739, 737, 739, 741, 737, 739, 0, 0, 742, 741, 742, 741, 0, 742, 741, 743, 0, 743, 0, 0, 743, 743, 744, 746, 744, 746, 0, 744, 746, 0, 0, 748, 747, 748, 747, 750, 748, 747, 749, 0, 749, 0, 0, 749, 749, 0, 0, 751, 750, 751, 750, 0, 751, 750, 752, 753, 752, 753, 0, 752, 753, 754, 0, 754, 0, 755, 754, 755, 756, 755, 756, 0, 755, 756, 756, 757, 758, 757, 758, 757, 0, 758, 757, 762, 0, 762, 764, 0, 762, 762, 763, 764, 763, 764, 766, 763, 764, 0, 0, 767, 0, 767, 763, 766, 767, 766, 0, 768, 766, 768, 0, 0, 768, 768, 769, 769, 769, 0, 770, 769, 770, 0, 771, 770, 771, 0, 772, 771, 772, 0, 0, 772, 773, 773, 773, 0, 774, 773, 774, 775, 0, 774, 774, 776, 775, 776, 775, 776, 777, 775, 776, 779, 0, 779, 0, 0, 779, 777, 780, 777, 780, 0, 777, 780, 781, 782, 781, 782, 784, 781, 782, 783, 785, 783, 786, 0, 783, 784, 0, 784, 0, 0, 784, 785, 0, 785, 0, 786, 785, 786, 0, 787, 786, 787, 0, 788, 787, 788, 790, 789, 788, 789, 0, 790, 789, 790, 792, 791, 790, 791, 793, 789, 791, 0, 0, 792, 0, 792, 791, 793, 792, 793, 0, 794, 793, 794, 796, 795, 794, 795, 0, 796, 795, 796, 0, 798, 796, 798, 800, 799, 798, 799, 801, 799, 799, 0, 0, 800, 0, 800, 0, 801, 800, 801, 0, 802, 801, 802, 804, 803, 802, 803, 807, 804, 803, 804, 808, 809, 804, 809, 0, 807, 809, 807, 0, 808, 807, 808, 0, 809, 808, 811, 812, 811, 812, 814, 811, 812, 813, 815, 813, 815, 0, 813, 815, 813, 816, 817, 814, 817, 814, 0, 817, 814, 820, 816, 818, 816, 818, 817, 816, 818, 819, 820, 819, 820, 822, 819, 820, 821, 823, 821, 823, 0, 821, 823, 823, 824, 825, 822, 827, 822, 827, 0, 822, 827, 824, 825, 824, 825, 0, 824, 825, 826, 828, 826, 828, 830, 826, 828, 0, 829, 831, 829, 831, 826, 829, 831, 832, 833, 830, 833, 830, 831, 833, 830, 0, 834, 832, 834, 832, 0, 834, 832, 837, 835, 836, 835, 836, 834, 835, 836, 839, 837, 839, 837, 0, 839, 837, 840, 840, 841, 840, 841, 843, 840, 841, 842, 0, 842, 0, 0, 842, 843, 844, 843, 844, 0, 843, 844, 845, 846, 845, 846, 844, 845, 846, 846, 847, 848, 0, 848, 850, 847, 848, 847, 851, 849, 847, 849, 0, 850, 849, 850, 0, 851, 850, 851, 0, 852, 851, 852, 0, 853, 852, 853, 854, 853, 854, 856, 853, 854, 855, 0, 855, 0, 0, 855, 856, 857, 856, 857, 859, 856, 857, 858, 0, 858, 0, 862, 858, 859, 860, 859, 860, 0, 859, 860, 861, 862, 861, 862, 863, 861, 862, 864, 866, 863, 866, 863, 0, 866, 863, 867, 864, 867, 864, 0, 867, 864, 865, 865, 865, 0, 868, 865, 868, 0, 869, 868, 869, 0, 870, 869, 870, 0, 871, 870, 871, 0, 872, 871, 872, 0, 873, 872, 873, 0, 0, 873, 873, 874, 875, 874, 875, 0, 874, 875, 876, 877, 876, 877, 0, 876, 877, 878, 0, 878, 0, 0, 878, 880, 880, 880, 880, 881, 881, 881, 881, 882, 882, 882, 882, 883, 883, 883, 883, 884, 884, 884, 885, 885, 885, 885, 886, 886, 886, 886, 889, 0, 889, 890, 890, 0, 890, 891, 891, 891, 891, 892, 892, 892, 892, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879, 879 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "lex.l" #define INITIAL 0 /* * Parse.l - basic lexical analyzer * * History: * * 01.01.00 - 08/31/1996 - Kevin Handy * Set version to 1.1, and install on internet. * * 01.01.01 - 09/04/1996 - Kevin Handy * Added "BLOCK" keyword. * * 01.01.02 - 10/09/1996 - Kevin Handy * Added BAS_V_PREDEF information. * * 01.01.03 - 10/23/1996 - Kevin Handy * Added HFLOAT symbol. */ #define incl 1 #line 21 "lex.l" #include #include #include #include "basic.h" #include "nodes.h" #include "parse.h" int xline = 1; int include_stack_pointer = 0; Node* CommentList; static const int MAX_INCLUDE_DEPTH = 10; YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; static int include_line[MAX_INCLUDE_DEPTH]; char* include_name[MAX_INCLUDE_DEPTH] = {NULL}; static void StartInclude(char* filename); static inline int SetReturn(int x) { yylval = new Node(x,yytext,include_stack_pointer); return(x); } static inline int SetNullReturn(int x) { yylval = new Node(x,NULL,include_stack_pointer); return(x); } static inline void SetComment(int x) { yylval = new Node(x,yytext,include_stack_pointer); if (CommentList == NULL) { CommentList = yylval; } else { CommentList->DownLink(yylval); } } static inline void CountLine() { xline++; // Temporary debugging line //cerr << xline << endl; } #line 1516 "lexyy.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 75 "lex.l" /* * White-space characters */ #line 1672 "lexyy.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 880 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 3530 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 79 "lex.l" { CountLine(); return('\n'); } YY_BREAK case 2: YY_RULE_SETUP #line 80 "lex.l" CountLine(); YY_BREAK case 3: YY_RULE_SETUP #line 81 "lex.l" ; YY_BREAK case 4: YY_RULE_SETUP #line 82 "lex.l" return SetReturn(BAS_V_TEXTSTRING); YY_BREAK case 5: YY_RULE_SETUP #line 83 "lex.l" return SetReturn(BAS_V_TEXTSTRING); YY_BREAK case 6: YY_RULE_SETUP #line 84 "lex.l" return SetReturn(BAS_V_TEXTSTRING); YY_BREAK case 7: YY_RULE_SETUP #line 85 "lex.l" return SetReturn(BAS_V_TEXTSTRING); YY_BREAK case 8: YY_RULE_SETUP #line 87 "lex.l" { SetComment(BAS_S_REMARK); } YY_BREAK case 9: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp -= 2; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 88 "lex.l" { SetComment(BAS_S_REMARK); } YY_BREAK case 10: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 89 "lex.l" { SetComment(BAS_S_REMARK); } YY_BREAK /* * Single character operations */ case 11: #line 96 "lex.l" case 12: #line 97 "lex.l" case 13: #line 98 "lex.l" case 14: #line 99 "lex.l" case 15: #line 100 "lex.l" case 16: #line 101 "lex.l" case 17: #line 102 "lex.l" case 18: #line 103 "lex.l" case 19: #line 104 "lex.l" case 20: #line 105 "lex.l" case 21: #line 106 "lex.l" case 22: #line 107 "lex.l" case 23: #line 108 "lex.l" case 24: #line 109 "lex.l" case 25: #line 110 "lex.l" case 26: YY_RULE_SETUP #line 110 "lex.l" return SetReturn(yytext[0]); YY_BREAK case 27: YY_RULE_SETUP #line 112 "lex.l" return SetNullReturn('^'); YY_BREAK case 28: YY_RULE_SETUP #line 113 "lex.l" return SetNullReturn(BAS_X_STRREF); YY_BREAK case 29: #line 115 "lex.l" case 30: YY_RULE_SETUP #line 115 "lex.l" return SetNullReturn(BAS_X_NEQ); YY_BREAK case 31: #line 117 "lex.l" case 32: YY_RULE_SETUP #line 117 "lex.l" return SetNullReturn(BAS_X_GE); YY_BREAK case 33: #line 119 "lex.l" case 34: YY_RULE_SETUP #line 119 "lex.l" return SetNullReturn(BAS_X_LE); YY_BREAK /* * Statements (usually) */ case 35: YY_RULE_SETUP #line 124 "lex.l" return SetNullReturn(BAS_S_ACCESS); YY_BREAK case 36: YY_RULE_SETUP #line 125 "lex.l" return SetNullReturn(BAS_S_ALLOW); YY_BREAK case 37: YY_RULE_SETUP #line 126 "lex.l" return SetNullReturn(BAS_S_ALTERNATE); YY_BREAK case 38: YY_RULE_SETUP #line 127 "lex.l" return SetNullReturn(BAS_S_AND); YY_BREAK case 39: YY_RULE_SETUP #line 128 "lex.l" return SetNullReturn(BAS_S_ANY); YY_BREAK case 40: YY_RULE_SETUP #line 129 "lex.l" return SetNullReturn(BAS_S_APPEND); YY_BREAK case 41: YY_RULE_SETUP #line 130 "lex.l" return SetNullReturn(BAS_S_BACK); YY_BREAK case 42: YY_RULE_SETUP #line 131 "lex.l" return SetNullReturn(BAS_S_BLOCK); YY_BREAK case 43: YY_RULE_SETUP #line 132 "lex.l" return SetNullReturn(BAS_S_BLOCKSIZE); YY_BREAK case 44: YY_RULE_SETUP #line 133 "lex.l" return SetNullReturn(BAS_S_BUCKETSIZE); YY_BREAK case 45: YY_RULE_SETUP #line 134 "lex.l" return SetNullReturn(BAS_S_BUFFER); YY_BREAK case 46: YY_RULE_SETUP #line 135 "lex.l" return SetNullReturn(BAS_S_BY); YY_BREAK case 47: YY_RULE_SETUP #line 136 "lex.l" return SetNullReturn(BAS_S_CALL); YY_BREAK case 48: YY_RULE_SETUP #line 137 "lex.l" return SetNullReturn(BAS_N_CASEELSE); YY_BREAK case 49: YY_RULE_SETUP #line 138 "lex.l" return SetNullReturn(BAS_S_CASE); YY_BREAK case 50: YY_RULE_SETUP #line 139 "lex.l" return SetNullReturn(BAS_S_CHAIN); YY_BREAK case 51: YY_RULE_SETUP #line 140 "lex.l" return SetNullReturn(BAS_S_CHANGES); YY_BREAK case 52: YY_RULE_SETUP #line 141 "lex.l" return SetNullReturn(BAS_S_CHANGE); YY_BREAK case 53: YY_RULE_SETUP #line 142 "lex.l" return SetNullReturn(BAS_S_CLOSE); YY_BREAK case 54: #line 144 "lex.l" case 55: YY_RULE_SETUP #line 144 "lex.l" return SetNullReturn(BAS_S_COMMON); YY_BREAK case 56: YY_RULE_SETUP #line 145 "lex.l" return SetNullReturn(BAS_S_CONSTANT); YY_BREAK case 57: YY_RULE_SETUP #line 146 "lex.l" return SetNullReturn(BAS_S_CONTIGUOUS); YY_BREAK case 58: YY_RULE_SETUP #line 147 "lex.l" return SetNullReturn(BAS_S_COUNT); YY_BREAK case 59: YY_RULE_SETUP #line 148 "lex.l" return SetNullReturn(BAS_S_DATA); YY_BREAK case 60: YY_RULE_SETUP #line 149 "lex.l" return SetNullReturn(BAS_S_DECIMAL); YY_BREAK case 61: YY_RULE_SETUP #line 150 "lex.l" return SetNullReturn(BAS_S_DECLARE); YY_BREAK case 62: YY_RULE_SETUP #line 151 "lex.l" return SetNullReturn(BAS_S_DEF); YY_BREAK case 63: YY_RULE_SETUP #line 152 "lex.l" return SetNullReturn(BAS_S_DEFAULTNAME); YY_BREAK case 64: YY_RULE_SETUP #line 153 "lex.l" return SetNullReturn(BAS_S_DELETE); YY_BREAK case 65: YY_RULE_SETUP #line 154 "lex.l" return SetNullReturn(BAS_S_DESC); YY_BREAK case 66: #line 156 "lex.l" case 67: YY_RULE_SETUP #line 156 "lex.l" return SetNullReturn(BAS_S_DIM); YY_BREAK case 68: YY_RULE_SETUP #line 157 "lex.l" return SetNullReturn(BAS_S_DUPLICATES); YY_BREAK case 69: YY_RULE_SETUP #line 158 "lex.l" return SetNullReturn(BAS_S_END); YY_BREAK case 70: YY_RULE_SETUP #line 159 "lex.l" return SetNullReturn(BAS_N_ENDIF); YY_BREAK case 71: YY_RULE_SETUP #line 160 "lex.l" return SetNullReturn(BAS_S_EQ); YY_BREAK case 72: YY_RULE_SETUP #line 161 "lex.l" return SetNullReturn(BAS_S_EQV); YY_BREAK case 73: YY_RULE_SETUP #line 162 "lex.l" { NeedErrorH = 1; return SetReturn(BAS_S_ERL); } YY_BREAK case 74: YY_RULE_SETUP #line 163 "lex.l" { NeedErrorH = 1; return SetReturn(BAS_S_ERR); } YY_BREAK case 75: YY_RULE_SETUP #line 164 "lex.l" return SetNullReturn(BAS_S_ERROR); YY_BREAK case 76: YY_RULE_SETUP #line 165 "lex.l" return SetNullReturn(BAS_S_EXIT); YY_BREAK case 77: YY_RULE_SETUP #line 166 "lex.l" return SetNullReturn(BAS_S_EXTEND); YY_BREAK case 78: YY_RULE_SETUP #line 167 "lex.l" return SetNullReturn(BAS_S_EXTENDSIZE); YY_BREAK case 79: YY_RULE_SETUP #line 168 "lex.l" return SetNullReturn(BAS_S_EXTERNAL); YY_BREAK case 80: YY_RULE_SETUP #line 169 "lex.l" return SetReturn(BAS_S_FIELD); YY_BREAK case 81: YY_RULE_SETUP #line 170 "lex.l" return SetNullReturn(BAS_S_FILESIZE); YY_BREAK case 82: YY_RULE_SETUP #line 171 "lex.l" return SetReturn(BAS_S_FILL); YY_BREAK case 83: YY_RULE_SETUP #line 172 "lex.l" return SetReturn(BAS_S_FILL); YY_BREAK case 84: YY_RULE_SETUP #line 173 "lex.l" return SetReturn(BAS_S_FILL); YY_BREAK case 85: YY_RULE_SETUP #line 174 "lex.l" return SetNullReturn(BAS_S_FIND); YY_BREAK case 86: YY_RULE_SETUP #line 175 "lex.l" return SetReturn(BAS_S_FIXED); YY_BREAK case 87: YY_RULE_SETUP #line 176 "lex.l" return SetNullReturn(BAS_S_FNEND); YY_BREAK case 88: YY_RULE_SETUP #line 177 "lex.l" return SetNullReturn(BAS_S_FNEXIT); YY_BREAK case 89: YY_RULE_SETUP #line 178 "lex.l" return SetNullReturn(BAS_S_FOR); YY_BREAK case 90: YY_RULE_SETUP #line 179 "lex.l" return SetReturn(BAS_S_FORTRAN); YY_BREAK case 91: YY_RULE_SETUP #line 180 "lex.l" return SetNullReturn(BAS_S_FREE); YY_BREAK case 92: YY_RULE_SETUP #line 181 "lex.l" return SetNullReturn(BAS_S_FROM); YY_BREAK case 93: YY_RULE_SETUP #line 182 "lex.l" return SetNullReturn(BAS_S_FUNCTION); YY_BREAK case 94: YY_RULE_SETUP #line 183 "lex.l" return SetNullReturn(BAS_S_FUNCTIONEND); YY_BREAK case 95: YY_RULE_SETUP #line 184 "lex.l" return SetNullReturn(BAS_S_FUNCTIONEXIT); YY_BREAK case 96: YY_RULE_SETUP #line 185 "lex.l" return SetNullReturn(BAS_S_GE); YY_BREAK case 97: YY_RULE_SETUP #line 186 "lex.l" return SetNullReturn(BAS_S_GET); YY_BREAK case 98: YY_RULE_SETUP #line 187 "lex.l" return SetNullReturn(BAS_S_GO); YY_BREAK case 99: YY_RULE_SETUP #line 188 "lex.l" return SetNullReturn(BAS_S_GOSUB); YY_BREAK case 100: YY_RULE_SETUP #line 189 "lex.l" return SetNullReturn(BAS_S_GOTO); YY_BREAK case 101: YY_RULE_SETUP #line 190 "lex.l" return SetNullReturn(BAS_S_GT); YY_BREAK case 102: YY_RULE_SETUP #line 191 "lex.l" return SetNullReturn(BAS_S_IF); YY_BREAK case 103: YY_RULE_SETUP #line 192 "lex.l" return SetNullReturn(BAS_S_IMP); YY_BREAK case 104: YY_RULE_SETUP #line 193 "lex.l" return SetReturn(BAS_S_INDEXED); YY_BREAK case 105: YY_RULE_SETUP #line 194 "lex.l" return SetNullReturn(BAS_S_INPUT); YY_BREAK case 106: YY_RULE_SETUP #line 195 "lex.l" return SetNullReturn(BAS_S_ITERATE); YY_BREAK case 107: YY_RULE_SETUP #line 196 "lex.l" return SetNullReturn(BAS_S_KEY); YY_BREAK case 108: YY_RULE_SETUP #line 197 "lex.l" return SetNullReturn(BAS_S_KILL); YY_BREAK case 109: YY_RULE_SETUP #line 198 "lex.l" return SetNullReturn(BAS_S_LET); YY_BREAK case 110: YY_RULE_SETUP #line 199 "lex.l" return SetNullReturn(BAS_S_LINPUT); YY_BREAK case 111: YY_RULE_SETUP #line 200 "lex.l" return SetReturn(BAS_S_LIST); YY_BREAK case 112: YY_RULE_SETUP #line 201 "lex.l" return SetNullReturn(BAS_S_LSET); YY_BREAK case 113: YY_RULE_SETUP #line 202 "lex.l" return SetNullReturn(BAS_S_MAP); YY_BREAK case 114: YY_RULE_SETUP #line 203 "lex.l" return SetNullReturn(BAS_S_MARGIN); YY_BREAK case 115: YY_RULE_SETUP #line 204 "lex.l" return SetNullReturn(BAS_S_MODE); YY_BREAK case 116: YY_RULE_SETUP #line 205 "lex.l" return SetReturn(BAS_S_MODIFY); YY_BREAK case 117: YY_RULE_SETUP #line 206 "lex.l" return SetNullReturn(BAS_S_MOVE); YY_BREAK case 118: YY_RULE_SETUP #line 207 "lex.l" return SetNullReturn(BAS_S_NAME); YY_BREAK case 119: YY_RULE_SETUP #line 208 "lex.l" return SetNullReturn(BAS_S_NEXT); YY_BREAK case 120: YY_RULE_SETUP #line 209 "lex.l" return SetNullReturn(BAS_S_NOCHANGES); YY_BREAK case 121: YY_RULE_SETUP #line 210 "lex.l" return SetNullReturn(BAS_S_NODUPLICATES); YY_BREAK case 122: YY_RULE_SETUP #line 211 "lex.l" return SetReturn(BAS_S_NONE); YY_BREAK case 123: YY_RULE_SETUP #line 212 "lex.l" return SetReturn(BAS_S_NOSPAN); YY_BREAK case 124: YY_RULE_SETUP #line 213 "lex.l" return SetNullReturn(BAS_S_NOT); YY_BREAK case 125: YY_RULE_SETUP #line 214 "lex.l" return SetReturn(BAS_S_ON); YY_BREAK case 126: YY_RULE_SETUP #line 215 "lex.l" return SetNullReturn(BAS_S_OPEN); YY_BREAK case 127: YY_RULE_SETUP #line 216 "lex.l" return SetNullReturn(BAS_S_OPTION); YY_BREAK case 128: YY_RULE_SETUP #line 217 "lex.l" return SetNullReturn(BAS_S_OR); YY_BREAK case 129: YY_RULE_SETUP #line 218 "lex.l" return SetNullReturn(BAS_S_OTHERWISE); YY_BREAK case 130: YY_RULE_SETUP #line 219 "lex.l" return SetNullReturn(BAS_S_OUTPUT); YY_BREAK case 131: YY_RULE_SETUP #line 220 "lex.l" return SetNullReturn(BAS_S_ORGANIZATION); YY_BREAK case 132: YY_RULE_SETUP #line 221 "lex.l" return SetNullReturn(BAS_S_PRIMARY); YY_BREAK case 133: YY_RULE_SETUP #line 222 "lex.l" return SetNullReturn(BAS_S_PRINT); YY_BREAK case 134: YY_RULE_SETUP #line 223 "lex.l" return SetNullReturn(BAS_S_PUT); YY_BREAK case 135: YY_RULE_SETUP #line 224 "lex.l" { NeedTimeH = 1; NeedBasicFun = 1; return SetNullReturn(BAS_S_RANDOM); } YY_BREAK case 136: YY_RULE_SETUP #line 225 "lex.l" { NeedTimeH = 1; NeedBasicFun = 1; return SetNullReturn(BAS_S_RANDOM); } YY_BREAK case 137: YY_RULE_SETUP #line 226 "lex.l" return SetNullReturn(BAS_S_READ); YY_BREAK case 138: YY_RULE_SETUP #line 227 "lex.l" return SetNullReturn(BAS_S_RECORD); YY_BREAK case 139: YY_RULE_SETUP #line 228 "lex.l" return SetNullReturn(BAS_S_RECORDTYPE); YY_BREAK case 140: YY_RULE_SETUP #line 229 "lex.l" return SetNullReturn(BAS_S_RECORDSIZE); YY_BREAK case 141: YY_RULE_SETUP #line 230 "lex.l" return SetNullReturn(BAS_S_REF); YY_BREAK case 142: YY_RULE_SETUP #line 231 "lex.l" return SetNullReturn(BAS_S_REGARDLESS); YY_BREAK case 143: YY_RULE_SETUP #line 232 "lex.l" return SetReturn(BAS_S_RELATIVE); YY_BREAK case 144: YY_RULE_SETUP #line 233 "lex.l" return SetNullReturn(BAS_S_RESET); YY_BREAK case 145: YY_RULE_SETUP #line 234 "lex.l" return SetNullReturn(BAS_S_RESTORE); YY_BREAK case 146: YY_RULE_SETUP #line 235 "lex.l" return SetNullReturn(BAS_S_RESUME); YY_BREAK case 147: YY_RULE_SETUP #line 236 "lex.l" return SetNullReturn(BAS_S_RETURN); YY_BREAK case 148: YY_RULE_SETUP #line 237 "lex.l" return SetNullReturn(BAS_S_RSET); YY_BREAK case 149: YY_RULE_SETUP #line 238 "lex.l" return SetReturn(BAS_S_SCRATCH); YY_BREAK case 150: YY_RULE_SETUP #line 239 "lex.l" return SetNullReturn(BAS_S_SELECT); YY_BREAK case 151: YY_RULE_SETUP #line 240 "lex.l" return SetReturn(BAS_S_SEQUENTIAL); YY_BREAK case 152: YY_RULE_SETUP #line 241 "lex.l" return SetNullReturn(BAS_S_SIZE); YY_BREAK case 153: YY_RULE_SETUP #line 242 "lex.l" return SetNullReturn(BAS_S_SLEEP); YY_BREAK case 154: YY_RULE_SETUP #line 243 "lex.l" return SetReturn(BAS_S_SPAN); YY_BREAK case 155: YY_RULE_SETUP #line 244 "lex.l" return SetNullReturn(BAS_S_STEP); YY_BREAK case 156: YY_RULE_SETUP #line 245 "lex.l" return SetNullReturn(BAS_S_STOP); YY_BREAK case 157: YY_RULE_SETUP #line 246 "lex.l" return SetReturn(BAS_S_STREAM); YY_BREAK case 158: YY_RULE_SETUP #line 247 "lex.l" return SetNullReturn(BAS_S_SUB); YY_BREAK case 159: YY_RULE_SETUP #line 248 "lex.l" return SetNullReturn(BAS_S_SUBEND); YY_BREAK case 160: YY_RULE_SETUP #line 249 "lex.l" return SetNullReturn(BAS_S_SUBEXIT); YY_BREAK case 161: YY_RULE_SETUP #line 250 "lex.l" return SetReturn(BAS_S_TEMPORARY); YY_BREAK case 162: YY_RULE_SETUP #line 251 "lex.l" return SetNullReturn(BAS_S_TYPE); YY_BREAK case 163: YY_RULE_SETUP #line 252 "lex.l" return SetReturn(BAS_S_UNDEFINED); YY_BREAK case 164: YY_RULE_SETUP #line 253 "lex.l" return SetNullReturn(BAS_S_UNLESS); YY_BREAK case 165: YY_RULE_SETUP #line 254 "lex.l" return SetNullReturn(BAS_S_UNLOCK); YY_BREAK case 166: YY_RULE_SETUP #line 255 "lex.l" return SetNullReturn(BAS_S_UNTIL); YY_BREAK case 167: YY_RULE_SETUP #line 256 "lex.l" return SetNullReturn(BAS_S_UPDATE); YY_BREAK case 168: YY_RULE_SETUP #line 257 "lex.l" return SetNullReturn(BAS_S_VALUE); YY_BREAK case 169: YY_RULE_SETUP #line 258 "lex.l" return SetReturn(BAS_S_VARIABLE); YY_BREAK case 170: YY_RULE_SETUP #line 259 "lex.l" return SetNullReturn(BAS_S_VARIANT); YY_BREAK case 171: YY_RULE_SETUP #line 260 "lex.l" return SetNullReturn(BAS_S_VIRTUAL); YY_BREAK case 172: YY_RULE_SETUP #line 261 "lex.l" return SetNullReturn(BAS_S_WAIT); YY_BREAK case 173: YY_RULE_SETUP #line 262 "lex.l" return SetNullReturn(BAS_S_WHILE); YY_BREAK case 174: YY_RULE_SETUP #line 263 "lex.l" return SetNullReturn(BAS_S_WINDOWSIZE); YY_BREAK case 175: YY_RULE_SETUP #line 264 "lex.l" return SetNullReturn(BAS_S_WRITE); YY_BREAK case 176: YY_RULE_SETUP #line 265 "lex.l" return SetNullReturn(BAS_S_XOR); YY_BREAK case 177: YY_RULE_SETUP #line 268 "lex.l" return SetNullReturn(BAS_S_AS); YY_BREAK case 178: YY_RULE_SETUP #line 269 "lex.l" return SetReturn(BAS_S_BYTE); YY_BREAK case 179: YY_RULE_SETUP #line 270 "lex.l" return SetReturn(BAS_S_DOUBLE); YY_BREAK case 180: YY_RULE_SETUP #line 271 "lex.l" return SetNullReturn(BAS_S_ELSE); YY_BREAK case 181: YY_RULE_SETUP #line 272 "lex.l" return SetNullReturn(BAS_S_FILE); YY_BREAK case 182: YY_RULE_SETUP #line 273 "lex.l" return SetReturn(BAS_S_GFLOAT); YY_BREAK case 183: YY_RULE_SETUP #line 274 "lex.l" return SetReturn(BAS_S_HFLOAT); YY_BREAK case 184: YY_RULE_SETUP #line 275 "lex.l" return SetReturn(BAS_S_INTEGER); YY_BREAK case 185: YY_RULE_SETUP #line 276 "lex.l" return SetReturn(BAS_S_LINE); YY_BREAK case 186: YY_RULE_SETUP #line 277 "lex.l" return SetReturn(BAS_S_LONG); YY_BREAK case 187: YY_RULE_SETUP #line 278 "lex.l" return SetReturn(BAS_S_REAL); YY_BREAK case 188: YY_RULE_SETUP #line 279 "lex.l" { NeedRFA = 1; return SetReturn(BAS_S_RFA); } YY_BREAK case 189: YY_RULE_SETUP #line 280 "lex.l" return SetReturn(BAS_S_SINGLE); YY_BREAK case 190: YY_RULE_SETUP #line 281 "lex.l" return SetReturn(BAS_S_STRING); YY_BREAK case 191: YY_RULE_SETUP #line 282 "lex.l" return SetNullReturn(BAS_S_THEN); YY_BREAK case 192: YY_RULE_SETUP #line 283 "lex.l" return SetNullReturn(BAS_S_TO); YY_BREAK case 193: YY_RULE_SETUP #line 284 "lex.l" return SetNullReturn(BAS_S_USING); YY_BREAK case 194: YY_RULE_SETUP #line 285 "lex.l" return SetReturn(BAS_S_WORD); YY_BREAK /* * Functions (usually) */ case 195: YY_RULE_SETUP #line 291 "lex.l" { NeedStdlibH = 1; NeedBasicFun = 1; return SetReturn(BAS_V_NAME); } YY_BREAK case 196: YY_RULE_SETUP #line 292 "lex.l" { NeedStringH = 1; NeedBasicFun = 1; return SetReturn(BAS_V_FUNCTION); } YY_BREAK case 197: #line 295 "lex.l" case 198: #line 296 "lex.l" case 199: #line 297 "lex.l" case 200: #line 298 "lex.l" case 201: #line 299 "lex.l" case 202: #line 300 "lex.l" case 203: #line 301 "lex.l" case 204: #line 302 "lex.l" case 205: #line 303 "lex.l" case 206: #line 304 "lex.l" case 207: #line 305 "lex.l" case 208: #line 306 "lex.l" case 209: #line 307 "lex.l" case 210: #line 308 "lex.l" case 211: YY_RULE_SETUP #line 308 "lex.l" { NeedMathH = 1; return SetReturn(BAS_V_FUNCTION); } YY_BREAK case 212: #line 311 "lex.l" case 213: #line 312 "lex.l" case 214: #line 313 "lex.l" case 215: #line 314 "lex.l" case 216: #line 315 "lex.l" case 217: #line 316 "lex.l" case 218: #line 317 "lex.l" case 219: #line 318 "lex.l" case 220: #line 319 "lex.l" case 221: #line 320 "lex.l" case 222: #line 321 "lex.l" case 223: #line 322 "lex.l" case 224: #line 323 "lex.l" case 225: #line 324 "lex.l" case 226: #line 325 "lex.l" case 227: #line 326 "lex.l" case 228: #line 327 "lex.l" case 229: #line 328 "lex.l" case 230: #line 329 "lex.l" case 231: #line 330 "lex.l" case 232: #line 331 "lex.l" case 233: #line 332 "lex.l" case 234: #line 333 "lex.l" case 235: #line 334 "lex.l" case 236: #line 335 "lex.l" case 237: #line 336 "lex.l" case 238: #line 337 "lex.l" case 239: #line 338 "lex.l" case 240: #line 339 "lex.l" case 241: #line 340 "lex.l" case 242: #line 341 "lex.l" case 243: #line 342 "lex.l" case 244: #line 343 "lex.l" case 245: #line 344 "lex.l" case 246: #line 345 "lex.l" case 247: YY_RULE_SETUP #line 345 "lex.l" return SetReturn(BAS_V_FUNCTION); YY_BREAK case 248: #line 348 "lex.l" case 249: #line 349 "lex.l" case 250: #line 350 "lex.l" case 251: #line 351 "lex.l" case 252: #line 352 "lex.l" case 253: #line 353 "lex.l" case 254: #line 354 "lex.l" case 255: #line 355 "lex.l" case 256: #line 356 "lex.l" case 257: YY_RULE_SETUP #line 356 "lex.l" { NeedStringH = 1; return SetReturn(BAS_V_FUNCTION); } YY_BREAK case 258: #line 359 "lex.l" case 259: #line 360 "lex.l" case 260: #line 361 "lex.l" case 261: #line 362 "lex.l" case 262: #line 363 "lex.l" case 263: #line 364 "lex.l" case 264: #line 365 "lex.l" case 265: #line 366 "lex.l" case 266: #line 367 "lex.l" case 267: #line 368 "lex.l" case 268: #line 369 "lex.l" case 269: #line 370 "lex.l" case 270: YY_RULE_SETUP #line 370 "lex.l" return SetReturn(BAS_V_PREDEF); YY_BREAK /* * Percent Sign Commands */ case 271: YY_RULE_SETUP #line 376 "lex.l" { BEGIN(incl); return SetReturn(BAS_P_INCLUDE); } YY_BREAK case 272: YY_RULE_SETUP #line 377 "lex.l" return SetReturn(BAS_P_FROM); YY_BREAK case 273: YY_RULE_SETUP #line 378 "lex.l" return SetReturn(BAS_P_CDD); YY_BREAK case 274: YY_RULE_SETUP #line 379 "lex.l" ; YY_BREAK case 275: YY_RULE_SETUP #line 380 "lex.l" return SetReturn(BAS_P_TITLE); YY_BREAK case 276: YY_RULE_SETUP #line 381 "lex.l" return SetReturn(BAS_P_SBTTL); YY_BREAK case 277: YY_RULE_SETUP #line 382 "lex.l" return SetReturn(BAS_P_IDENT); YY_BREAK case 278: #line 385 "lex.l" case 279: #line 386 "lex.l" case 280: #line 387 "lex.l" case 281: YY_RULE_SETUP #line 387 "lex.l" SetComment(BAS_S_REMARK); YY_BREAK /* * These lines are used to trap an include file name */ case 282: YY_RULE_SETUP #line 392 "lex.l" ; YY_BREAK case 283: YY_RULE_SETUP #line 393 "lex.l" { CountLine(); return('\n'); } YY_BREAK case 284: YY_RULE_SETUP #line 394 "lex.l" { BEGIN(INITIAL); return SetReturn(BAS_P_FROM); } YY_BREAK case 285: YY_RULE_SETUP #line 395 "lex.l" { yylval = new Node(BAS_V_TEXTSTRING, yytext,include_stack_pointer); StartInclude(yytext); BEGIN(INITIAL); return(BAS_V_TEXTSTRING); } YY_BREAK case 286: YY_RULE_SETUP #line 399 "lex.l" { yylval = new Node(BAS_V_TEXTSTRING, yytext,include_stack_pointer); StartInclude(yytext); BEGIN(INITIAL); return(BAS_V_TEXTSTRING); } YY_BREAK /* * Numbers, variables, etc. */ case 287: YY_RULE_SETUP #line 407 "lex.l" return SetReturn(BAS_V_FLOAT); YY_BREAK case 288: YY_RULE_SETUP #line 408 "lex.l" return SetReturn(BAS_V_FLOAT); YY_BREAK case 289: YY_RULE_SETUP #line 409 "lex.l" return SetReturn(BAS_V_INTEGER); YY_BREAK case 290: YY_RULE_SETUP #line 410 "lex.l" return SetReturn(BAS_V_INT); YY_BREAK case 291: YY_RULE_SETUP #line 411 "lex.l" return SetReturn(BAS_V_NAME); YY_BREAK case 292: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP #line 412 "lex.l" return SetReturn(BAS_V_LABEL); YY_BREAK /* * End of file (try to back up one include level) */ case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(incl): #line 417 "lex.l" { if (--include_stack_pointer < 0) { include_stack_pointer = 0; yyterminate(); } else { yy_switch_to_buffer( include_stack[include_stack_pointer]); xline = include_line[include_stack_pointer]; if (PositionDump){cerr << "Leaving Include " << include_name[include_stack_pointer] << endl; } delete include_name[include_stack_pointer]; } } YY_BREAK case 293: YY_RULE_SETUP #line 428 "lex.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 2992 "lexyy.c" case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 880 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 880 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 879); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { if ( yywrap() ) { yy_c_buf_p = yytext_ptr + offset; return EOF; } if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; case EOB_ACT_LAST_MATCH: #ifdef __cplusplus YY_FATAL_ERROR( "unexpected last match in yyinput()" ); #else YY_FATAL_ERROR( "unexpected last match in input()" ); #endif } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *str ) #else YY_BUFFER_STATE yy_scan_string( str ) yyconst char *str; #endif { int len; for ( len = 0; str[len]; ++len ) ; return yy_scan_bytes( str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 428 "lex.l" static void StartInclude(char* FileName) { char UseName[64]; // File name to actually use FILE* NewChannel; // File Open Info // // Strip off quotes (We KNOW that we have them) // assert(FileName[0] != 0); assert(FileName[1] != 0); strcpy(UseName, FileName + 1); UseName[strlen(UseName) - 1] = '\0'; // // Can we handle the include? // if (include_stack_pointer >= MAX_INCLUDE_DEPTH) { cerr << "Includes Nested Too Deep (" << UseName << ")" << endl; return; } // // Try to open up the file // NewChannel = fopen(UseName, "r"); if (NewChannel == 0) { // // Try to lose any logicals on front of file name // char* cindex = strchr(UseName, ':'); if (cindex != 0) { NewChannel = fopen(cindex + 1, "r"); if (NewChannel == 0) { cerr << "Unable to open (" << UseName << ")" << endl; return; } } else { cerr << "Unable to open (" << UseName << ")" << endl; return; } } // // Switch over to new buffer // include_stack[include_stack_pointer] = YY_CURRENT_BUFFER; include_line[include_stack_pointer] = xline; include_name[include_stack_pointer] = new char[strlen(UseName)+1]; strcpy(include_name[include_stack_pointer], UseName); xline = 1; include_stack_pointer++; yy_switch_to_buffer(yy_create_buffer(NewChannel, YY_BUF_SIZE)); if (PositionDump) { cerr << "Including (" << UseName << ")" << endl;}; } lex.l100644 765 144 32124 6242161006 10563 0ustar kevinusers/* * Parse.l - basic lexical analyzer * * History: * * 01.01.00 - 08/31/1996 - Kevin Handy * Set version to 1.1, and install on internet. * * 01.01.01 - 09/04/1996 - Kevin Handy * Added "BLOCK" keyword. * * 01.01.02 - 10/09/1996 - Kevin Handy * Added BAS_V_PREDEF information. * * 01.01.03 - 10/23/1996 - Kevin Handy * Added HFLOAT symbol. */ %x incl %{ #include #include #include #include "basic.h" #include "nodes.h" #include "parse.h" int xline = 1; int include_stack_pointer = 0; Node* CommentList; static const int MAX_INCLUDE_DEPTH = 10; YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; static int include_line[MAX_INCLUDE_DEPTH]; char* include_name[MAX_INCLUDE_DEPTH] = {NULL}; static void StartInclude(char* filename); static inline int SetReturn(int x) { yylval = new Node(x,yytext,include_stack_pointer); return(x); } static inline int SetNullReturn(int x) { yylval = new Node(x,NULL,include_stack_pointer); return(x); } static inline void SetComment(int x) { yylval = new Node(x,yytext,include_stack_pointer); if (CommentList == NULL) { CommentList = yylval; } else { CommentList->DownLink(yylval); } } static inline void CountLine() { xline++; // Temporary debugging line //cerr << xline << endl; } %} %% /* * White-space characters */ [\n\f] { CountLine(); return('\n'); } "&"[\n\f] CountLine(); [ \t]+ ; "\""([^\"]*)"\"" return SetReturn(BAS_V_TEXTSTRING); "'"([^']*)"'" return SetReturn(BAS_V_TEXTSTRING); [DBOX]?"\""([^\"]*)"\""[BCWLFDGHP] return SetReturn(BAS_V_TEXTSTRING); [DBOX]?"'"([^']*)"'"[BCWLFDGHP] return SetReturn(BAS_V_TEXTSTRING); "!"[^\n\f\!]*"!" { SetComment(BAS_S_REMARK); } "!"[^\n\f\!]*/"&"[\n\f] { SetComment(BAS_S_REMARK); } "!"[^\n\f\!]*/[\n\f] { SetComment(BAS_S_REMARK); } /* * Single character operations */ "(" | ")" | "*" | "/" | "\\" | "+" | "-" | ":" | ";" | "," | "#" | "^" | "=" | "==" | "<" | ">" return SetReturn(yytext[0]); "**" return SetNullReturn('^'); "::" return SetNullReturn(BAS_X_STRREF); "><" | "<>" return SetNullReturn(BAS_X_NEQ); ">=" | "=>" return SetNullReturn(BAS_X_GE); "<=" | "=<" return SetNullReturn(BAS_X_LE); /* * Statements (usually) */ "ACCESS" return SetNullReturn(BAS_S_ACCESS); "ALLOW" return SetNullReturn(BAS_S_ALLOW); "ALTERNATE" return SetNullReturn(BAS_S_ALTERNATE); "AND" return SetNullReturn(BAS_S_AND); "ANY" return SetNullReturn(BAS_S_ANY); "APPEND" return SetNullReturn(BAS_S_APPEND); "BACK" return SetNullReturn(BAS_S_BACK); "BLOCK" return SetNullReturn(BAS_S_BLOCK); "BLOCKSIZE" return SetNullReturn(BAS_S_BLOCKSIZE); "BUCKETSIZE" return SetNullReturn(BAS_S_BUCKETSIZE); "BUFFER" return SetNullReturn(BAS_S_BUFFER); "BY" return SetNullReturn(BAS_S_BY); "CALL" return SetNullReturn(BAS_S_CALL); "CASE"[ \t]*"ELSE" return SetNullReturn(BAS_N_CASEELSE); "CASE" return SetNullReturn(BAS_S_CASE); "CHAIN" return SetNullReturn(BAS_S_CHAIN); "CHANGES" return SetNullReturn(BAS_S_CHANGES); "CHANGE" return SetNullReturn(BAS_S_CHANGE); "CLOSE" return SetNullReturn(BAS_S_CLOSE); "COM" | "COMMON" return SetNullReturn(BAS_S_COMMON); "CONSTANT" return SetNullReturn(BAS_S_CONSTANT); "CONTIGUOUS" return SetNullReturn(BAS_S_CONTIGUOUS); "COUNT" return SetNullReturn(BAS_S_COUNT); "DATA" return SetNullReturn(BAS_S_DATA); "DECIMAL" return SetNullReturn(BAS_S_DECIMAL); "DECLARE" return SetNullReturn(BAS_S_DECLARE); "DEF" return SetNullReturn(BAS_S_DEF); "DEFAULTNAME" return SetNullReturn(BAS_S_DEFAULTNAME); "DELETE" return SetNullReturn(BAS_S_DELETE); "DESC" return SetNullReturn(BAS_S_DESC); "DIM" | "DIMENSION" return SetNullReturn(BAS_S_DIM); "DUPLICATES" return SetNullReturn(BAS_S_DUPLICATES); "END" return SetNullReturn(BAS_S_END); "END"[ \t]*"IF" return SetNullReturn(BAS_N_ENDIF); "EQ" return SetNullReturn(BAS_S_EQ); "EQV" return SetNullReturn(BAS_S_EQV); "ERL" { NeedErrorH = 1; return SetReturn(BAS_S_ERL); } "ERR" { NeedErrorH = 1; return SetReturn(BAS_S_ERR); } "ERROR" return SetNullReturn(BAS_S_ERROR); "EXIT" return SetNullReturn(BAS_S_EXIT); "EXTEND" return SetNullReturn(BAS_S_EXTEND); "EXTENDSIZE" return SetNullReturn(BAS_S_EXTENDSIZE); "EXTERNAL" return SetNullReturn(BAS_S_EXTERNAL); "FIELD" return SetReturn(BAS_S_FIELD); "FILESIZE" return SetNullReturn(BAS_S_FILESIZE); "FILL" return SetReturn(BAS_S_FILL); "FILL%" return SetReturn(BAS_S_FILL); "FILL$" return SetReturn(BAS_S_FILL); "FIND" return SetNullReturn(BAS_S_FIND); "FIXED" return SetReturn(BAS_S_FIXED); "FNEND" return SetNullReturn(BAS_S_FNEND); "FNEXIT" return SetNullReturn(BAS_S_FNEXIT); "FOR" return SetNullReturn(BAS_S_FOR); "FORTRAN" return SetReturn(BAS_S_FORTRAN); "FREE" return SetNullReturn(BAS_S_FREE); "FROM" return SetNullReturn(BAS_S_FROM); "FUNCTION" return SetNullReturn(BAS_S_FUNCTION); "FUNCTIONEND" return SetNullReturn(BAS_S_FUNCTIONEND); "FUNCTIONEXIT" return SetNullReturn(BAS_S_FUNCTIONEXIT); "GE" return SetNullReturn(BAS_S_GE); "GET" return SetNullReturn(BAS_S_GET); "GO" return SetNullReturn(BAS_S_GO); "GOSUB" return SetNullReturn(BAS_S_GOSUB); "GOTO" return SetNullReturn(BAS_S_GOTO); "GT" return SetNullReturn(BAS_S_GT); "IF" return SetNullReturn(BAS_S_IF); "IMP" return SetNullReturn(BAS_S_IMP); "INDEXED" return SetReturn(BAS_S_INDEXED); "INPUT" return SetNullReturn(BAS_S_INPUT); "ITERATE" return SetNullReturn(BAS_S_ITERATE); "KEY" return SetNullReturn(BAS_S_KEY); "KILL" return SetNullReturn(BAS_S_KILL); "LET" return SetNullReturn(BAS_S_LET); "LINPUT" return SetNullReturn(BAS_S_LINPUT); "LIST" return SetReturn(BAS_S_LIST); "LSET" return SetNullReturn(BAS_S_LSET); "MAP" return SetNullReturn(BAS_S_MAP); "MARGIN" return SetNullReturn(BAS_S_MARGIN); "MODE" return SetNullReturn(BAS_S_MODE); "MODIFY" return SetReturn(BAS_S_MODIFY); "MOVE" return SetNullReturn(BAS_S_MOVE); "NAME" return SetNullReturn(BAS_S_NAME); "NEXT" return SetNullReturn(BAS_S_NEXT); "NOCHANGES" return SetNullReturn(BAS_S_NOCHANGES); "NODUPLICATES" return SetNullReturn(BAS_S_NODUPLICATES); "NONE" return SetReturn(BAS_S_NONE); "NOSPAN" return SetReturn(BAS_S_NOSPAN); "NOT" return SetNullReturn(BAS_S_NOT); "ON" return SetReturn(BAS_S_ON); "OPEN" return SetNullReturn(BAS_S_OPEN); "OPTION" return SetNullReturn(BAS_S_OPTION); "OR" return SetNullReturn(BAS_S_OR); "OTHERWISE" return SetNullReturn(BAS_S_OTHERWISE); "OUTPUT" return SetNullReturn(BAS_S_OUTPUT); "ORGANIZATION" return SetNullReturn(BAS_S_ORGANIZATION); "PRIMARY" return SetNullReturn(BAS_S_PRIMARY); "PRINT" return SetNullReturn(BAS_S_PRINT); "PUT" return SetNullReturn(BAS_S_PUT); "RANDOM" { NeedTimeH = 1; NeedBasicFun = 1; return SetNullReturn(BAS_S_RANDOM); } "RANDOMIZE" { NeedTimeH = 1; NeedBasicFun = 1; return SetNullReturn(BAS_S_RANDOM); } "READ" return SetNullReturn(BAS_S_READ); "RECORD" return SetNullReturn(BAS_S_RECORD); "RECORDTYPE" return SetNullReturn(BAS_S_RECORDTYPE); "RECORDSIZE" return SetNullReturn(BAS_S_RECORDSIZE); "REF" return SetNullReturn(BAS_S_REF); "REGARDLESS" return SetNullReturn(BAS_S_REGARDLESS); "RELATIVE" return SetReturn(BAS_S_RELATIVE); "RESET" return SetNullReturn(BAS_S_RESET); "RESTORE" return SetNullReturn(BAS_S_RESTORE); "RESUME" return SetNullReturn(BAS_S_RESUME); "RETURN" return SetNullReturn(BAS_S_RETURN); "RSET" return SetNullReturn(BAS_S_RSET); "SCRATCH" return SetReturn(BAS_S_SCRATCH); "SELECT" return SetNullReturn(BAS_S_SELECT); "SEQUENTIAL" return SetReturn(BAS_S_SEQUENTIAL); "SIZE" return SetNullReturn(BAS_S_SIZE); "SLEEP" return SetNullReturn(BAS_S_SLEEP); "SPAN" return SetReturn(BAS_S_SPAN); "STEP" return SetNullReturn(BAS_S_STEP); "STOP" return SetNullReturn(BAS_S_STOP); "STREAM" return SetReturn(BAS_S_STREAM); "SUB" return SetNullReturn(BAS_S_SUB); "SUBEND" return SetNullReturn(BAS_S_SUBEND); "SUBEXIT" return SetNullReturn(BAS_S_SUBEXIT); "TEMPORARY" return SetReturn(BAS_S_TEMPORARY); "TYPE" return SetNullReturn(BAS_S_TYPE); "UNDEFINED" return SetReturn(BAS_S_UNDEFINED); "UNLESS" return SetNullReturn(BAS_S_UNLESS); "UNLOCK" return SetNullReturn(BAS_S_UNLOCK); "UNTIL" return SetNullReturn(BAS_S_UNTIL); "UPDATE" return SetNullReturn(BAS_S_UPDATE); "VALUE" return SetNullReturn(BAS_S_VALUE); "VARIABLE" return SetReturn(BAS_S_VARIABLE); "VARIANT" return SetNullReturn(BAS_S_VARIANT); "VIRTUAL" return SetNullReturn(BAS_S_VIRTUAL); "WAIT" return SetNullReturn(BAS_S_WAIT); "WHILE" return SetNullReturn(BAS_S_WHILE); "WINDOWSIZE" return SetNullReturn(BAS_S_WINDOWSIZE); "WRITE" return SetNullReturn(BAS_S_WRITE); "XOR" return SetNullReturn(BAS_S_XOR); "AS" return SetNullReturn(BAS_S_AS); "BYTE" return SetReturn(BAS_S_BYTE); "DOUBLE" return SetReturn(BAS_S_DOUBLE); "ELSE" return SetNullReturn(BAS_S_ELSE); "FILE" return SetNullReturn(BAS_S_FILE); "GFLOAT" return SetReturn(BAS_S_GFLOAT); "HFLOAT" return SetReturn(BAS_S_HFLOAT); "INTEGER" return SetReturn(BAS_S_INTEGER); "LINE" return SetReturn(BAS_S_LINE); "LONG" return SetReturn(BAS_S_LONG); "REAL" return SetReturn(BAS_S_REAL); "RFA" { NeedRFA = 1; return SetReturn(BAS_S_RFA); } "SINGLE" return SetReturn(BAS_S_SINGLE); "STRING" return SetReturn(BAS_S_STRING); "THEN" return SetNullReturn(BAS_S_THEN); "TO" return SetNullReturn(BAS_S_TO); "USING" return SetNullReturn(BAS_S_USING); "WORD" return SetReturn(BAS_S_WORD); /* * Functions (usually) */ "RND" { NeedStdlibH = 1; NeedBasicFun = 1; return SetReturn(BAS_V_NAME); } "INSTR" { NeedStringH = 1; NeedBasicFun = 1; return SetReturn(BAS_V_FUNCTION); } "ABS" | "ABS%" | "ATN" | "COS" | "EXP" | "FIX" | "INT" | "LOG10" | "LOG" | "SIN" | "SQRT" | "SQR" | "TAN" | "VAL%" | "VAL" { NeedMathH = 1; return SetReturn(BAS_V_FUNCTION); } "ASC" | "ASCII" | "BUFSIZ" | "CCPOS" | "CHR$" | "COMP%" | "CVT$$" | "CVT$%" | "CVT%$" | "CVT$F" | "CVTF$" | "DATE$" | "DIF$" | "ECHO" | "EDIT$" | "ERT$" | "FORMAT$" | "GETRFA" | "MAR" | "NUM$" | "NUM1$" | "ONECHR" | "PLACE$" | "RAD$" | "RCTRLO" | "SGN" | "SPACE$" | "STR$" | "STRING$" | "SWAP%" | "SYS" | "TAB" | "TIME$" | "TIME" | "TRM$" | "XLATE" return SetReturn(BAS_V_FUNCTION); "LEFT$" | "LEFT" | "LEN" | "LOC" | "MID$" | "MID" | "POS" | "RIGHT$" | "RIGHT" | "SEG$" { NeedStringH = 1; return SetReturn(BAS_V_FUNCTION); } "BEL" | "BS" | "HT" | "LF" | "VT" | "FF" | "CR" | "SO" | "SI" | "ESC" | "SP" | "DEL" | "PI" return SetReturn(BAS_V_PREDEF); /* * Percent Sign Commands */ "%INCLUDE" { BEGIN(incl); return SetReturn(BAS_P_INCLUDE); } "%FROM" return SetReturn(BAS_P_FROM); "%CDD" return SetReturn(BAS_P_CDD); "%PAGE" ; "%TITLE" return SetReturn(BAS_P_TITLE); "%SBTTL" return SetReturn(BAS_P_SBTTL); "%IDENT" return SetReturn(BAS_P_IDENT); "%CROSS" | "%NOCROSS" | "%LIST" | "%NOLIST" SetComment(BAS_S_REMARK); /* * These lines are used to trap an include file name */ [ \t]+ ; [\n\f] { CountLine(); return('\n'); } "%FROM" { BEGIN(INITIAL); return SetReturn(BAS_P_FROM); } "\""([^\"]*)"\"" { yylval = new Node(BAS_V_TEXTSTRING, yytext,include_stack_pointer); StartInclude(yytext); BEGIN(INITIAL); return(BAS_V_TEXTSTRING); } "'"([^']*)"'" { yylval = new Node(BAS_V_TEXTSTRING, yytext,include_stack_pointer); StartInclude(yytext); BEGIN(INITIAL); return(BAS_V_TEXTSTRING); } /* * Numbers, variables, etc. */ (([0-9]+"."[0-9]*)|("."[0-9]+))([ED]"-"?[0-9]+)? return SetReturn(BAS_V_FLOAT); [0-9]+[ED]"-"?[0-9]+ return SetReturn(BAS_V_FLOAT); [0-9]+ return SetReturn(BAS_V_INTEGER); [0-9]+[%] return SetReturn(BAS_V_INT); [A-Z][A-Z0-9._$]*[%]? return SetReturn(BAS_V_NAME); [A-Z][A-Z0-9_]*":"/[^:] return SetReturn(BAS_V_LABEL); /* * End of file (try to back up one include level) */ <> { if (--include_stack_pointer < 0) { include_stack_pointer = 0; yyterminate(); } else { yy_switch_to_buffer( include_stack[include_stack_pointer]); xline = include_line[include_stack_pointer]; if (PositionDump){cerr << "Leaving Include " << include_name[include_stack_pointer] << endl; } delete include_name[include_stack_pointer]; } } %% static void StartInclude(char* FileName) { char UseName[64]; // File name to actually use FILE* NewChannel; // File Open Info // // Strip off quotes (We KNOW that we have them) // assert(FileName[0] != 0); assert(FileName[1] != 0); strcpy(UseName, FileName + 1); UseName[strlen(UseName) - 1] = '\0'; // // Can we handle the include? // if (include_stack_pointer >= MAX_INCLUDE_DEPTH) { cerr << "Includes Nested Too Deep (" << UseName << ")" << endl; return; } // // Try to open up the file // NewChannel = fopen(UseName, "r"); if (NewChannel == 0) { // // Try to lose any logicals on front of file name // char* cindex = strchr(UseName, ':'); if (cindex != 0) { NewChannel = fopen(cindex + 1, "r"); if (NewChannel == 0) { cerr << "Unable to open (" << UseName << ")" << endl; return; } } else { cerr << "Unable to open (" << UseName << ")" << endl; return; } } // // Switch over to new buffer // include_stack[include_stack_pointer] = YY_CURRENT_BUFFER; include_line[include_stack_pointer] = xline; include_name[include_stack_pointer] = new char[strlen(UseName)+1]; strcpy(include_name[include_stack_pointer], UseName); xline = 1; include_stack_pointer++; yy_switch_to_buffer(yy_create_buffer(NewChannel, YY_BUF_SIZE)); if (PositionDump) { cerr << "Including (" << UseName << ")" << endl;}; } main.cc100644 765 144 37706 6264106511 11070 0ustar kevinusers/******************************************************************************* Program: Main.cc 01.00.00 Title: Basic Translater Main Function Description: This is the main driver function for the basic translater. Algorithm: This translater operates in steps on the source code: 1. Rough translation using LEX and YACC to create a tree out of the entire program. This tree only approximates the actual program sequence. 2. Scan through tree, removing out initilization code, and making tables of line numbers and variables used in the program. 3. Write out the variable definition section of the output. 4. Modify the tree to actual execution format, converting if-then-else, for-next, ... into a better node format. 5. Lose line numbers and labels that are not used. 6. Pull subroutines out into seperate units. 7. Optimize tree. See if we can replace statements with auto-increment/decrement, ... 8. Write out code section of program. Bugs: Requires the source code to be formatted into a more strict format than the actual basic compiler likes. History: 01.01.00 - 08/30/1996 - Kevin Handy Set version number to 1.1, and install on internet. 01.01.01 - 08/31/1996 - Kevin Handy Changed 'TreeStruct' to 'Node', which makes more sense. Modified for privatization of Nodes data. Lose extra calls to 'UnDownLink', which werent needed. Found bug in "IF x THEN IF y THEN z else a else b" 01.01.02 - 10/22/1996 - Kevin Handy Added variables 'IntegerType' and 'RealType'. 01.02.01 - 12/17/1996 - Kevin Handy Move initalization of 'IntegerType' and 'RealType' from parse.y to main(). 01.02.02 - 01/05/1997 - Kevin Handy Created a function to write out the titles. Added date and time of translation. *******************************************************************************/ // // System Include Files // #include #include #include #include #include #include #include // // Project Include Files // #include "basic.h" #include "nodes.h" #include "parse.h" // // Module #defined Constants // // // Module #defined Functions // // // Global Variables // VariableList *Variables; int CompileFlag; int NeedIostreamH = 0; int NeedStringH = 0; int NeedMathH = 0; int NeedErrorH = 0; int NeedStdlibH = 0; int NeedRFA = 0; int NeedBasicFun = 0; int NeedTimeH = 0; int NeedDataList = 0; int IntegerType = VARTYPE_INTEGER; int RealType = VARTYPE_REAL; int DebugDump = FALSE; int DebugDumpOne = FALSE; int VariableDump = FALSE; int PositionDump = FALSE; // // Module Structure Definitions // // // Module Function Prototypes // static void WriteHeader(ostream& os, const char* Name); // // Module Variables // static ostream *OutFile; /******************************************************************************* Global Function: main() Title: Main driver function. Description: This is the overall controlling function of the translater. Bugs: Needs command line options. *******************************************************************************/ main(int argc, char *argv[]) { // // Local Variables // int ArgLoop; int DidOneFlag = 0; // // Initialize variables // OutFile = &cout; CompileFlag = 0; // // Handle input arguements // for (ArgLoop = 1; ArgLoop < argc; ArgLoop++) { if (argv[ArgLoop][0] == '-') { switch(tolower(argv[ArgLoop][1])) { case 't': // // Tracing // switch(tolower(argv[ArgLoop][2])) { case '1': DebugDump = TRUE; break; case '2': DebugDumpOne = TRUE; break; default: DebugDump = TRUE; DebugDumpOne = TRUE; break; } break; case 'v': // // Variable dump(s) // VariableDump = TRUE; break; case 'o': // // Output File // if (OutFile != &cout) { delete OutFile; OutFile = NULL; } ArgLoop++; OutFile = new ofstream(argv[ArgLoop]); if (OutFile == NULL) { cerr << "Unable to open " << argv[ArgLoop] << "for output" << endl; exit(1); } break; case 'h': DidOneFlag = 1; cerr << "Usage: basic [-t] [-v] [-c] [-p] " "[-o output] source" << endl; break; case 'c': CompileFlag = 1; break; case 'p': PositionDump = TRUE; break; default: cerr << "%Error on command line " << argv[ArgLoop] << endl; break; } } else { // // At least one file name on command line // DidOneFlag = 1; // // Reset line counter // xline = 1; include_stack_pointer = 0; // // Open up source file // if ((yyin = fopen(argv[ArgLoop], "r")) == 0) { cerr << "Unable to open input file " << argv[ArgLoop] << endl; exit(1); } WriteHeader(*OutFile, argv[ArgLoop]); // *OutFile << "//" << endl << // "// " << argv[ArgLoop] << endl << // "// Translated from Basic to C++ using btran(~tm)" << // endl << // "//" << endl << endl; // // Step 1. Parse the program. YACC will call the // rest of the program if it scans correctly. // if (PositionDump) { cerr << "Parsing." << endl; } Variables = new VariableList; /* * Defaulvariable size */ IntegerType = VARTYPE_INTEGER; RealType = VARTYPE_REAL; if (yyparse() != 0) { cerr << "%Failure during parse" << endl; delete Variables; fclose(yyin); exit(1); } // // Close the input file // fclose(yyin); delete Variables; } } if (DidOneFlag == 0) { // // Reset line counter // xline = 1; include_stack_pointer = 0; // // Read from standard input if we haven't handled // any input files yet. // yyin = stdin; WriteHeader(*OutFile, "Standard Input"); // *OutFile << "//" << endl << // "// Translated from Basic to C++ using btran(~tm)" << // endl << // "//" << endl << endl; if (PositionDump) { cerr << "Parsing." << endl; } Variables = new VariableList; if (yyparse() != 0) { cerr << "%Failure during parse" << endl; delete Variables; exit(1); } // // Close the input file // delete Variables; } if (OutFile != &cout) { delete OutFile; } return 0; } /******************************************************************************* Local function: WriteHeader() Title: Write Header To Output File Description: Writes out a nice little title at the start if an output translation saying I'll take the blame for the lousy code output. *******************************************************************************/ static void WriteHeader(ostream& os, const char* Name) { time_t timer; struct tm *tblock; char Text[64]; timer = time(NULL); tblock = localtime(&timer); strftime(Text, sizeof(Text), "%A, %B %d, %Y at %X", tblock); os << "//" << endl; os << "// Source: " << Name << endl; os << "// Translated from Basic to C++ using btran(~tm:)" << endl; os << "// on " << Text << endl; os << "//" << endl << endl; } /******************************************************************************* Global Function: DoProgram() Title: Main part of translater Description: This function does most of the work after the parser has generated the tree. Bugs: Not yet complete. *******************************************************************************/ void DoProgram(Node *Program) { // // Pretend it all started with a FUNCTION INTGER MAIN. // This creates a 'main' function for the program. // Node* BeginProgram = new Node(BAS_S_FUNCTION); Node* BeginType = new Node(BAS_S_INTEGER); Node* BeginName = new Node(BAS_V_FUNCTION, "MAIN"); BeginProgram->Link(BeginType, NULL, BeginName); BeginProgram->DownLink(Program); // // Dump out accourding to flags // if (DebugDump && (Program != 0)) { BeginProgram->PrintTree(); } if (PositionDump) { cerr << "Scanning for loops" << endl; } BeginProgram = ScanForLoops(BeginProgram); if (DebugDumpOne) { BeginProgram->PrintTree(); } /* * Step 8. Output the translated code */ if (PositionDump) { cerr << "Outputing code" << endl; } BeginProgram->Output(*OutFile); // // Free up all memory allocated // delete BeginProgram; } /******************************************************************************* Global Function: ScanForLoops() Title: Fix up loops, if-then-else, functions. Description: This function scans through the program, fixing up for-next loops, if-then-else statements, while statements, program segments, etc. Since the parser doesn't make complete loops for anything except modified statements, we need to roll the statements together here. Bugs: Goes internally into the tree to restructure the code instead of using the interface code. *******************************************************************************/ Node *ScanForLoops ( Node *Program ) { // // Local Variables // Node *ThisTree = Program; Node *NextTree; Node *IndentTree[128]; int IndentType[128]; int ThisLevel = 0; // // Start the whole mass going // assert(Program != 0); IndentTree[0] = 0; // // Scan through the program, looking for loops at level 0. // while (ThisTree != 0) { // // Remember what the next level will be // NextTree = ThisTree->GetDown(); ThisTree->UnDownLink(); // // Preview this node, and decide what to do with it. // switch(ThisTree->GetType()) { case BAS_S_THEN: // // We don't need to keep THEN's at all. // // ThisTree->UnDownLink(); delete ThisTree; goto reloop; case BAS_S_ELSE: // // Look for matching IF // while ((ThisLevel > 0) && ((IndentType[ThisLevel-1] != BAS_S_IF) || (IndentTree[ThisLevel-1]->GetTree(2) != NULL))) { ThisLevel--; } // // We better be in an if statement // if (IndentType[ThisLevel-1] == BAS_S_IF) { // // Use the ELSE node as a hook to this // section. // assert(IndentTree[ThisLevel-1]->GetTree(2) == NULL); IndentTree[ThisLevel-1]->Link(NULL, NULL, ThisTree); IndentTree[ThisLevel] = ThisTree; } else { cerr << "Missing IF for ELSE" << endl; } // // We don't need to keep the 'ELSE' any longer. // // ThisTree->UnDownLink(); // delete ThisTree; goto reloop; case BAS_S_NEXT: // // Next statement // // Look for previous "for" or "while". This may cause // IF's to terminate early, but if the program is // structured correctly we will only go back one // level. // while ((ThisLevel > 0) && (IndentType[ThisLevel-1] != BAS_S_FOR) && (IndentType[ThisLevel-1] != BAS_S_WHILE) && (IndentType[ThisLevel-1] != BAS_N_FORUNTIL) && (IndentType[ThisLevel-1] != BAS_N_FORWHILE)) { ThisLevel--; } // // Now back up one level // if (ThisLevel > 0) { ThisLevel--; } // // We don't need to keep NEXT any longer // // ThisTree->UnDownLink(); delete ThisTree; goto reloop; case BAS_N_ENDRECORD: // // END RECORD statement // // Look for previous "RECORD". // while ((ThisLevel > 0) && (IndentType[ThisLevel-1] != BAS_S_RECORD)) { ThisLevel--; } // // Now back up one level // if (ThisLevel > 0) { ThisLevel--; } // // We don't need to keep 'END RECORD' any longer // // ThisTree->UnDownLink(); delete ThisTree; goto reloop; case BAS_N_ENDVARIANT: // // END VARIANT statement // // Look for previous "VARIANT". // while ((ThisLevel > 0) && (IndentType[ThisLevel-1] != BAS_S_VARIANT)) { ThisLevel--; } // // Now back up one level // if (ThisLevel > 0) { ThisLevel--; } // // We don't need to keep 'END VARIANT' any longer // // ThisTree->UnDownLink(); delete ThisTree; goto reloop; case BAS_S_FUNCTIONEND: case BAS_S_SUBEND: // // End a function/subroutine // // Force back to lowest level // ThisLevel = 0; // // We don't need to keep 'END SUB' any longer // // ThisTree->UnDownLink(); delete ThisTree; goto reloop; case BAS_S_FNEND: // // End an internal function // while ((ThisLevel > 0) && (IndentType[ThisLevel-1] != BAS_S_DEF)) { ThisLevel--; } // // Now back up one level // if (ThisLevel > 0) { ThisLevel--; } // // We don't need to keep FNEND any longer // // ThisTree->UnDownLink(); delete ThisTree; goto reloop; case BAS_V_LABEL: // // A line number will terminate any open IF // statements. I'll assume they are all at the // top of the stack. // if (isdigit(ThisTree->GetText()[0])) { while ((ThisLevel > 0) && (IndentType[ThisLevel-1] == BAS_S_IF)) { ThisLevel--; } } // // We need to keep line number. // break; case BAS_N_ENDIF: // // end-if // if ((ThisLevel > 0) && (IndentType[ThisLevel-1] == BAS_S_IF)) { ThisLevel--; } // // Lose the 'END IF' statement. // // ThisTree->UnDownLink(); delete ThisTree; goto reloop; case BAS_S_CASE: case BAS_N_CASEELSE: while ((ThisLevel > 0) && (IndentType[ThisLevel-1] != BAS_S_SELECT) && (IndentType[ThisLevel-1] != BAS_S_VARIANT)) { ThisLevel--; } break; case BAS_N_ENDSELECT: while ((ThisLevel > 0) && (IndentType[ThisLevel-1] != BAS_S_SELECT)) { ThisLevel--; } if (ThisLevel > 0) { ThisLevel--; } // // Lose the 'END SELECT' // // ThisTree->UnDownLink(); delete ThisTree; goto reloop; case BAS_S_FUNCTION: case BAS_S_SUB: if (ThisTree->GetTree(3) == NULL) { // // A Function or Subroutine // ThisLevel = 0; } break; } // // Connect this node into the current level // if (IndentTree[ThisLevel] == 0) { // // If we start with a empty level, // we need to hook this // node down to the previous level. // if (ThisLevel != 0) { assert(IndentTree[ThisLevel-1]->GetTree(3) == NULL); IndentTree[ThisLevel-1]->Link(NULL, NULL, NULL, ThisTree); } } else { // // Link Nodes to the previous node on same level // IndentTree[ThisLevel]->DownLink(ThisTree); } IndentTree[ThisLevel] = ThisTree; // // Look at this node, and decide what to do with it // switch(ThisTree->GetType()) { case BAS_S_IF: case BAS_S_UNLESS: case BAS_S_FUNCTION: case BAS_S_SUB: case BAS_S_FOR: case BAS_N_FORUNTIL: case BAS_N_FORWHILE: case BAS_S_UNTIL: case BAS_S_WHILE: case BAS_S_DEF: if (ThisTree->GetTree(3) == NULL) { IndentType[ThisLevel] = ThisTree->GetType(); ThisLevel++; IndentTree[ThisLevel] = 0; } break; case BAS_S_CASE: case BAS_N_CASEELSE: case BAS_S_SELECT: case BAS_S_RECORD: case BAS_S_VARIANT: assert(ThisTree->GetTree(3) == NULL); IndentType[ThisLevel] = ThisTree->GetType(); ThisLevel++; IndentTree[ThisLevel] = 0; break; } // // Point to next node // reloop: ThisTree = NextTree; } // // Done. Hand back re-structured tree. // return(Program); } #ifndef __MSDOS__ /******************************************************************************* Global Function: strupr() Title: Convert a string to upper case Description: This function will convert a text string to upper case. Bugs: This function exists in MSDOS, but not in ANSI-C definition, and thus is defined here to make it available. *******************************************************************************/ char *strupr(char *s) { char *s1 = s; while (*s1) { *s1 = toupper(*s1); s1++; } return s; } /******************************************************************************* Global Function: strlwr() Title: Convert a string to lower case Description: This function will convert a text string to lower case. Bugs: This function exists in MSDOS, but not in ANSI-C definition, and thus is defined here to make it available. *******************************************************************************/ char *strlwr(char *s) { char *s1 = s; while (*s1) { *s1 = tolower(*s1); s1++; } return s; } #endif makefile100644 765 144 1142 6212167407 11302 0ustar kevinusersC++ = g++ CPPFLAGS = -I/usr/include/g++ -g all : btran btran : parse.o main.o lex.o nodes.o variable.o varlist.o yywrap.o g++ $(LDFLAGS) -o $@ $^ $(LOADLIBS) $(LDLIBS) main.o : main.cc basic.h parse.h nodes.h parse.o : parse.cc parse.h nodes.h basic.h lex.o : lex.cc parse.h basic.h nodes.o : nodes.cc nodes.h variable.h basic.h parse.h variable.o : variable.cc variable.h basic.h parse.h varlist.o : varlist.cc variable.h basic.h parse.h yywrap.o : yywrap.c lex.cc : lex.l flex -i -s -v lex.l mv lex.yy.c lex.cc parse.cc : parse.y bison -d -v parse.y mv parse.tab.c parse.cc mv parse.tab.h parse.h makefile.linux100644 765 144 1142 6202703576 12442 0ustar kevinusersC++ = g++ CPPFLAGS = -I/usr/include/g++ -g all : btran btran : parse.o main.o lex.o nodes.o variable.o varlist.o yywrap.o g++ $(LDFLAGS) -o $@ $^ $(LOADLIBS) $(LDLIBS) main.o : main.cc basic.h parse.h nodes.h parse.o : parse.cc parse.h nodes.h basic.h lex.o : lex.cc parse.h basic.h nodes.o : nodes.cc nodes.h variable.h basic.h parse.h variable.o : variable.cc variable.h basic.h parse.h varlist.o : varlist.cc variable.h basic.h parse.h yywrap.o : yywrap.c lex.cc : lex.l flex -i -s -v lex.l mv lex.yy.c lex.cc parse.cc : parse.y bison -d -v parse.y mv parse.tab.c parse.cc mv parse.tab.h parse.h makefile.vms100644 765 144 1363 6203477234 12115 0ustar kevinusersC++ = gcc/plus C++FLAGS = $(defines) /nodebug/opt=2 #C++FLAGS = $(defines) /nodebug/noopt/profile LDLIBS = ,[gnu.lib]fl/lib,[gcc]options_shr/opt all : btran.exe btran.exe : parse.obj main.obj lex.obj nodes.obj variable.obj varlist.obj $(LD) $(LDFLAGS) /exe=$@ $^ $(LOADLIBS) $(LDLIBS) main.obj : main.cc basic.h parse.h nodes.h parse.obj : parse.cc parse.h nodes.h basic.h lex.obj : lex.cc parse.h basic.h nodes.obj : nodes.cc nodes.h variable.h basic.h parse.h variable.obj : variable.cc variable.h basic.h parse.h varlist.obj : varlist.cc variable.h basic.h parse.h lex.cc : lex.l flex -i -s -v lex.l copy lexyy.c lex.cc delete lexyy.c;* parse.cc : parse.y bison/define/output=parse.c parse.y/verbose copy parse.c parse.cc delete parse.c;* nodes.cc100644 765 144 200064 6264100654 11263 0ustar kevinusers/******************************************************************************* Program: nodes.cc 01.00.00 Title: Routines to work with nodes. Description: This file contains various routines for manipulating the tree nodes used when parsing a basic program. Compile: cc [noopt] History: 01.01.00 - 08/30/1996 - Kevin Handy Update version number to 1.1, and install on internet. 01.01.01 - 08/31/1996 - Kevin Handy Changed 'TreeStruct' to 'Node', which makes mode sense. 01.01.02 - 09/19/1996 - Kevin Handy Always include 'bstring.h' for string variables. 01.01.03 - 09/20/1996 - Kevin Handy Include instead of (oops). Always include 01.01.04 - 10/06/1996 - Kevin Handy Added BAS_V_PREDEF capability. 01.01.05 - 10/20/1996 - Kevin Handy Put a semicolon ';' after labels. This eliminates the error "label must be followed by a statement" from G++. Output 'include "datalist.h"' when needed. 01.02.01 - 11/11/1996 - Kevin Handy Added parameter to output functions (ostream& os), so that I didn't have to sneak in the channel through a side path. (Also loose weird *OutFile<< syntax) 01.02.02 - 11/11/1996 - Kevin Handy Midifications to use "os <<" instead of calls to "Outputxxx(os)" whenever possible. 01.02.03 - 11/12/1996 - Kevin Handy Modifications to reduce the number of functions, along with changes to parse.y 01.02.04 - 12/27/1996 - Kevin Handy Make the INPUT statement do something again. 01.02.05 - 01/05/1997 - Kevin Handy Force string constants to be BString's when necessary. *******************************************************************************/ // // System Include Files // #include #include #include #include #include #include #include #include // // Project Include Files // #include "basic.h" #include "parse.h" #include "nodes.h" // // Module #defined Constants // #define MAXLEVEL 256 // Maximum depth of nodes // // Module #defined Functions // // // Module Structure Definitions // // // Module Function Prototypes // static char *mangle_string(char *Text); static void mangle_string_value(char *ThisPart, int Base, char Type); // // Module Variables // /******************************************************************************* Member Function: Node() Title: Constructs a node. Description: This function creates a new node. *******************************************************************************/ int Node::Level = 0; Node::Node(int TypeValue, char* xTextValue, int Include) { Type = TypeValue; TextValue = NULL; Down = NULL; Tree[0] = NULL; Tree[1] = NULL; Tree[2] = NULL; Tree[3] = NULL; FromInclude = Include; // // Allocate room for text, and copy over. // if (xTextValue != NULL) { char *ThisText = new char[strlen(xTextValue) + 1]; assert(ThisText != NULL); strcpy(ThisText, xTextValue); if ((Type != BAS_V_TEXTSTRING) && (Type != BAS_S_REMARK)) { strupr(ThisText); } TextValue = ThisText; } } /******************************************************************************* Member Function: ~Node() Title: Destructs a node, and all of it's children. Description: This function frees an existing node, and all of its children. *******************************************************************************/ // // Destructor // Node::~Node() { // Lose all parameters delete Tree[0]; delete Tree[1]; delete Tree[2]; delete Tree[3]; // Lose text value delete TextValue; } /******************************************************************************* Link() Title: Link child nodes into parent node. Description: This function will link several child nodes into a parent node. Return Value: Returns a pointer to the parent node (passed as the first parameter) Bugs: *******************************************************************************/ Node *Node::Link ( Node *Node0, Node *Node1, Node *Node2, Node *Node3 ) { // // Attach them together // if (Node0 != NULL) { assert(Tree[0] == NULL); assert(Node0 != this); Tree[0] = Node0; } if (Node1 != NULL) { assert(Tree[1] == NULL); assert(Node1 != this); Tree[1] = Node1; } if (Node2 != NULL) { assert(Tree[2] == NULL); assert(Node2 != this); Tree[2] = Node2; } if (Node3 != NULL) { assert(Tree[3] == NULL); assert(Node3 != this); Tree[3] = Node3; } // // Return main node back // return(this); } /******************************************************************************* Member Function: DownLink() Title: Link two nodes together at same level. Description: This function will link two parent nodes together at the same tree level. If one or the other node doesn't exist, it will make whichever node exists the main node. Return Value: Returns the top node. Bugs: *******************************************************************************/ // // Link several nodes together through the Nodes // Node *Node::DownLink ( Node *Node0 ) { // // Don't link if nothing to link to // if (this == NULL) { return(Node0); } // // Skip out if link node is null // if (Node0 == NULL) { return this; } assert(Node0 != this); // // If we aren't at the top of the stack, scan to the end // Node* LookDown = this; while (LookDown->Down != NULL) { LookDown = LookDown->Down; } // // Attach them together // LookDown->Down = Node0; // // Return main node back // return(this); } /******************************************************************************* Global Function: PrintTree() Title: Prints the node tree. Description: This function will print out a simple picture of the node and its relationship to it's children. Bugs: Only displays to stdout. Ugly display. *******************************************************************************/ // // Print out tree in a tree structure // void Node::PrintTree(char* Level, int Flag, char Node) { // // Not really a node // assert(this != NULL); // // Local variables // char* DownLevel; // // Make sure we have an active node // if ((Down != NULL) || Flag) { DownLevel = " | "; } else { DownLevel = " "; } char* NextLevel = new char[strlen(Level) + 4]; strcpy(NextLevel, Level); strcat(NextLevel, DownLevel); // // Print bars for this level // cout << Level << " " << Node << "-" << Type; if (TextValue != NULL) { cout << " Text: " << TextValue; } cout << endl; // // Print Parameter Levels // if (Tree[0] != NULL) { Tree[0]->PrintTree(NextLevel, (Tree[1] != NULL) | (Tree[2] != NULL) | (Tree[3] != NULL), '0'); } if (Tree[1] != NULL) { Tree[1]->PrintTree(NextLevel, (Tree[2] != NULL) | (Tree[3] != NULL), '1'); } if (Tree[2] != NULL) { Tree[2]->PrintTree(NextLevel, (Tree[3] != NULL), '2'); } if (Tree[3] != NULL) { Tree[3]->PrintTree(NextLevel, 0, '3'); } // // Link down to next parent if possible // if (Down != NULL) { Down->PrintTree(Level, 0, 'D'); } } /******************************************************************************* Member Function: VariableScan() Title: Search block for variable names Description: Scans a block of code for variable names. This must be done before scanning for the loops. Call this funstion to process a block of statements. Bugs: *******************************************************************************/ void Node::VariableScan(int InDefineFlag) { Node *ThisNode; assert(this != NULL); // // Scan this statement // VariableScanOne(InDefineFlag); // // Scan Next Statement(s) // // I'm doing the scan here instead of having each node // call scan on it's own Dowm because the recursion becomes // a real memory killer on large programs. // ThisNode = Down; while (ThisNode != NULL) { ThisNode->VariableScanOne(InDefineFlag); ThisNode = ThisNode->Down; } } /******************************************************************************* Member Function: VariableScanOne() Title: Search statement for variable names. Description: Scans a block of code for variable names. This must be done before scanning for the loops. Call this function to process a single statement. Bugs: *******************************************************************************/ void Node::VariableScanOne(int InDefineFlag) { VariableStruct *ThisVar; int ThisType = 0; assert(this != NULL); // // Look at current node type // switch (Type) { case BAS_N_EXTERNALCONSTANT: assert(Tree[2] != NULL); if (Tree[1] != NULL) { ThisType = Tree[1]->ScanType(); } else { ThisType = 0; } Tree[2]->ScanVarList(ThisType, VARCLASS_CONST, TRUE); break; case BAS_N_EXTERNALFUNCTION: assert(Tree[1] != NULL); ThisType = Tree[1]->ScanType(); Tree[2]->ScanVarList(ThisType, VARCLASS_FUNC, TRUE); break; case BAS_N_EXTERNALSUB: Tree[1]->ScanVarList(VARTYPE_VOID, VARCLASS_FUNC, TRUE); break; case BAS_S_CALL: Tree[0]->ScanVarList(VARTYPE_VOID, VARCLASS_FUNC, FALSE); break; case BAS_S_COMMON: assert(Tree[0] != NULL); ThisVar = new VariableStruct(Tree[0]->TextValue, VARTYPE_STRUCT, VARCLASS_NONE, TRUE); Variables->Append(ThisVar); Variables->Fixup(); break; case BAS_S_DATA: break; case BAS_S_DECLARE: assert(Tree[2] != NULL); if (Tree[1] != NULL) { ThisType = Tree[1]->ScanType(); } else { ThisType = 0; } Tree[2]->ScanVarList(ThisType, VARCLASS_CONST, TRUE); break; case BAS_S_DIM: assert(Tree[0] != NULL); Tree[0]->VariableScanOne(1); break; case BAS_S_EXTERNAL: assert(Tree[2] != NULL); if (Tree[1] != NULL) { ThisType = Tree[1]->ScanType(); } else { ThisType = 0; } Tree[2]->ScanVarList(ThisType, VARCLASS_NONE, TRUE); break; case BAS_S_MAP: ScanMap(); break; case BAS_V_FUNCTION: // // Built in function // ThisVar = Variables->Lookup(TextValue, this); if (ThisVar == NULL) { // // Create variable // ThisVar = new VariableStruct(TextValue, VARTYPE_VOID, VARCLASS_FUNC, InDefineFlag); assert(ThisVar != NULL); // // Add to variable table // Variables->Append(ThisVar); } else { ThisVar->SetClass(VARCLASS_FUNC); } if (Tree[0] != NULL) { Tree[0]->VariableScan(InDefineFlag); } if (Tree[3] != NULL) { Tree[3]->VariableScan(0); } break; case BAS_S_FUNCTION: // // Function Definition // assert(Tree[2] != NULL); if (Tree[0] != NULL) { ThisType = Tree[0]->ScanType(); } else { ThisType = VARTYPE_VOID; } ThisVar = Variables->Lookup(Tree[2]->TextValue, this); if (ThisVar == NULL) { // // Create variable // ThisVar = new VariableStruct(Tree[2]->TextValue, ThisType, VARCLASS_FUNC, InDefineFlag); assert(ThisVar != NULL); // // Add to variable table // Variables->Append(ThisVar); } else { ThisVar->SetClass(VARCLASS_FUNC); ThisVar->Type = ThisType; } // // Scan calling parameters // if (Tree[2]->Tree[0] != NULL) { Tree[2]->Tree[0]->VariableScan(1); } // // Scan source code // if (Tree[3] != NULL) { Tree[3]->VariableScan(0); } break; case BAS_V_LABEL: ThisVar = Variables->Lookup(TextValue, 0); if (ThisVar == NULL) { int SeekColon = strlen(TextValue); if (TextValue[SeekColon - 1] == ':') { TextValue[SeekColon-1] = '\0'; } ThisVar = new VariableStruct(TextValue, VARTYPE_LABEL, VARCLASS_LABEL, TRUE); assert(ThisVar != NULL); Variables->Append(ThisVar); } break; case BAS_V_USELABEL: ThisVar = Variables->Lookup(TextValue, 0); if (ThisVar == NULL) { ThisVar = new VariableStruct(TextValue, VARTYPE_LABEL, VARCLASS_LABEL, TRUE); assert(ThisVar != NULL); Variables->Append(ThisVar); } ThisVar->EverUsed++; break; case BAS_V_NAME: Variables->Define(this, FALSE, InDefineFlag); // // Look at possible array reference // if (Tree[0] != NULL) { Tree[0]->VariableScanOne(InDefineFlag); } if (Tree[2] != NULL) { Tree[2]->VariableScanOne(InDefineFlag); } break; case BAS_S_RECORD: assert(Tree[0] != NULL); assert(Tree[3] != NULL); Tree[0]->VariableScanOne(1); Tree[3]->VariableScan(1); break; case BAS_N_STRUCTNAME: // // Force structer variable to be usable under C++ // strlwr(TextValue); // // Look at possible array reference // if (Tree[0] != NULL) { Tree[0]->VariableScanOne(InDefineFlag); } if (Tree[2] != NULL) { Tree[2]->VariableScanOne(InDefineFlag); } break; case BAS_X_STRREF: assert (Tree[0] != NULL); assert (Tree[1] != NULL); Tree[0]->VariableScanOne(InDefineFlag); Tree[1]->VariableScanOne(InDefineFlag); break; default: if (Tree[0] != NULL) { Tree[0]->VariableScan(InDefineFlag); } if (Tree[1] != NULL) { Tree[1]->VariableScan(InDefineFlag); } if (Tree[2] != NULL) { Tree[2]->VariableScan(InDefineFlag); } if (Tree[3] != NULL) { Tree[3]->VariableScan(InDefineFlag); } break; } } /******************************************************************************* Member Function: Node::ScanVarList() Title: Scans a (possible) list for the variable names of the current type. Description: Scans a block of code for the variable type. Bugs: *******************************************************************************/ void Node::ScanVarList(int ThisType, int ThisClass, int Status) { assert(this != NULL); switch(Type) { case BAS_N_LIST: case BAS_N_ASSIGNLIST: Tree[0]->ScanVarList(ThisType, ThisClass, Status); Tree[1]->ScanVarList(ThisType, ThisClass, Status); break; case '=': case BAS_N_ASSIGN: Tree[0]->ScanVarList(ThisType, ThisClass, Status); break; default: VariableStruct* ThisVar = Variables->Lookup(TextValue, Tree[0]); if (ThisVar == NULL) { ThisVar = new VariableStruct(TextValue, ThisType, ThisClass, Status); assert(ThisVar != NULL); Variables->Append(ThisVar); } } } /******************************************************************************* Member Function: Node::ScanType() Title: Search block for type definion Description: Scans a block of code for the variable type. Bugs: *******************************************************************************/ int Node::ScanType() { // // Don't even try it is we don't know what's happening // assert(this != NULL); // // Try to figure out the variable type // switch (Type) { case BAS_S_DOUBLE: return(VARTYPE_DOUBLE); case BAS_S_BYTE: return(VARTYPE_BYTE); case BAS_S_GFLOAT: return(VARTYPE_DOUBLE); case BAS_S_HFLOAT: return(VARTYPE_DOUBLE); case BAS_S_INTEGER: return(VARTYPE_INTEGER); case BAS_S_LONG: return(VARTYPE_LONG); case BAS_S_RFA: return(VARTYPE_RFA); case BAS_S_STRING: return(VARTYPE_DYNSTR); case BAS_S_WORD: return(VARTYPE_WORD); case BAS_S_DECIMAL: return(VARTYPE_DECIMAL); } return(0); } /******************************************************************************* Member Function: Node::Output() Title: Main function to output translated code. Description: This function outputs the translated code. Bugs: Ugly Code. *******************************************************************************/ void Node::Output(ostream& os) { // // Handle Include Files // if (NeedIostreamH != 0) { os << "#include " << endl; NeedIostreamH = 0; } os << "#include " << endl; NeedStdlibH = 0; if ((NeedStringH != 0) | (NeedBasicFun != 0)) { os << "#include " << endl; NeedStringH = 0; } if (NeedMathH != 0) { os << "#include " << endl; NeedMathH = 0; } if (NeedErrorH != 0) { os << "#include " << endl; NeedErrorH = 0; } if (NeedTimeH != 0) { os << "#include " << endl; NeedTimeH = 0; } os << "#include \"bstring.h\"" << endl; if (NeedBasicFun != 0) { os << "#include \"basicfun.h\"" << endl; NeedBasicFun = 0; } if (NeedDataList != 0) { os << "#include \"datalist.h\"" << endl; } os << endl; if (NeedRFA != 0) { os << "typedef char RmsRfa[6];" << endl; NeedRFA = 0; } if (NeedDataList != 0) { os << "static DataListClass DataList;" << endl; NeedDataList = 0; } os << endl; // // Output the variables // Variables->OutputDef(os, Level); // // Output code // Level = 0; OutputCode(os); } /******************************************************************************* Local Function: Node::OutputCode() Title: Output one block of code. Description: This function goes through the level 0 code (statements) and handle output of the commands at that level. Bugs: *******************************************************************************/ void Node::OutputCode(ostream& os) { assert(this != NULL); // // Local Variables // Node *Program = this; // // Starting at the top node, we scan down handling each // level 0 node type as necessary. // // Could do this by calling OutputCode recursively for the Down // level instead of splitting into OutputCode and OutputCodeOne, // but that would probibly consume too much stack space. // while (Program != NULL) { // // Handle Statement. Don't output code from included files. // if ((Program->FromInclude == 0) || (CompileFlag != 0)) { os << Program; } // // Get next node // Program = Program->Down; } } /******************************************************************************* Local Function: Node::OutputBlock() Title: Output one block of code. Description: This function will output a block of code (if it exists) surrounded by parentheses, otherwise it will output a semicolon. Bugs: *******************************************************************************/ void Node::OutputBlock(ostream& os) { // // If this is a null bit of code, just output a semicolon // if (this == NULL) { Indent(os); os << ";" << endl; } else { // // Start the block // Indent(os); os << "{" << endl; Level++; // // Local Variables // Node *Program = this; // // Starting at the top node, we scan down handling each // level 0 node type as necessary. // // Could do this by calling OutputCode recursively for the Down // level instead of splitting into OutputCode and OutputCodeOne, // but that would probibly consume too much stack space. // while (Program != NULL) { // // Handle Statement // if ((Program->FromInclude == 0) || (CompileFlag != 0)) { os << Program; } // // Get next node // Program = Program->Down; } // // End the block // Level--; Indent(os); os << "}" << endl; } } /******************************************************************************* Local Function: Node::NoParen() Title: Return a node losing any parentheses around the whole group. Description: This function goes through the level 0 code (statements) and handle output of the commands at that level. Bugs: *******************************************************************************/ Node& Node::NoParen() { if (Type == '(') { return *Tree[0]; } else { return *this; } } /******************************************************************************* Local Function: Node::OutputCodeOne() Title: Output one block of code. Description: This function goes through the level 0 code (statements) and handle output of the commands at that level. Bugs: *******************************************************************************/ void Node::OutputCodeOne(ostream& os) { VariableStruct *ThisVar; char *ThisPart = 0; assert(this != NULL); // // Handle this node type // switch (Type) { // // Assignment statement // case '#': os << "BasicChannel[" << Tree[0] << "]"; break; case '=': Tree[0]->OutputBstringText(os); os << " == " << Tree[1]; break; case '+': case '-': case '*': case '/': case '>': case '<': Tree[0]->OutputBstringText(os); os << " " << TextValue << " " << Tree[1]; break; case '(': os << "(" << Tree[0] << ")"; break; case '^': os << "pow(" << Tree[0]->NoParen() << ", " << Tree[1]->NoParen() << ")"; break; case BAS_S_AND: os << Tree[0] << " & " << Tree[1]; break; case BAS_N_ASSIGN: Indent(os); if (Tree[0] != NULL) { os << Tree[0]; } else { os << "(Return)"; } os << " = " << Tree[1] << ";" << endl; break; case BAS_N_ASSIGNLIST: assert(Tree[0] != NULL); assert(Tree[1] != NULL); os << Tree[0] << " = " << Tree[1]; break; case BAS_S_BY: switch(Tree[1]->Type) { case BAS_S_DESC: os << "$descr(" << Tree[0] << ")"; break; case BAS_S_REF: os << "&" << Tree[0]; break; default: os << Tree[0]; break; } break; case BAS_S_CALL: Indent(os); os << Tree[0] << ";" << endl; break; case BAS_S_CASE: if (Tree[0] != NULL) { Tree[0]->OutputCaseLabel(os); os << endl; } else { Indent(os); os << "case:\t// Empty case label" << endl << endl; } // // Output any info under case statement // if (Tree[3] != NULL) { Tree[3]->OutputCode(os); } Indent(os); os << "break;" << endl << endl; break; case BAS_N_CASEELSE: Level--; Indent(os); os << "default:" << endl; Level++; // // Output any info under case statement // if (Tree[3] != NULL) { Tree[3]->OutputCode(os); } Indent(os); os << "break;" << endl << endl; break; case BAS_P_CDD: os << "#dictionary " << Tree[0] << endl; break; case BAS_S_CHAIN: Indent(os); os << "BasicChain(" << Tree[0]->NoParen() << ");" << endl; break; case BAS_S_CLOSE: Indent(os); os << "BasicChannel[" << Tree[0]->NoParen() << "].Close();" << endl; break; case BAS_S_COMMON: OutputMap(os); break; case BAS_S_DATA: OutputData(os); break; case BAS_S_DECLARE: Tree[2]->OutputDefinition(os, Tree[1], Type); break; case BAS_S_DEF: // // Empty variable list // assert(Tree[2] != 0); // // Scan the call parameters // this->VariableScanOne(1); Variables->Fixup(); // // Dump out variable names if user asked for it // if (VariableDump) { Variables->Dump(); } // // Output function name // os << endl; Tree[2]->OutputDefinition(os, Tree[0], Type); // // Braces starting function // Indent(os); os << "{" << endl; // // Output local variables // if (Tree[3] != 0) { Level++; Variables->OutputDef(os, Level); os << endl; Tree[3]->OutputCode(os); Level--; } Indent(os); os << "}" << endl; break; case BAS_S_DELETE: Indent(os); os << "BasicChannel[" << Tree[0]->NoParen() << "].Delete();" << endl; break; case BAS_S_DIM: assert(Tree[0] != NULL); Tree[0]->OutputDefinition(os, this, Type); break; case BAS_S_ELSE: break; case BAS_S_END: case BAS_S_FNEND: break; case BAS_S_EQV: case BAS_S_IMP: os << "Basic" << TextValue << "(" << Tree[0] << ", " << Tree[1] << ")"; break; case BAS_S_ERL: os << "errline"; break; case BAS_S_ERR: os << "errno"; break; case BAS_S_EXTERNAL: Tree[2]->OutputDefinition(os, Tree[1], Type); break; case BAS_N_EXTERNALCONSTANT: Tree[2]->OutputDefinition(os, Tree[1], Type); break; case BAS_N_EXTERNALFUNCTION: Tree[2]->OutputDefinition(os, Tree[1], Type); break; case BAS_N_EXTERNALSUB: Tree[2]->OutputDefinition(os, Tree[1], Type); break; case BAS_S_EXIT: Indent(os); os << "return;" << endl; break; case BAS_S_FIND: Indent(os); os << "BasicChannel[" << Tree[0]->NoParen() << "].Find("; if (Tree[1] != NULL) { os << Tree[1]->NoParen(); } os << ");" << endl; break; case BAS_S_FOR: Indent(os); os << "for ("; // // from // os << Tree[0] << "; "; // // to // os << Tree[0]->Tree[0] << " <= " << Tree[1] << "; "; // // step // if (Tree[2] != NULL) { os << Tree[0]->Tree[0] << " += " << Tree[2]; } else { os << Tree[0]->Tree[0] << "++"; } os << ")" << endl; Tree[3]->OutputBlock(os); break; case BAS_N_FORASSIGN: os << Tree[0] << " = " << Tree[1]; break; case BAS_N_FORUNTIL: Indent(os); // // from // os << "for (" << Tree[0] << "; "; // // until // os << "!(" << Tree[0]->NoParen() << ")" << "; "; // // step // os << Tree[0]->Tree[0] << "++)" << endl; Tree[3]->OutputBlock(os); break; case BAS_N_FORWHILE: Indent(os); // // from // os << "for (" << Tree[0] << "; "; // // until // os << Tree[0]->Tree[0] << "==" << Tree[1] << "; "; // // step // os << Tree[0]->Tree[0] << "++)" << endl; Tree[3]->OutputBlock(os); break; case BAS_S_FUNCTION: // // Empty variable list // assert(Tree[2] != 0); Variables->ClearLocal(); // // Scan the call parameters // this->VariableScanOne(1); Variables->Fixup(); // // Dump out variable names if user asked for it // if (VariableDump) { Variables->Dump(); } // // Output function name // os << endl; Tree[2]->OutputDefinition(os, Tree[0], Type); os << endl; // // Braces starting function // Indent(os); os << "{" << endl; // // Output local variables // if (Tree[3] != 0) { Level++; Variables->OutputDef(os, Level); os << endl; Tree[3]->OutputCode(os); Level--; } Indent(os); os << "}" << endl; break; case BAS_V_FUNCTION: // // Look for variable in table // ThisVar = Variables->Lookup(TextValue, Tree[0]); // // Print this variable // if (ThisVar != NULL) { os << ThisVar->GetName(); } else { os << TextValue; } if (Tree[0] != NULL) { os << "(" << Tree[0]->NoParen() << ")"; } else { os << "()"; } break; case BAS_S_FUNCTIONEXIT: Indent(os); os << "return;" << endl; break; case BAS_X_GE: os << Tree[0] << " >= " << Tree[1]; break; case BAS_S_GET: Indent(os); os << "BasicChannel[" << Tree[0]->NoParen() << "].Get("; if (Tree[1] != NULL) { os << Tree[1]->NoParen(); } os << ");" << endl; break; case BAS_S_GOSUB: // // Yes, I know, C doesn't have a GOSUB, but this puts // out code that can be manually edited. Without this, // there is currently no way to find the subroutines. // Indent(os); os << "gosub " << Tree[0] << ";" << endl; break; case BAS_S_GOTO: Indent(os); os << "goto " << Tree[0] << ";" << endl; break; case BAS_S_IF: Indent(os); assert(Tree[0] != NULL); os << "if (" << Tree[0]->NoParen() << ")" << endl; Tree[3]->OutputBlock(os); if (Tree[2] != NULL) { Indent(os); os << "else" << endl; Tree[2]->OutputBlock(os); } break; case BAS_P_INCLUDE: // // Don't output '#include' if we are also outputting the // code that was included. // if (CompileFlag == 0) { os << "#include " << Tree[0] << endl; } else { os << "// #include " << Tree[0] << endl; } break; case BAS_S_INPUT: OutputInput(os); break; case BAS_V_INT: if (TextValue[strlen(TextValue) - 1] == '%') { TextValue[strlen(TextValue) - 1] = '\0'; } os << TextValue; break; case BAS_V_INTEGER: case BAS_V_FLOAT: os << TextValue; break; case BAS_S_ITERATE: Indent(os); os << "continue;" << endl; break; case BAS_S_KILL: Indent(os); os << "unlink(" << Tree[0]->NoParen() << ")" << endl; break; case BAS_V_LABEL: ThisVar = Variables->Lookup(TextValue, 0); if (ThisVar != NULL) { if (ThisVar->EverUsed != 0) { os << ThisVar->GetName() << ":;" << endl; } } else { os << TextValue << ":;" << endl; } break; case BAS_X_LE: os << Tree[0] << " <= " << Tree[1]; break; case BAS_S_LET: Indent(os); os << Tree[0] << ";" << endl; break; case BAS_S_LINPUT: Indent(os); if (Tree[0] != NULL) { os << "fscanf(" << Tree[0] << ");" << endl; } break; case BAS_N_LIST: if (Tree[0] == NULL) { os << "0"; } else { os << Tree[0]; } os << ", "; if (Tree[1] == NULL) { os << "0"; } else { os << Tree[1]; } break; case BAS_S_LSET: assert(Tree[0] != NULL); assert(Tree[0]->Type == BAS_N_ASSIGN); assert(Tree[0]->Tree[0] != NULL); assert(Tree[0]->Tree[1] != NULL); Indent(os); os << "BasicLset(" << Tree[0]->Tree[0] << ", " << Tree[0]->Tree[1] << ");" << endl; break; case BAS_S_MAP: OutputMap(os); break; case BAS_V_NAME: OutputVarName(os); break; case BAS_X_NEQ: os << Tree[0] << " != " << Tree[1]; break; case BAS_S_NOT: os << "!" << Tree[0]; break; case BAS_N_NULL: break; case BAS_N_ONGOTO: Indent(os); os << "switch(" << Tree[0]->NoParen() << ")" << endl; Indent(os); os << "{" << endl; Tree[1]->OutputOngo(os, "goto", 1); Indent(os); os << "}" << endl; break; case BAS_N_ONGOSUB: Indent(os); os << "switch(" << Tree[0]->NoParen() << ")" << endl; Indent(os); os << "{" << endl; Tree[1]->OutputOngo(os, "Gosub", 1); Indent(os); os << "}" << endl; break; case BAS_S_OPEN: // // For INPUT/OUTPUT // if (Tree[1] != NULL) { Indent(os); os << "BasicChannel[" << Tree[2] << "]."; if (Tree[1]->Type == BAS_S_INPUT) { os << "ForInput();" << endl; } else { os << "ForOutput();" << endl; } } // // Other flags set on open // if (Tree[3] != NULL) { Tree[3]->OutputOpenStuff(os, Tree[2]); } Indent(os); os << "BasicChannel[" << Tree[2] << "].Open("; if (Tree[0] != NULL) { os << Tree[0]; } os << ");" << endl; break; case BAS_S_OPTION: break; case BAS_S_OR: os << Tree[0] << " | " << Tree[1]; break; case BAS_V_PREDEF: os << TextValue; break; case BAS_S_PRINT: OutputPrint(os); break; case BAS_S_PUT: Indent(os); os << "BasicChannel[" << Tree[0]->NoParen() << "].Put();" << endl; break; case BAS_S_RANDOM: Indent(os); os << "srand(time());" << endl; break; case BAS_S_RECORD: Indent(os); os << "struct "; if (Tree[0] != NULL) { os << Tree[0]; } os << endl; Indent(os); os << "{" << endl; if (Tree[3] != NULL) { Level++; Tree[3]->OutputRecord(os); Level--; } Indent(os); os << "};" << endl; break; case BAS_S_RESTORE: if (Tree[0] == NULL) { Indent(os); os << "DataList.Reset();" << endl; } else { Indent(os); os << "BasicChannel[" << Tree[0]->NoParen() << "].Reset();" << endl; } break; case BAS_S_READ: Indent(os); os << "DataList.Read(" << Tree[0] << ");" << endl; break; case BAS_S_RSET: assert(Tree[0] != NULL); assert(Tree[0]->Type == BAS_N_ASSIGN); assert(Tree[0]->Tree[0] != NULL); assert(Tree[0]->Tree[1] != NULL); Indent(os); os << "BasicRset(" << Tree[0]->Tree[0] << ", " << Tree[0]->Tree[1] << ");" << endl; break; case BAS_S_RESET: if (Tree[0] == NULL) { Indent(os); os << "DataList.Reset();" << endl; } else { Indent(os); os << "RmsReset(" << Tree[0]->NoParen() << ");" << endl; } break; case BAS_S_RESUME: Indent(os); if (Tree[0] != NULL) { os << "goto " << Tree[0] << ";" << endl; } else { os << "BasicResume;" << endl; } break; case BAS_S_RETURN: Indent(os); os << "GosubReturn;" << endl << endl; break; case BAS_S_SELECT: assert(Tree[0] != NULL); Indent(os); os << "switch (" << Tree[0]->NoParen() << ")" << endl; Tree[3]->OutputBlock(os); break; case BAS_S_STOP: Indent(os); os << "exit(0);" << endl; break; case BAS_X_STRREF: os << Tree[0] << "." << Tree[1]; break; case BAS_N_STRUCTNAME: os << TextValue; break; case BAS_S_SUB: // // Empty variable list // assert(Tree[2] != 0); Variables->ClearLocal(); Tree[2]->VariableScanOne(1); Variables->Fixup(); // // Output function name // os << endl; Tree[2]->OutputDefinition(os, Tree[0], Type); // // Braces starting function // Indent(os); os << "{" << endl; // // Output local variables // if (Tree[3] != 0) { Level++; Tree[3]->VariableScan(0); Variables->Fixup(); Variables->OutputDef(os, Level); os << endl; Tree[3]->OutputCode(os); Level--; } Indent(os); os << "}" << endl; break; case BAS_S_SUBEXIT: Indent(os); os << "return;" << endl; break; case BAS_V_TEXTSTRING: ThisPart = mangle_string(TextValue); os << ThisPart; delete ThisPart; break; case BAS_P_TITLE: case BAS_P_SBTTL: case BAS_P_IDENT: case BAS_S_REMARK: Indent(os); OutputRemark(os); break; case BAS_S_TO: // // TO used in a case statement // os << Tree[0] << " ... " << Tree[1]; break; case BAS_N_TYPEFUN: os << "("; OutputDatatype(os, Tree[1]->Type); os << ")(" << Tree[0] << ")"; break; case BAS_N_UMINUS: os << "-" << Tree[0]; break; case BAS_N_UPLUS: os << "+" << Tree[0]; break; case BAS_X_UNARYGT: os << "> " << Tree[0]; break; case BAS_X_UNARYGE: os << ">= " << Tree[0]; break; case BAS_X_UNARYLE: os << "<= " << Tree[0]; break; case BAS_X_UNARYLT: os << "< " << Tree[0]; break; case BAS_X_UNARYNEQ: os << "!= " << Tree[0]; break; case BAS_S_UNLESS: assert(Tree[0] != NULL); Indent(os); os << "if (!(" << Tree[0]->NoParen() << "))" << endl; Tree[3]->OutputBlock(os); break; case BAS_S_UNLOCK: Indent(os); os << "BasicChannel[" << Tree[0]->NoParen() << "].Unlock();" << endl; break; case BAS_S_UNTIL: assert(Tree[0] != NULL); Indent(os); os << "while (!(" << Tree[0]->NoParen() << "))" << endl; Tree[3]->OutputBlock(os); break; case BAS_S_UPDATE: Indent(os); os << "RmsUpdate(" << Tree[0]->NoParen() << ");" << endl; break; case BAS_V_USELABEL: OutputLabel(os); break; case BAS_N_VARTYPE: case BAS_S_BYTE: case BAS_S_DOUBLE: case BAS_S_GFLOAT: case BAS_S_HFLOAT: case BAS_S_LONG: case BAS_S_WORD: case BAS_S_INTEGER: case BAS_S_REAL: case BAS_S_RFA: case BAS_S_STRING: case BAS_S_DECIMAL: if (Tree[2] != NULL) { Tree[2]->OutputDefinition(os, this, Type); } else { OutputDatatype(os, Type); } break; case BAS_S_WAIT: case BAS_S_SLEEP: Indent(os); os << "sleep(" << Tree[0]->NoParen() << ");" << endl; break; case BAS_S_WHILE: assert(Tree[0] != NULL); Indent(os); os << "while (" << Tree[0]->NoParen() << ")" << endl; Tree[3]->OutputBlock(os); break; case BAS_S_XOR: os << Tree[0] << " ^ " << Tree[1]; break; default: os << "??" << Type << ":" << TextValue << "("; if (Tree[0] != NULL) { os << Tree[0]; } os << ","; if (Tree[1] != NULL) { os << Tree[1]; } os << ","; if (Tree[2] != NULL) { os << Tree[2]; } os << ","; if (Tree[3] != NULL) { os << Tree[3]; } os << ")" << endl; break; } } /******************************************************************************* Member Function: Node::OutputVarName() Title: Outputs Variable Name Description: Creates the full name for a variable *******************************************************************************/ void Node::OutputVarName(ostream& os) { // // Local Variables // VariableStruct *ThisVar; assert(this != NULL); assert(TextValue != NULL); // // Look for variable in table // ThisVar = Variables->Lookup(TextValue, Tree[0]); // // Make up a good name to print for this variable // if (ThisVar != NULL) { os << ThisVar->GetName(); } else { os << TextValue; } // // Handle array references (May need to be modified from x[a,b] // to x[a][b] manually. // if (Tree[0] != NULL) { if ((ThisVar != NULL) && (ThisVar->Class == VARCLASS_FUNC)) { os << "(" << Tree[0]->NoParen() << ")"; } else { os << "["; Tree[0]->OutputArrayParam(os); os << "]"; } } } /******************************************************************************* Member Function: Node::OutputPrint() Title: Outputs a print statement. Description: This function will mangle a print statement. Bugs: *******************************************************************************/ void Node::OutputPrint(ostream& os) { Node *PUsing = 0; Node *PChannel = 0; Node *TreeDown; assert(this != NULL); // // Indent as necessary // Indent(os); os << "cout"; if (Tree[0] != NULL) { if (Tree[0]->OutputIPData(os, 0) != 0) { os << " << endl"; } } else { os << " << endl"; } os << ";" << endl; } /******************************************************************************* Member Function: Node::OutputInput() Title: Outputs a input statement. Description: This function will mangle a input statement. Bugs: *******************************************************************************/ void Node::OutputInput(ostream& os) { Node *PChannel = 0; Node *TreeDown; assert(this != NULL); // // Indent as necessary // Indent(os); os << "cin"; if (Tree[0] != NULL) { Tree[0]->OutputIPData(os, 1); } os << ";" << endl; } /******************************************************************************* Member Function: int Node::OutputIPData() Title: Outputs data related to an input or print statement. Description: This function will mangle a input statement. Returns a flag depending on if the input ended in something that should cause a return to be appended. Parameters: InputFlag Specifies if it is working on an input statement, ie. specifies the direction of the arrows. Return: 0 - Blank item on right hand side. 1 - Normal item on right hand side. 2 - Special item was just output Bugs: *******************************************************************************/ int Node::OutputIPData(ostream& os, int InputFlag) { int ReturnFlag; // Does a return seem to be needed // Gets set to one if the print/Input command // ends with a ',' or ';'. int TestFlag = 0; // Test for special item assert(this != NULL); // // Is this a piece of a list? // switch (Type) { case BAS_N_LIST: // // Try the left side of the tree // if (Tree[0] != NULL) { TestFlag = Tree[0]->OutputIPData(os, InputFlag); } // // Do we need to append a tab between fields? // Only do so for print statements. // if ((InputFlag == 0) && (TextValue[0] == ',') && (TestFlag != 2)) { os << " << '\\t'"; } // // Handle right side of the tree // if (Tree[1] != NULL) { ReturnFlag = Tree[1]->OutputIPData(os, InputFlag); } else { ReturnFlag = 0; } break; case '#': os << " << BasicChannel[" << Tree[0] << "]"; ReturnFlag = 2; break; case BAS_S_USING: os << " << USING(" << Tree[0] << ")"; ReturnFlag = 2; break; case BAS_N_RECORD: os << " << RECORD(" << Tree[0] << ")"; ReturnFlag = 2; break; default: // // A quoted string is always output, even in input // statements. // if ((InputFlag == 0) || (Type == BAS_V_TEXTSTRING)) { os << " << "; } else { os << " >> "; } os << this; ReturnFlag = 1; break; } // // Done // return ReturnFlag; } /******************************************************************************* Global Function: Node::OutputData() Title: Outputs a data statement. Description: This function will mangle a data statement. Bugs: *******************************************************************************/ void Node::OutputData(ostream& os) { assert(this != NULL); Indent(os); os << "DataList.Append("; Tree[0]->OutputDataValue(os); os << ");" << endl; } /******************************************************************************* Local Function: Node::OutputDataValue() Title: Outputs one data value in a data statement. Description: This function will mangle one data value for a data statement. It forces everything to be a string. Bugs: *******************************************************************************/ void Node::OutputDataValue(ostream& os) { assert(this != NULL); if (Type == BAS_N_LIST) { Tree[0]->OutputDataValue(os); os << ","; Tree[1]->OutputDataValue(os); } else { if (Type == BAS_V_TEXTSTRING) { os << this; } else { // // Force quotes ariund data value // os << '"' << this << '"'; } } } /******************************************************************************* Global Function: Node::OutputMap() Title: Outputs a map or common statement. Description: This function will mangle a map or common statement. Bugs: *******************************************************************************/ void Node::OutputMap(ostream& os) { assert(this != NULL); assert(Tree[0] != NULL); VariableStruct* ThisVar = Variables->Lookup(Tree[0]->TextValue, NULL); assert(ThisVar != NULL); Indent(os); os << "extern struct" << endl; Indent(os); os << "{" << endl; Level++; if (Tree[1] != NULL) { Tree[1]->OutputOneMap(os, ThisVar); } Level--; Indent(os); os << "} " << ThisVar->GetName() << ";" << endl; } /******************************************************************************* Member Function: Node::OutputOneMap() Title: Outputs a map or common statement. Description: This function will mangle a map or common statement. Bugs: *******************************************************************************/ void Node::OutputOneMap(ostream& os, VariableStruct* MapVar) { assert(this != NULL); switch (Type) { case BAS_N_LIST: if (Tree[0] != NULL) { Tree[0]->OutputOneMap(os, MapVar); } if (Tree[1] != NULL) { Tree[1]->OutputOneMap(os, MapVar); } break; case BAS_V_NAME: Indent(os); os << TextValue << ";" << endl; break; case BAS_N_VARTYPE: case BAS_S_STRING: case BAS_S_BYTE: case BAS_S_DOUBLE: case BAS_S_GFLOAT: case BAS_S_HFLOAT: case BAS_S_LONG: case BAS_S_WORD: case BAS_S_INTEGER: case BAS_S_REAL: case BAS_S_RFA: case BAS_S_DECIMAL: assert(Tree[0] != NULL); Indent(os); os << TextValue << " " << Tree[0]->TextValue; os << ";" << endl; break; default: Indent(os); OutputVarName(os); os << ";;;" << endl; break; } if (Down != NULL) { Down->OutputOneMap(os, MapVar); } } /******************************************************************************* Global Function: Node::ScanMap() Title: Outputs a map or common statement. Description: This function will mangle a map or common statement. Bugs: *******************************************************************************/ void Node::ScanMap() { assert(this != NULL); assert(Tree[0] != NULL); VariableStruct* ThisVar = new VariableStruct(Tree[0]->TextValue, VARTYPE_STRUCT, VARCLASS_NONE, TRUE); Variables->Append(ThisVar); Variables->Fixup(); if (Tree[1] != NULL) { Tree[1]->ScanOneMap(ThisVar); } } /******************************************************************************* Member Function: Node::ScanOneMap() Title: Outputs a map or common statement. Description: This function will mangle a map or common statement. Bugs: *******************************************************************************/ void Node::ScanOneMap(VariableStruct* MapVar) { char NameBuf[128]; char TempBuf[64]; VariableStruct* ThisVar; assert(this != NULL); switch (Type) { case BAS_N_LIST: if (Tree[0] != NULL) { Tree[0]->ScanOneMap(MapVar); } if (Tree[1] != NULL) { Tree[1]->ScanOneMap(MapVar); } break; case BAS_V_NAME: ThisVar = new VariableStruct(TextValue, 0, VARCLASS_NONE, TRUE); Variables->Append(ThisVar); strcpy(TempBuf, TextValue); strlwr(TempBuf); sprintf(NameBuf, "%s.%s", MapVar->GetName(), TempBuf); ThisVar->SetCName(NameBuf); break; case BAS_N_VARTYPE: case BAS_S_BYTE: case BAS_S_DOUBLE: case BAS_S_GFLOAT: case BAS_S_HFLOAT: case BAS_S_LONG: case BAS_S_WORD: case BAS_S_INTEGER: case BAS_S_REAL: case BAS_S_RFA: case BAS_S_STRING: case BAS_S_DECIMAL: assert(Tree[0] != NULL); ThisVar = new VariableStruct(Tree[0]->TextValue, 0, VARCLASS_NONE, TRUE); Variables->Append(ThisVar); strcpy(TempBuf, Tree[0]->TextValue); strlwr(TempBuf); sprintf(NameBuf, "%s.%s", MapVar->GetName(), TempBuf); ThisVar->SetCName(NameBuf); break; default: cerr << "Undefined type "<< Type << endl; break; } if (Down != NULL) { Down->ScanOneMap(MapVar); } } /******************************************************************************* Member Function: Node::OutputCaseLabel() Title: Output the "case" selections, one at a time. Description: Bugs: *******************************************************************************/ void Node::OutputCaseLabel(ostream& os) { assert(this != NULL); // // Handle this if it is a list // if (Type == BAS_N_LIST) { Tree[0]->OutputCaseLabel(os); Tree[1]->OutputCaseLabel(os); return; } // // Output one case statement // Level--; Indent(os); os << "case " << this << ":" << endl; Level++; } /******************************************************************************* Local Function: Indent(os) Title: Indents to current level. Description: This function is used to indent the code. Bugs: *******************************************************************************/ void Node::Indent(ostream& os) { int TabLoop; for (TabLoop = 1; TabLoop <= Level; TabLoop++) { os << "\t"; } } /******************************************************************************* Local Function: OutputRemark() Title: Prints out a comment. Description: This function strips off all of the junk from a comment and prints it out. Bugs: *******************************************************************************/ void Node::OutputRemark(ostream& os) { char* Remark = TextValue; int pointer; assert(TextValue != NULL); // // Skip start of remark character // if (*Remark == '!') { Remark++; } // // Skip extra white space // if (*Remark == ' ') { Remark++; } // // Lose any junk at end of comment // (Yes, it does modify the original value) // while((pointer = strlen(Remark) - 1) >= 0) { // Line continuation marker if (Remark[pointer] == '&') { Remark[pointer] = '\0'; continue; } // New Line if (Remark[pointer] == '\n') { Remark[pointer] = '\0'; continue; } // Space if (Remark[pointer] == ' ') { Remark[pointer] = '\0'; continue; } // Tab if (Remark[pointer] == '\t') { Remark[pointer] = '\0'; continue; } // Exclimation point if (Remark[pointer] == '!') { Remark[pointer] = '\0'; continue; } // Break out of loop break; } // // Dump out remark (and maybe add a space to the front) // if ((*Remark == '\0') || (*Remark == '\t') || (*Remark == '*')) { os << "//" << Remark; } else { os << "// " << Remark; } // // There may be some extra stuff that needs printing // if (Tree[0] != NULL) { os << ' '; Tree[0]->OutputCode(os); } os << endl; } /******************************************************************************* Function: OutputDatatype(os, int Type) Title: Prints out a data type (in C++). Description: Converts a BASIC data type into a C++ Data type Bugs: *******************************************************************************/ void Node::OutputDatatype(ostream& os, int ThisType) { char* DataType = ""; switch(ThisType) { case VARTYPE_VOID: DataType = "void"; break; case VARTYPE_LABEL: DataType = "label"; // ?? Shouldn't ever see break; case BAS_S_BYTE: case VARTYPE_BYTE: DataType = "char"; break; case BAS_S_DOUBLE: case VARTYPE_DOUBLE: DataType = "double"; break; case BAS_S_GFLOAT: DataType = "double /* GFloat */"; break; case BAS_S_HFLOAT: DataType = "double /* HFloat */"; break; case BAS_S_LONG: case VARTYPE_LONG: DataType = "long"; break; case BAS_S_WORD: case VARTYPE_WORD: DataType = "short int"; break; case BAS_S_INTEGER: case VARTYPE_INTEGER: DataType = "int"; break; case BAS_S_REAL: case VARTYPE_REAL: DataType = "float"; break; case BAS_S_STRING: case VARTYPE_DYNSTR: case VARTYPE_FIXSTR: DataType = "BString"; break; case BAS_S_RFA: case VARTYPE_RFA: DataType = "RmsRfa"; break; case BAS_S_DECIMAL: DataType = "Decimal"; break; default: DataType = TextValue; } os << DataType << " "; } /******************************************************************************* Function: OutputOngo() Title: Prints out a computed goto/gosub statement Description: Converts a BASIC data type into a C++ Data type Bugs: *******************************************************************************/ void Node::OutputOngo(ostream& os, const char* OnType, int GoLevel) { switch(Type) { case BAS_N_LIST: Tree[0]->OutputOngo(os, OnType, GoLevel); Tree[1]->OutputOngo(os, OnType, GoLevel + 1); break; case BAS_V_USELABEL: Indent(os); os << "case " << GoLevel << ":" << endl; Level++; Indent(os); os << OnType << ' '; OutputLabel(os); os << ";" << endl; Indent(os); os << "break;" << endl; Level--; break; case BAS_S_OTHERWISE: Indent(os); os << "default:" << endl; Level++; Indent(os); os << OnType << ' '; OutputLabel(os); os << ";" << endl; Indent(os); os << "break;" << endl; break; default: os << "Error in computed go (" << this << ")" << endl; break; } } /******************************************************************************* Function: OutputLabel() Title: Prints out a label Description: Output a label (if referenced anywhere) Bugs: *******************************************************************************/ void Node::OutputLabel(ostream& os) { VariableStruct *ThisVar = Variables->Lookup(TextValue, 0); if (ThisVar != NULL) { os << ThisVar->GetName(); } else { os << TextValue; } } /******************************************************************************* Local Function: mangle_string() Title: Prints out a quoted string. Description: This function processes a quoted string Bugs: *******************************************************************************/ static char *mangle_string(char *Text) { char *ThisPart; char *ThisPtr; char qmark; int Base = 10; assert(Text != NULL); // // Create area to work in // (Probibly more than we will need) // ThisPart = new char[strlen(Text) * 2]; ThisPtr = ThisPart; // // Handle any possible bases on front of string // switch (*Text) { case 'd': case 'D': Base = 10; Text++; break; case 'b': case 'B': Base = 2; Text++; break; case 'o': case 'O': Base = 8; Text++; break; case 'x': case 'X': Base = 16; Text++; break; } // // Determine quote character used (Better start with a quote // or were in deep ****) // qmark = *Text++; *ThisPtr++ = '"'; // // Process all the characters in original string // while (*Text) { switch (*Text) { // // Slash must be doubled // case '\\': *ThisPtr++ = '\\'; *ThisPtr++ = '\\'; break; // // Change (audible bell) character to (\a) // case '\a': *ThisPtr++ = '\\'; *ThisPtr++ = 'a'; break; // // Change (backspace) character to (\b) // case '\b': *ThisPtr++ = '\\'; *ThisPtr++ = 'b'; break; // // Change (tab) character to (\t) // case '\t': *ThisPtr++ = '\\'; *ThisPtr++ = 't'; break; // // Change (vertical tab) character to (\v) // case '\v': *ThisPtr++ = '\\'; *ThisPtr++ = 'v'; break; // // Single quote mark // case '\'': if (qmark == '\'') { *ThisPtr++ = '"'; qmark = '\0'; } else { *ThisPtr++ = '\''; } break; // // Double Quote Mark // case '"': if (qmark == '"') { *ThisPtr++ = '"'; qmark = '\0'; } else { *ThisPtr++ = '\\'; *ThisPtr++ = '"'; } break; case 'B': case 'b': case 'W': case 'w': case 'L': case 'l': case 'f': case 'F': case 'd': case 'D': case 'g': case 'G': case 'h': case 'H': case 'c': case 'C': if (qmark == 0) { *ThisPtr = '\0'; mangle_string_value(ThisPart, Base, *Text); ThisPtr = ThisPart + strlen(ThisPart); } else { *ThisPtr++ = *Text; } break; default: *ThisPtr++ = *Text; break; } Text++; } // // Return result // *ThisPtr = '\0'; return (ThisPart); } /******************************************************************************* Local Function: mangle_string_value() Title: Prints out a number in a given base. Description: This function processes a quoted string Bugs: *******************************************************************************/ static void mangle_string_value(char *ThisPart, int Base, char Type) { char *bascode; int len; char worktext[64]; int value; int valueflag = 0; assert(ThisPart != NULL); // // Set up format for outputing of this number // switch(Base) { case 2: bascode = "0b%s"; break; case 8: bascode = "0%s"; break; case 16: bascode = "0x%s"; break; default: // 10 bascode = "0x%x"; valueflag = -1; value = atoi(ThisPart + 1); break; } // // Lose final quote mark // len = strlen(ThisPart); if (len > 0) { ThisPart[len-1] = '\0'; } switch(Type) { case 'B': case 'b': case 'W': case 'w': if (valueflag) { sprintf(worktext, bascode, value); } else { sprintf(worktext, bascode, ThisPart+1); } break; case 'L': case 'l': if (valueflag) { sprintf(worktext, bascode, value); } else { sprintf(worktext, bascode, ThisPart+1); } strcat(worktext, "L"); break; case 'C': case 'c': worktext[0] = '\''; worktext[1] = '\\'; if (valueflag) { sprintf(worktext + 2, bascode, value); } else { sprintf(worktext + 2, bascode, ThisPart+1); } strcat(worktext, "'"); break; default: strcpy(worktext, ThisPart+1); break; } strcpy(ThisPart, worktext); } /******************************************************************************* Function: OutputDefinition() Title: Prints out a definition Description: Bugs: *******************************************************************************/ void Node::OutputDefinition(ostream& os, Node* MainType, int ExtType) { VariableStruct *ThisVar; assert(this != NULL); switch(Type) { case BAS_N_LIST: assert(Tree[0] != NULL); assert(Tree[1] != NULL); // // Put multiple items on seperate lines // Tree[0]->OutputDefinition(os, MainType, ExtType); // // Do we need a seperator // switch(ExtType) { case BAS_S_DECLARE: case BAS_S_DIM: case BAS_S_EXTERNAL: case BAS_N_EXTERNALCONSTANT: case BAS_S_SUB: case BAS_S_DEF: break; default: os << ", "; break; } Tree[1]->OutputDefinition(os, MainType, ExtType); break; case BAS_N_ASSIGN: Indent(os); Tree[0]->OutputDefinition(os, MainType, BAS_N_ASSIGN); os << " = " << Tree[1] << ";" << endl; break; case BAS_N_VARTYPE: os << TextValue << " "; if (Tree[2] != NULL) { os << Tree[2]; } if (Tree[3] != NULL) { os << "[" << Tree[3] << "]"; } break; case BAS_S_BYTE: case BAS_S_DOUBLE: case BAS_S_GFLOAT: case BAS_S_HFLOAT: case BAS_S_LONG: case BAS_S_WORD: case BAS_S_INTEGER: case BAS_S_REAL: case BAS_S_RFA: case BAS_S_STRING: case BAS_S_DECIMAL: // // This is a data type, so see if there are any variables // listed under this type, else dump out the data type // all be itself. // if (Tree[2] != NULL) { Tree[2]->OutputDefinition(os, this, ExtType); } else { OutputDatatype(os, Type); } if (Tree[3] != NULL) { os << "[" << Tree[3] << "]"; } break; default: // // Handle class // switch(ExtType) { case BAS_S_EXTERNAL: case BAS_N_EXTERNALFUNCTION: case BAS_N_EXTERNALSUB: Indent(os); os << "extern "; break; case BAS_N_EXTERNALCONSTANT: Indent(os); os << "extern const "; break; case BAS_S_DEF: Indent(os); os << "static "; break; case BAS_S_DECLARE: case BAS_S_DIM: case BAS_N_VARTYPE: case BAS_S_BYTE: case BAS_S_DOUBLE: case BAS_S_GFLOAT: case BAS_S_HFLOAT: case BAS_S_LONG: case BAS_S_WORD: case BAS_S_INTEGER: case BAS_S_REAL: case BAS_S_RFA: case BAS_S_STRING: case BAS_S_RECORD: case BAS_S_DECIMAL: Indent(os); break; } switch (Type) { case BAS_V_NAME: // // Look for variable in table // ThisVar = Variables->Lookup(TextValue, Tree[0]); // // Slap on sone kind of data type. // 1. Try the variable table // 2. Try for any kind of attached type // 3. Give up and call it a void. // if (ThisVar != NULL) { OutputDatatype(os, ThisVar->Type); } else { if (MainType != NULL) { MainType->OutputDatatype(os, MainType->Type); } else { os << "void "; } } // // Make up a good name to print for this variable // if (ThisVar != NULL) { os << ThisVar->GetName(); } else { os << TextValue; } // // Handle references (Function or array) // (May need to be modified from x[a,b] // to x[a][b] manually. // if (Tree[0] != NULL) { os << "["; Tree[0]->OutputArrayParam(os); os << "]"; } if (Tree[3] != NULL) { os << "[" << Tree[3] << "]"; } break; case BAS_V_FUNCTION: case BAS_S_SUB: // // Look for variable in table // ThisVar = Variables->Lookup(TextValue, Tree[0]); // // Slap on sone kind of data type. // 1. Try the variable table // 2. Try for any kind of attached type // 3. Give up and call it a void. // if (ThisVar != NULL) { OutputDatatype(os, ThisVar->Type); } else { if (MainType != NULL) { MainType->OutputDatatype(os, MainType->Type); } else { os << "void "; } } // // Make up a good name to print for this variable // if (ThisVar != NULL) { os << ThisVar->GetName(); } else { os << TextValue; } // // Handle references (Function) // os << "("; if (Tree[0] != NULL) { Tree[0]->OutputDefinition(os, NULL, BAS_N_LIST); } os << ")"; break; default: os << "(??) " << Type << "(??)" << this; break; } // // End definition // switch(ExtType) { case BAS_S_DECLARE: case BAS_S_DIM: case BAS_S_EXTERNAL: case BAS_N_EXTERNALFUNCTION: case BAS_N_EXTERNALSUB: case BAS_N_EXTERNALCONSTANT: case BAS_S_RECORD: case BAS_N_VARTYPE: case BAS_S_BYTE: case BAS_S_DOUBLE: case BAS_S_GFLOAT: case BAS_S_HFLOAT: case BAS_S_LONG: case BAS_S_WORD: case BAS_S_INTEGER: case BAS_S_REAL: case BAS_S_RFA: case BAS_S_STRING: case BAS_S_DECIMAL: os << ";" << endl; break; case BAS_V_FUNCTION: case BAS_S_SUB: case BAS_S_DEF: os << endl; break; } break; } } /******************************************************************************* Function: OutputRecord() Title: Prints out a record structure Description: Bugs: *******************************************************************************/ void Node::OutputRecord(ostream& os) { assert(this != NULL); switch(Type) { case BAS_S_VARIANT: Indent(os); os << "union" << endl; Indent(os); os << "{" << endl; Level++; Tree[3]->OutputRecord(os); Level--; Indent(os); os << "};" << endl; break; case BAS_S_CASE: // // Variant case // Indent(os); os << "struct" << endl; Indent(os); os << "{" << endl; Level++; Tree[3]->OutputRecord(os); Level--; Indent(os); os << "};" << endl; break; case BAS_N_VARTYPE: case BAS_S_BYTE: case BAS_S_DOUBLE: case BAS_S_GFLOAT: case BAS_S_HFLOAT: case BAS_S_LONG: case BAS_S_WORD: case BAS_S_INTEGER: case BAS_S_REAL: case BAS_S_RFA: case BAS_S_DECIMAL: Tree[2]->OutputDefinition(os, this, Type); break; default: OutputCode(os); break; } // // Any more levels to structure // if (Down != NULL) { Down->OutputRecord(os); } } /******************************************************************************* Function: OutputArrayParam() Title: Prints out an array reference list Description: Bugs: *******************************************************************************/ void Node::OutputArrayParam(ostream& os) { assert(this != NULL); switch(Type) { case BAS_N_LIST: if (Tree[0] != NULL) { Tree[0]->OutputArrayParam(os); } else { os << "(NULL)"; } os << "]["; if (Tree[1] != NULL) { Tree[1]->OutputArrayParam(os); } else { os << "(NULL)"; } break; default: os << this; break; } } /******************************************************************************* Member Function: OutputOpenStuff() Title: Output code for an 'OPEN' statement Description: This function generates the code necessary to handle a full 'RMS' open statement. It generates calls to a class for all the elements available in the statement. *******************************************************************************/ void Node::OutputOpenStuff(ostream& os, Node* Channel) { switch(Type) { case BAS_S_RECORDSIZE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetRecordSize(" << Tree[0] << ");" << endl; break; case BAS_S_FILESIZE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetFileSize(" << Tree[0] << ");" << endl; break; case BAS_S_EXTENDSIZE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetExtendSize(" << Tree[0] << ");" << endl; break; case BAS_S_WINDOWSIZE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetWindowSize(" << Tree[0] << ");" << endl; break; case BAS_S_BLOCKSIZE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetBlockSize(" << Tree[0] << ");" << endl; break; case BAS_S_BUCKETSIZE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetBucketSize(" << Tree[0] << ");" << endl; break; case BAS_S_MODE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetMode(" << Tree[0] << ");" << endl; break; case BAS_S_BUFFER: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetBuffer(" << Tree[0] << ");" << endl; break; case BAS_S_DEFAULTNAME: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetDefaultName(" << Tree[0] << ");" << endl; break; case BAS_S_PRIMARY: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetKey(" << Tree[0] << ");" << endl; break; case BAS_S_ALTERNATE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetKey(" << Tree[0] << ");" << endl; break; case BAS_S_TEMPORARY: Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetTemporary(True);" << endl; break; case BAS_S_CONTIGUOUS: Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetContiguous(True);" << endl; break; case BAS_S_NOREWIND: Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetRewind(False);" << endl; break; case BAS_S_NOSPAN: Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetSpan(False);" << endl; break; case BAS_S_SPAN: Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetSpan(True);" << endl; break; case BAS_S_ORGANIZATION: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetOrginization(" << Tree[0]->TextValue; if (Tree[0]->Tree[0] != NULL) { os << ", " << Tree[0]->Tree[0]->TextValue; } os << ");" << endl; break; case BAS_S_ACCESS: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetAccess(" << Tree[0]->TextValue << ");" << endl; break; case BAS_S_ALLOW: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetAllow(" << Tree[0]->TextValue << ");" << endl; break; case BAS_S_CONNECT: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetConnect(BasicChannel[" << Tree[0] << "]);" << endl; break; case BAS_S_MAP: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetMap(" << Tree[0] << ", sizeof(" << Tree[0] << "));" << endl; break; case BAS_S_RECORDTYPE: assert(Tree[0] != NULL); Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].SetRecordType(" << Tree[0]->TextValue << ");" << endl; break; default: Indent(os); os << "BasicChannel[" << Channel->NoParen() << "].GoofyOpenStuff(" << this << ");" << endl; break; } // // Handle downlink // if (Down != NULL) { Down->OutputOpenStuff(os, Channel); } } void Node::OutputBstringText(ostream& os) { switch(this->Type) { case BAS_V_TEXTSTRING: os << "BString("; OutputCodeOne(os); os << ")"; break; default: OutputCodeOne(os); break; } } nodes.h100644 765 144 4655 6264077274 11110 0ustar kevinusers// // Nodes.h // #ifndef _NODES_H_ #define _NODES_H_ #include // // Forward definitions // class VariableStruct; // // Main structure defining the program // class Node { private: int Type; // Node Type char *TextValue; // Text value associated with node Node *Down; // Down pointer Node *Tree[4]; // Pointers to other nodes static int Level; // Indentation level int FromInclude; // Is this from an include file? public: Node(int TypeValue = 0, char *TextValue = NULL, int Include = 0); ~Node(); Node* GetDown() { return Down; } int GetType() { return Type; } char* GetText() { return TextValue; } Node* GetTree(int Ptr) { return Tree[Ptr]; } Node& NoParen(); void SetType(int NewType) { Type = NewType; } void SetInclude(int NewValue) { FromInclude = NewValue; } Node *Link( struct Node *Node0 = NULL, struct Node *Node1 = NULL, struct Node *Node2 = NULL, struct Node *Node3 = NULL); // Attach parameter nodes to main node Node *DownLink(struct Node *Node0); // Attach links at same level void UnDownLink() { Down = NULL; } void PrintTree(char* Level = "", int flag = 0, char Node = '*'); void VariableScan(int AFlag); void VariableScanOne(int AFlag); int ScanType(); void Output(ostream& os); void OutputCode(ostream& os); void OutputCodeOne(ostream& os); friend ostream& operator<< (ostream& os, Node& nn) { nn.OutputCodeOne(os); return os; } friend ostream& operator<< (ostream& os, Node* nn) { nn->OutputCodeOne(os); return os; } private: void OutputBlock(ostream& os); void OutputPrint(ostream& os); void OutputInput(ostream& os); int OutputIPData(ostream& os, int InputFlag); void OutputData(ostream& os); void OutputDataValue(ostream& os); void OutputMap(ostream& os); void OutputOneMap(ostream& os, VariableStruct* MapVar); void ScanMap(); void ScanOneMap(VariableStruct* MapVar); void OutputCaseLabel(ostream& os); void OutputVarName(ostream& os); void Indent(ostream& os); void ScanVarList(int ThisType, int ThisClass, int Status); void OutputRemark(ostream& os); void OutputDatatype(ostream& os, int ThisType); void OutputLabel(ostream& os); void OutputOngo(ostream& os, const char* GoType, int GoLevel); void OutputDefinition(ostream& os, Node* MainType, int ExtType); void OutputRecord(ostream& os); void OutputArrayParam(ostream& os); void OutputOpenStuff(ostream& os, Node* Channel); void OutputBstringText(ostream& os); }; Node* ScanForLoops(Node* Program); #endif osfcn.h100644 765 144 27 6242161016 11015 0ustar kevinusers/* * Dummy Header */ parse.cc100644 765 144 370614 6263655522 11306 0ustar kevinusers /* A Bison parser, made from parse.y with Bison version GNU Bison version 1.22 */ #define YYBISON 1 /* Identify Bison output. */ #define BAS_S_ACCESS 258 #define BAS_S_ACTIVE 259 #define BAS_S_ALLOW 260 #define BAS_S_ALTERNATE 261 #define BAS_S_ANY 262 #define BAS_S_APPEND 263 #define BAS_S_AS 264 #define BAS_S_BACK 265 #define BAS_S_BLOCK 266 #define BAS_S_BLOCKSIZE 267 #define BAS_S_BUCKETSIZE 268 #define BAS_S_BUFFER 269 #define BAS_S_BY 270 #define BAS_S_BYTE 271 #define BAS_S_CALL 272 #define BAS_S_CASE 273 #define BAS_S_CHAIN 274 #define BAS_S_CHANGE 275 #define BAS_S_CHANGES 276 #define BAS_S_CLOSE 277 #define BAS_S_COMMON 278 #define BAS_S_CONSTANT 279 #define BAS_S_CONTIGUOUS 280 #define BAS_S_CONNECT 281 #define BAS_S_COUNT 282 #define BAS_S_DATA 283 #define BAS_S_DECIMAL 284 #define BAS_S_DECLARE 285 #define BAS_S_DEF 286 #define BAS_S_DEFAULTNAME 287 #define BAS_S_DELETE 288 #define BAS_S_DESC 289 #define BAS_S_DIM 290 #define BAS_S_DOUBLE 291 #define BAS_S_DUPLICATES 292 #define BAS_S_ELSE 293 #define BAS_S_END 294 #define BAS_S_EQ 295 #define BAS_S_ERL 296 #define BAS_S_ERR 297 #define BAS_S_ERROR 298 #define BAS_S_EXIT 299 #define BAS_S_EXPLICIT 300 #define BAS_S_EXTEND 301 #define BAS_S_EXTENDSIZE 302 #define BAS_S_EXTERNAL 303 #define BAS_S_FIELD 304 #define BAS_S_FILE 305 #define BAS_S_FILL 306 #define BAS_S_FILESIZE 307 #define BAS_S_FIND 308 #define BAS_S_FIXED 309 #define BAS_S_FNEND 310 #define BAS_S_FNEXIT 311 #define BAS_S_FOR 312 #define BAS_S_FORTRAN 313 #define BAS_S_FREE 314 #define BAS_S_FROM 315 #define BAS_S_FUNCTION 316 #define BAS_S_FUNCTIONEND 317 #define BAS_S_FUNCTIONEXIT 318 #define BAS_S_GE 319 #define BAS_S_GET 320 #define BAS_S_GFLOAT 321 #define BAS_S_GO 322 #define BAS_S_GOSUB 323 #define BAS_S_GOTO 324 #define BAS_S_GT 325 #define BAS_S_HFLOAT 326 #define BAS_S_IF 327 #define BAS_S_INACTIVE 328 #define BAS_S_INDEXED 329 #define BAS_S_INPUT 330 #define BAS_S_INTEGER 331 #define BAS_S_ITERATE 332 #define BAS_S_KEY 333 #define BAS_S_KILL 334 #define BAS_S_LET 335 #define BAS_S_LINE 336 #define BAS_S_LINPUT 337 #define BAS_S_LIST 338 #define BAS_S_LONG 339 #define BAS_S_LSET 340 #define BAS_S_MAP 341 #define BAS_S_MARGIN 342 #define BAS_S_MODE 343 #define BAS_S_MODIFY 344 #define BAS_S_MOVE 345 #define BAS_S_NAME 346 #define BAS_S_NEXT 347 #define BAS_S_NOCHANGES 348 #define BAS_S_NODUPLICATES 349 #define BAS_S_NONE 350 #define BAS_S_NOREWIND 351 #define BAS_S_NOSPAN 352 #define BAS_S_ON 353 #define BAS_S_OPEN 354 #define BAS_S_OPTION 355 #define BAS_S_ORGANIZATION 356 #define BAS_S_OTHERWISE 357 #define BAS_S_OUTPUT 358 #define BAS_S_OVERFLOW 359 #define BAS_S_PRIMARY 360 #define BAS_S_PRINT 361 #define BAS_S_PUT 362 #define BAS_S_RANDOM 363 #define BAS_S_READ 364 #define BAS_S_REAL 365 #define BAS_S_RECORD 366 #define BAS_S_RECORDTYPE 367 #define BAS_S_RECORDSIZE 368 #define BAS_S_REF 369 #define BAS_S_REGARDLESS 370 #define BAS_S_RELATIVE 371 #define BAS_S_REMAP 372 #define BAS_S_REMARK 373 #define BAS_S_REMARKLINE 374 #define BAS_S_RESTORE 375 #define BAS_S_RESET 376 #define BAS_S_RESUME 377 #define BAS_S_RETURN 378 #define BAS_S_REWIND 379 #define BAS_S_RFA 380 #define BAS_S_ROUNDING 381 #define BAS_S_RSET 382 #define BAS_S_SCRATCH 383 #define BAS_S_SELECT 384 #define BAS_S_SEQUENTIAL 385 #define BAS_S_SINGLE 386 #define BAS_S_SIZE 387 #define BAS_S_SLEEP 388 #define BAS_S_SPAN 389 #define BAS_S_STEP 390 #define BAS_S_STOP 391 #define BAS_S_STREAM 392 #define BAS_S_STRING 393 #define BAS_S_SUB 394 #define BAS_S_SUBEND 395 #define BAS_S_SUBEXIT 396 #define BAS_S_SUBSCRIPT 397 #define BAS_S_TEMPORARY 398 #define BAS_S_THEN 399 #define BAS_S_TO 400 #define BAS_S_TYPE 401 #define BAS_S_UNDEFINED 402 #define BAS_S_UNLESS 403 #define BAS_S_UNLOCK 404 #define BAS_S_UNTIL 405 #define BAS_S_UPDATE 406 #define BAS_S_USEROPEN 407 #define BAS_S_USING 408 #define BAS_S_VALUE 409 #define BAS_S_VARIABLE 410 #define BAS_S_VARIANT 411 #define BAS_S_VIRTUAL 412 #define BAS_S_WAIT 413 #define BAS_S_WHILE 414 #define BAS_S_WINDOWSIZE 415 #define BAS_S_WORD 416 #define BAS_S_WRITE 417 #define BAS_P_INCLUDE 418 #define BAS_P_FROM 419 #define BAS_P_CDD 420 #define BAS_P_TITLE 421 #define BAS_P_SBTTL 422 #define BAS_P_IDENT 423 #define BAS_V_FUNCTION 424 #define BAS_V_FLOAT 425 #define BAS_V_INTEGER 426 #define BAS_V_INT 427 #define BAS_V_LABEL 428 #define BAS_V_USELABEL 429 #define BAS_V_NAME 430 #define BAS_V_TEXTSTRING 431 #define BAS_V_RMSRECORD 432 #define BAS_V_PREDEF 433 #define BAS_X_UNARYLT 434 #define BAS_X_UNARYLE 435 #define BAS_X_UNARYGT 436 #define BAS_X_UNARYGE 437 #define BAS_X_UNARYNEQ 438 #define BAS_X_STRREF 439 #define BAS_X_NEQ 440 #define BAS_X_GE 441 #define BAS_X_LE 442 #define BAS_S_EQV 443 #define BAS_S_NOT 444 #define BAS_S_AND 445 #define BAS_S_OR 446 #define BAS_S_IMP 447 #define BAS_S_XOR 448 #define UMINUS 449 #define BAS_N_UMINUS 450 #define BAS_N_UPLUS 451 #define BAS_N_ASSIGN 452 #define BAS_N_FORASSIGN 453 #define BAS_N_ASSIGNLIST 454 #define BAS_N_LIST 455 #define BAS_N_ENDIF 456 #define BAS_N_ONGOTO 457 #define BAS_N_ONGOSUB 458 #define BAS_N_ONERROR 459 #define BAS_N_ENDSELECT 460 #define BAS_N_ENDRECORD 461 #define BAS_N_EXTERNALFUNCTION 462 #define BAS_N_EXTERNALSUB 463 #define BAS_N_EXTERNALCONSTANT 464 #define BAS_N_FORUNTIL 465 #define BAS_N_FORWHILE 466 #define BAS_N_CASEELSE 467 #define BAS_N_NULL 468 #define BAS_N_VARTYPE 469 #define BAS_N_ENDVARIANT 470 #define BAS_N_RECORD 471 #define BAS_N_STRUCTNAME 472 #define BAS_N_TYPEFUN 473 #line 34 "parse.y" #include #include "basic.h" #include "nodes.h" #ifndef YYSTYPE #define YYSTYPE Node * #endif #ifndef YYDEBUG #define YYDEBUG 0 #endif #ifndef YYLTYPE typedef struct yyltype { int timestamp; int first_line; int first_column; int last_line; int last_column; char *text; } yyltype; #define YYLTYPE yyltype #endif #ifndef YYSTYPE #define YYSTYPE int #endif #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define YYFINAL 730 #define YYFLAG -32768 #define YYNTBASE 234 #define YYTRANSLATE(x) ((unsigned)(x) <= 473 ? yytranslate[x] : 323) static const short yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 228, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 230, 2, 2, 2, 2, 231, 232, 192, 190, 203, 191, 2, 193, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 233, 197, 195, 196, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 229, 2, 194, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 198, 199, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 2, 3, 6, 11, 12, 14, 15, 17, 19, 23, 27, 31, 35, 37, 39, 40, 42, 44, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 78, 85, 90, 95, 97, 100, 103, 108, 113, 117, 120, 124, 127, 130, 133, 139, 144, 149, 156, 161, 166, 168, 172, 174, 179, 182, 185, 189, 193, 196, 200, 202, 205, 208, 211, 214, 217, 223, 230, 237, 242, 244, 247, 253, 258, 263, 268, 274, 279, 285, 293, 296, 301, 303, 306, 308, 313, 315, 320, 322, 325, 327, 330, 333, 335, 337, 341, 344, 348, 351, 354, 357, 359, 365, 368, 371, 376, 381, 386, 392, 396, 399, 402, 405, 408, 411, 415, 417, 419, 424, 429, 433, 437, 439, 443, 445, 448, 454, 459, 462, 465, 467, 470, 475, 478, 481, 484, 487, 489, 492, 494, 495, 499, 503, 507, 513, 519, 522, 526, 532, 537, 538, 541, 543, 547, 551, 555, 557, 561, 563, 566, 568, 570, 572, 574, 576, 578, 582, 586, 590, 594, 598, 601, 605, 609, 613, 617, 621, 625, 629, 633, 637, 641, 645, 648, 651, 655, 657, 661, 662, 664, 668, 672, 673, 675, 679, 680, 682, 686, 690, 692, 695, 697, 698, 700, 704, 708, 709, 711, 715, 717, 720, 723, 726, 729, 732, 735, 739, 741, 745, 746, 748, 752, 754, 756, 758, 761, 765, 767, 771, 773, 775, 779, 781, 786, 788, 793, 795, 797, 799, 801, 806, 813, 814, 817, 820, 824, 827, 830, 833, 836, 839, 842, 845, 849, 851, 852, 854, 856, 858, 860, 862, 864, 866, 868, 870, 872, 874, 876, 878, 883, 885, 889, 892, 898, 899, 902, 903, 905, 909, 911, 915, 919, 924, 928, 933, 934, 939, 943, 944, 946, 949, 953, 954, 957, 958, 961, 964, 966, 968, 970, 974, 977, 981, 983, 987, 989, 992, 994, 998, 1002, 1005, 1007, 1011, 1015, 1020, 1024, 1029, 1033, 1034, 1037, 1038, 1043, 1047, 1053, 1061, 1069, 1077, 1082, 1087, 1092, 1094, 1098, 1099, 1102, 1105, 1110, 1113, 1116, 1118, 1120, 1124, 1125, 1128, 1130, 1132, 1134, 1136, 1138, 1140, 1141, 1144, 1148, 1152, 1156, 1160, 1164, 1168, 1172, 1175, 1178, 1182, 1186, 1190, 1194, 1198, 1202, 1205, 1208, 1211, 1215, 1221, 1226, 1232, 1236, 1239, 1242, 1245, 1248, 1251, 1252, 1254, 1256, 1258, 1260, 1262, 1264, 1266, 1268, 1270, 1272, 1274, 1276, 1278, 1279, 1282, 1285, 1288, 1291, 1292, 1294, 1298 }; static const short yyrhs[] = { 235, 0, 0, 236, 235, 0, 237, 238, 239, 228, 0, 0, 171, 0, 0, 173, 0, 241, 0, 239, 229, 241, 0, 239, 144, 240, 0, 239, 38, 240, 0, 239, 210, 241, 0, 241, 0, 171, 0, 0, 249, 0, 242, 0, 248, 0, 242, 243, 0, 242, 244, 0, 242, 247, 0, 242, 245, 0, 242, 246, 0, 72, 258, 0, 148, 258, 0, 159, 258, 0, 150, 258, 0, 57, 256, 145, 258, 0, 57, 256, 145, 258, 135, 258, 0, 57, 256, 150, 258, 0, 57, 256, 159, 258, 0, 254, 0, 17, 273, 0, 19, 258, 0, 19, 258, 81, 258, 0, 20, 258, 145, 258, 0, 22, 230, 261, 0, 22, 261, 0, 33, 230, 258, 0, 44, 61, 0, 44, 139, 0, 44, 270, 0, 49, 230, 258, 203, 321, 0, 53, 230, 258, 307, 0, 57, 256, 145, 258, 0, 57, 256, 145, 258, 135, 258, 0, 57, 256, 150, 258, 0, 57, 256, 159, 258, 0, 56, 0, 59, 230, 258, 0, 63, 0, 65, 230, 258, 307, 0, 68, 270, 0, 69, 270, 0, 67, 139, 270, 0, 67, 145, 270, 0, 75, 310, 0, 75, 81, 310, 0, 77, 0, 77, 270, 0, 79, 258, 0, 80, 254, 0, 82, 310, 0, 85, 254, 0, 87, 230, 258, 203, 258, 0, 90, 145, 230, 258, 203, 258, 0, 90, 60, 230, 258, 203, 258, 0, 91, 258, 9, 258, 0, 92, 0, 92, 273, 0, 98, 43, 67, 145, 270, 0, 98, 43, 69, 270, 0, 98, 43, 67, 10, 0, 98, 258, 69, 269, 0, 98, 258, 67, 145, 269, 0, 98, 258, 68, 269, 0, 98, 258, 67, 139, 269, 0, 99, 258, 278, 9, 50, 257, 314, 0, 106, 308, 0, 107, 230, 258, 307, 0, 108, 0, 109, 272, 0, 121, 0, 121, 230, 258, 307, 0, 120, 0, 120, 230, 258, 307, 0, 122, 0, 122, 270, 0, 123, 0, 127, 254, 0, 133, 258, 0, 136, 0, 141, 0, 149, 230, 258, 0, 150, 258, 0, 151, 230, 258, 0, 158, 258, 0, 159, 258, 0, 18, 265, 0, 221, 0, 23, 231, 175, 232, 288, 0, 28, 262, 0, 30, 295, 0, 30, 282, 24, 253, 0, 30, 282, 61, 285, 0, 31, 281, 286, 294, 0, 31, 192, 281, 286, 294, 0, 35, 250, 303, 0, 39, 61, 0, 39, 129, 0, 39, 139, 0, 39, 31, 0, 39, 111, 0, 39, 111, 175, 0, 39, 0, 46, 0, 48, 282, 61, 285, 0, 48, 282, 24, 271, 0, 48, 139, 285, 0, 48, 282, 271, 0, 55, 0, 61, 282, 286, 0, 62, 0, 72, 258, 0, 86, 231, 175, 232, 299, 0, 100, 132, 195, 279, 0, 129, 258, 0, 139, 286, 0, 140, 0, 163, 176, 0, 163, 164, 165, 176, 0, 111, 175, 0, 166, 176, 0, 167, 176, 0, 168, 176, 0, 156, 0, 39, 156, 0, 251, 0, 0, 230, 258, 203, 0, 282, 274, 252, 0, 175, 274, 252, 0, 282, 274, 195, 258, 252, 0, 175, 274, 195, 258, 252, 0, 51, 252, 0, 282, 51, 252, 0, 282, 51, 195, 258, 252, 0, 51, 195, 258, 252, 0, 0, 203, 251, 0, 254, 0, 254, 203, 253, 0, 255, 195, 258, 0, 273, 203, 255, 0, 273, 0, 273, 195, 258, 0, 258, 0, 230, 258, 0, 273, 0, 276, 0, 277, 0, 178, 0, 42, 0, 41, 0, 258, 188, 258, 0, 258, 200, 258, 0, 258, 199, 258, 0, 258, 201, 258, 0, 258, 198, 258, 0, 189, 258, 0, 258, 196, 258, 0, 258, 197, 258, 0, 258, 195, 258, 0, 258, 185, 258, 0, 258, 186, 258, 0, 258, 187, 258, 0, 258, 190, 258, 0, 258, 191, 258, 0, 258, 192, 258, 0, 258, 193, 258, 0, 258, 194, 258, 0, 191, 258, 0, 190, 258, 0, 231, 258, 232, 0, 273, 0, 231, 260, 232, 0, 0, 258, 0, 258, 203, 260, 0, 268, 203, 260, 0, 0, 258, 0, 261, 203, 261, 0, 0, 263, 0, 263, 203, 262, 0, 268, 203, 262, 0, 276, 0, 191, 276, 0, 175, 0, 0, 267, 0, 267, 203, 264, 0, 268, 203, 264, 0, 0, 266, 0, 266, 203, 265, 0, 258, 0, 195, 258, 0, 197, 258, 0, 187, 258, 0, 196, 258, 0, 186, 258, 0, 185, 258, 0, 258, 145, 258, 0, 258, 0, 258, 15, 313, 0, 0, 270, 0, 270, 203, 269, 0, 175, 0, 171, 0, 172, 0, 102, 270, 0, 273, 203, 271, 0, 273, 0, 272, 203, 272, 0, 273, 0, 274, 0, 273, 184, 275, 0, 175, 0, 175, 231, 264, 232, 0, 175, 0, 175, 231, 264, 232, 0, 172, 0, 171, 0, 170, 0, 176, 0, 169, 231, 264, 232, 0, 284, 231, 258, 203, 283, 232, 0, 0, 57, 75, 0, 57, 103, 0, 231, 280, 232, 0, 76, 16, 0, 76, 161, 0, 76, 84, 0, 110, 131, 0, 110, 36, 0, 110, 66, 0, 110, 71, 0, 279, 203, 280, 0, 279, 0, 0, 282, 0, 283, 0, 284, 0, 16, 0, 36, 0, 66, 0, 71, 0, 84, 0, 161, 0, 76, 0, 110, 0, 138, 0, 125, 0, 29, 231, 260, 232, 0, 286, 0, 285, 203, 286, 0, 175, 287, 0, 175, 287, 231, 288, 232, 0, 0, 15, 313, 0, 0, 289, 0, 288, 203, 289, 0, 290, 0, 290, 15, 313, 0, 282, 291, 293, 0, 282, 175, 291, 293, 0, 175, 291, 293, 0, 175, 175, 291, 293, 0, 0, 35, 231, 292, 232, 0, 231, 292, 232, 0, 0, 258, 0, 203, 292, 0, 258, 203, 292, 0, 0, 195, 258, 0, 0, 195, 258, 0, 296, 297, 0, 282, 0, 175, 0, 298, 0, 298, 203, 297, 0, 175, 306, 0, 175, 305, 306, 0, 300, 0, 299, 203, 300, 0, 301, 0, 296, 301, 0, 302, 0, 302, 203, 301, 0, 175, 305, 306, 0, 175, 306, 0, 304, 0, 304, 203, 303, 0, 282, 305, 306, 0, 282, 175, 305, 306, 0, 175, 305, 306, 0, 175, 175, 305, 306, 0, 231, 260, 232, 0, 0, 195, 258, 0, 0, 203, 111, 258, 307, 0, 203, 115, 307, 0, 203, 78, 230, 258, 307, 0, 203, 78, 230, 258, 40, 258, 307, 0, 203, 78, 230, 258, 64, 258, 307, 0, 203, 78, 230, 258, 70, 258, 307, 0, 203, 125, 258, 307, 0, 203, 27, 258, 307, 0, 203, 11, 258, 307, 0, 309, 0, 309, 312, 308, 0, 0, 230, 258, 0, 153, 258, 0, 230, 258, 153, 258, 0, 111, 258, 0, 27, 258, 0, 258, 0, 311, 0, 311, 312, 310, 0, 0, 230, 258, 0, 258, 0, 203, 0, 233, 0, 154, 0, 34, 0, 114, 0, 0, 315, 314, 0, 203, 101, 316, 0, 203, 5, 318, 0, 203, 3, 318, 0, 203, 112, 319, 0, 203, 113, 258, 0, 203, 52, 258, 0, 203, 160, 258, 0, 203, 143, 0, 203, 25, 0, 203, 86, 273, 0, 203, 26, 258, 0, 203, 14, 258, 0, 203, 32, 258, 0, 203, 47, 258, 0, 203, 12, 258, 0, 203, 96, 0, 203, 97, 0, 203, 134, 0, 203, 13, 258, 0, 203, 105, 78, 259, 320, 0, 203, 105, 259, 320, 0, 203, 6, 78, 259, 320, 0, 203, 88, 258, 0, 74, 317, 0, 116, 317, 0, 157, 317, 0, 130, 317, 0, 147, 317, 0, 0, 137, 0, 155, 0, 54, 0, 95, 0, 109, 0, 162, 0, 89, 0, 8, 0, 128, 0, 83, 0, 58, 0, 95, 0, 7, 0, 0, 94, 320, 0, 37, 320, 0, 21, 320, 0, 93, 320, 0, 0, 322, 0, 322, 203, 321, 0, 258, 9, 274, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, 274, 277, 278, 281, 286, 287, 290, 291, 294, 295, 297, 299, 301, 305, 306, 309, 310, 311, 314, 315, 316, 317, 318, 319, 322, 325, 328, 331, 334, 336, 339, 342, 347, 348, 350, 351, 353, 355, 357, 358, 359, 361, 363, 364, 366, 368, 370, 372, 375, 378, 379, 381, 382, 384, 385, 386, 388, 390, 392, 395, 396, 398, 399, 400, 402, 403, 405, 408, 411, 413, 414, 415, 418, 420, 422, 424, 426, 428, 430, 433, 434, 436, 437, 438, 439, 441, 442, 444, 445, 446, 447, 448, 449, 450, 451, 453, 454, 456, 457, 460, 461, 462, 464, 465, 466, 468, 470, 472, 474, 475, 477, 479, 481, 483, 485, 487, 488, 489, 493, 497, 500, 502, 503, 504, 505, 506, 508, 510, 511, 512, 513, 514, 516, 517, 518, 519, 520, 521, 523, 526, 527, 530, 532, 534, 538, 542, 543, 545, 548, 552, 553, 556, 557, 561, 565, 567, 571, 575, 576, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 604, 606, 609, 610, 613, 614, 615, 617, 621, 622, 623, 627, 628, 629, 631, 635, 636, 638, 641, 642, 643, 645, 649, 650, 651, 655, 656, 657, 659, 661, 663, 665, 667, 670, 671, 675, 678, 679, 683, 684, 685, 686, 689, 691, 694, 696, 699, 700, 703, 704, 713, 714, 724, 725, 726, 727, 730, 732, 738, 739, 740, 743, 744, 746, 748, 750, 752, 754, 756, 760, 761, 764, 765, 768, 769, 772, 773, 774, 775, 776, 777, 780, 781, 782, 783, 784, 788, 789, 793, 794, 799, 800, 803, 804, 805, 809, 810, 813, 814, 816, 818, 822, 823, 825, 829, 830, 831, 833, 837, 838, 841, 842, 846, 849, 850, 853, 854, 858, 859, 862, 863, 867, 868, 871, 872, 876, 877, 880, 881, 885, 886, 887, 888, 893, 896, 897, 900, 901, 905, 907, 910, 914, 918, 922, 924, 926, 930, 931, 934, 935, 936, 937, 941, 943, 944, 947, 948, 951, 952, 953, 956, 957, 960, 961, 962, 965, 966, 969, 971, 973, 975, 977, 979, 981, 983, 984, 985, 987, 989, 991, 993, 995, 997, 998, 999, 1000, 1002, 1004, 1006, 1008, 1012, 1013, 1014, 1015, 1016, 1019, 1020, 1021, 1022, 1025, 1026, 1027, 1028, 1029, 1030, 1033, 1034, 1035, 1036, 1039, 1040, 1041, 1042, 1043, 1046, 1047, 1048, 1052 }; static const char * const yytname[] = { "$","error","$illegal.","BAS_S_ACCESS", "BAS_S_ACTIVE","BAS_S_ALLOW","BAS_S_ALTERNATE","BAS_S_ANY","BAS_S_APPEND","BAS_S_AS", "BAS_S_BACK","BAS_S_BLOCK","BAS_S_BLOCKSIZE","BAS_S_BUCKETSIZE","BAS_S_BUFFER", "BAS_S_BY","BAS_S_BYTE","BAS_S_CALL","BAS_S_CASE","BAS_S_CHAIN","BAS_S_CHANGE", "BAS_S_CHANGES","BAS_S_CLOSE","BAS_S_COMMON","BAS_S_CONSTANT","BAS_S_CONTIGUOUS", "BAS_S_CONNECT","BAS_S_COUNT","BAS_S_DATA","BAS_S_DECIMAL","BAS_S_DECLARE","BAS_S_DEF", "BAS_S_DEFAULTNAME","BAS_S_DELETE","BAS_S_DESC","BAS_S_DIM","BAS_S_DOUBLE","BAS_S_DUPLICATES", "BAS_S_ELSE","BAS_S_END","BAS_S_EQ","BAS_S_ERL","BAS_S_ERR","BAS_S_ERROR","BAS_S_EXIT", "BAS_S_EXPLICIT","BAS_S_EXTEND","BAS_S_EXTENDSIZE","BAS_S_EXTERNAL","BAS_S_FIELD", "BAS_S_FILE","BAS_S_FILL","BAS_S_FILESIZE","BAS_S_FIND","BAS_S_FIXED","BAS_S_FNEND", "BAS_S_FNEXIT","BAS_S_FOR","BAS_S_FORTRAN","BAS_S_FREE","BAS_S_FROM","BAS_S_FUNCTION", "BAS_S_FUNCTIONEND","BAS_S_FUNCTIONEXIT","BAS_S_GE","BAS_S_GET","BAS_S_GFLOAT", "BAS_S_GO","BAS_S_GOSUB","BAS_S_GOTO","BAS_S_GT","BAS_S_HFLOAT","BAS_S_IF","BAS_S_INACTIVE", "BAS_S_INDEXED","BAS_S_INPUT","BAS_S_INTEGER","BAS_S_ITERATE","BAS_S_KEY","BAS_S_KILL", "BAS_S_LET","BAS_S_LINE","BAS_S_LINPUT","BAS_S_LIST","BAS_S_LONG","BAS_S_LSET", "BAS_S_MAP","BAS_S_MARGIN","BAS_S_MODE","BAS_S_MODIFY","BAS_S_MOVE","BAS_S_NAME", "BAS_S_NEXT","BAS_S_NOCHANGES","BAS_S_NODUPLICATES","BAS_S_NONE","BAS_S_NOREWIND", "BAS_S_NOSPAN","BAS_S_ON","BAS_S_OPEN","BAS_S_OPTION","BAS_S_ORGANIZATION","BAS_S_OTHERWISE", "BAS_S_OUTPUT","BAS_S_OVERFLOW","BAS_S_PRIMARY","BAS_S_PRINT","BAS_S_PUT","BAS_S_RANDOM", "BAS_S_READ","BAS_S_REAL","BAS_S_RECORD","BAS_S_RECORDTYPE","BAS_S_RECORDSIZE", "BAS_S_REF","BAS_S_REGARDLESS","BAS_S_RELATIVE","BAS_S_REMAP","BAS_S_REMARK", "BAS_S_REMARKLINE","BAS_S_RESTORE","BAS_S_RESET","BAS_S_RESUME","BAS_S_RETURN", "BAS_S_REWIND","BAS_S_RFA","BAS_S_ROUNDING","BAS_S_RSET","BAS_S_SCRATCH","BAS_S_SELECT", "BAS_S_SEQUENTIAL","BAS_S_SINGLE","BAS_S_SIZE","BAS_S_SLEEP","BAS_S_SPAN","BAS_S_STEP", "BAS_S_STOP","BAS_S_STREAM","BAS_S_STRING","BAS_S_SUB","BAS_S_SUBEND","BAS_S_SUBEXIT", "BAS_S_SUBSCRIPT","BAS_S_TEMPORARY","BAS_S_THEN","BAS_S_TO","BAS_S_TYPE","BAS_S_UNDEFINED", "BAS_S_UNLESS","BAS_S_UNLOCK","BAS_S_UNTIL","BAS_S_UPDATE","BAS_S_USEROPEN", "BAS_S_USING","BAS_S_VALUE","BAS_S_VARIABLE","BAS_S_VARIANT","BAS_S_VIRTUAL", "BAS_S_WAIT","BAS_S_WHILE","BAS_S_WINDOWSIZE","BAS_S_WORD","BAS_S_WRITE","BAS_P_INCLUDE", "BAS_P_FROM","BAS_P_CDD","BAS_P_TITLE","BAS_P_SBTTL","BAS_P_IDENT","BAS_V_FUNCTION", "BAS_V_FLOAT","BAS_V_INTEGER","BAS_V_INT","BAS_V_LABEL","BAS_V_USELABEL","BAS_V_NAME", "BAS_V_TEXTSTRING","BAS_V_RMSRECORD","BAS_V_PREDEF","BAS_X_UNARYLT","BAS_X_UNARYLE", "BAS_X_UNARYGT","BAS_X_UNARYGE","BAS_X_UNARYNEQ","BAS_X_STRREF","BAS_X_NEQ", "BAS_X_GE","BAS_X_LE","BAS_S_EQV","BAS_S_NOT","'+'","'-'","'*'","'/'","'^'", "'='","'>'","'<'","BAS_S_AND","BAS_S_OR","BAS_S_IMP","BAS_S_XOR","UMINUS","','", "BAS_N_UMINUS","BAS_N_UPLUS","BAS_N_ASSIGN","BAS_N_FORASSIGN","BAS_N_ASSIGNLIST", "BAS_N_LIST","BAS_N_ENDIF","BAS_N_ONGOTO","BAS_N_ONGOSUB","BAS_N_ONERROR","BAS_N_ENDSELECT", "BAS_N_ENDRECORD","BAS_N_EXTERNALFUNCTION","BAS_N_EXTERNALSUB","BAS_N_EXTERNALCONSTANT", "BAS_N_FORUNTIL","BAS_N_FORWHILE","BAS_N_CASEELSE","BAS_N_NULL","BAS_N_VARTYPE", "BAS_N_ENDVARIANT","BAS_N_RECORD","BAS_N_STRUCTNAME","BAS_N_TYPEFUN","'\\n'", "'\\\\'","'#'","'('","')'","';'","program","doprogram","nline","linenum","label", "statement","statementw","statementx","stmtmodlist","ifmod","unlessmod","whilemod", "untilmod","formod","stmtmod","stmtnomod","opchan","vardef","morevartype","assignlist", "assignment","aslist","forassignment","chexpression","expression","prenexprlist", "exprlist","closelist","datalist","dataitem","paramlist","caseexprlist","caseexpression", "expressionx","nullexpr","linelist","lineno","variablelist","readlist","variable", "variablex","variabley","constant","function","optfor","optiontype","optionlist", "optvartype","vartype","vartypeone","vartypetwo","fundeflist","fundef","funby", "funparlist","funpar","funpara","fundim","fundimcom","funsiz","funequ","declarelist", "needvartype","varnamelist","varname","maplist","maplistone","mapnamelist","mapname", "dimdeflist","dimdef","dimdim","dimsz","getclause","optprint","optprint1","optinput", "optinput1","hemisemi","tranmech","openlist","openitem","orgclause","orgtype", "allowtype","recordtype","dupcha","fieldlist","fielditem","" }; #endif static const short yyr1[] = { 0, 234, 235, 235, 236, 237, 237, 238, 238, 239, 239, 239, 239, 239, 240, 240, 241, 241, 241, 242, 242, 242, 242, 242, 242, 243, 244, 245, 246, 247, 247, 247, 247, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 250, 250, 251, 251, 251, 251, 251, 251, 251, 251, 252, 252, 253, 253, 254, 255, 255, 256, 257, 257, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 259, 259, 260, 260, 260, 260, 261, 261, 261, 262, 262, 262, 262, 263, 263, 263, 264, 264, 264, 264, 265, 265, 265, 266, 266, 266, 266, 266, 266, 266, 266, 267, 267, 268, 269, 269, 270, 270, 270, 270, 271, 271, 272, 272, 273, 273, 274, 274, 275, 275, 276, 276, 276, 276, 277, 277, 278, 278, 278, 279, 279, 279, 279, 279, 279, 279, 279, 280, 280, 281, 281, 282, 282, 283, 283, 283, 283, 283, 283, 284, 284, 284, 284, 284, 285, 285, 286, 286, 287, 287, 288, 288, 288, 289, 289, 290, 290, 290, 290, 291, 291, 291, 292, 292, 292, 292, 293, 293, 294, 294, 295, 296, 296, 297, 297, 298, 298, 299, 299, 300, 300, 301, 301, 302, 302, 303, 303, 304, 304, 304, 304, 305, 306, 306, 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, 308, 308, 309, 309, 309, 309, 309, 309, 309, 310, 310, 311, 311, 311, 312, 312, 313, 313, 313, 314, 314, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, 316, 316, 316, 316, 316, 317, 317, 317, 317, 318, 318, 318, 318, 318, 318, 319, 319, 319, 319, 320, 320, 320, 320, 320, 321, 321, 321, 322 }; static const short yyr2[] = { 0, 1, 0, 2, 4, 0, 1, 0, 1, 1, 3, 3, 3, 3, 1, 1, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 6, 4, 4, 1, 2, 2, 4, 4, 3, 2, 3, 2, 2, 2, 5, 4, 4, 6, 4, 4, 1, 3, 1, 4, 2, 2, 3, 3, 2, 3, 1, 2, 2, 2, 2, 2, 5, 6, 6, 4, 1, 2, 5, 4, 4, 4, 5, 4, 5, 7, 2, 4, 1, 2, 1, 4, 1, 4, 1, 2, 1, 2, 2, 1, 1, 3, 2, 3, 2, 2, 2, 1, 5, 2, 2, 4, 4, 4, 5, 3, 2, 2, 2, 2, 2, 3, 1, 1, 4, 4, 3, 3, 1, 3, 1, 2, 5, 4, 2, 2, 1, 2, 4, 2, 2, 2, 2, 1, 2, 1, 0, 3, 3, 3, 5, 5, 2, 3, 5, 4, 0, 2, 1, 3, 3, 3, 1, 3, 1, 2, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 1, 3, 0, 1, 3, 3, 0, 1, 3, 0, 1, 3, 3, 1, 2, 1, 0, 1, 3, 3, 0, 1, 3, 1, 2, 2, 2, 2, 2, 2, 3, 1, 3, 0, 1, 3, 1, 1, 1, 2, 3, 1, 3, 1, 1, 3, 1, 4, 1, 4, 1, 1, 1, 1, 4, 6, 0, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 3, 2, 5, 0, 2, 0, 1, 3, 1, 3, 3, 4, 3, 4, 0, 4, 3, 0, 1, 2, 3, 0, 2, 0, 2, 2, 1, 1, 1, 3, 2, 3, 1, 3, 1, 2, 1, 3, 3, 2, 1, 3, 3, 4, 3, 4, 3, 0, 2, 0, 4, 3, 5, 7, 7, 7, 4, 4, 4, 1, 3, 0, 2, 2, 4, 2, 2, 1, 1, 3, 0, 2, 1, 1, 1, 1, 1, 1, 0, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 2, 2, 2, 3, 5, 4, 5, 3, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 0, 1, 3, 3 }; static const short yydefact[] = { 5, 6, 1, 5, 7, 3, 8, 16, 259, 0, 206, 0, 0, 192, 0, 195, 0, 0, 255, 0, 140, 260, 116, 0, 117, 0, 0, 150, 0, 122, 50, 0, 0, 0, 124, 52, 0, 261, 0, 0, 0, 262, 0, 341, 265, 60, 0, 0, 341, 263, 0, 0, 0, 0, 0, 70, 0, 0, 0, 332, 0, 82, 0, 266, 0, 86, 84, 88, 90, 268, 0, 0, 0, 93, 267, 0, 130, 94, 0, 0, 0, 137, 0, 0, 264, 0, 0, 0, 0, 232, 101, 0, 9, 18, 19, 17, 139, 33, 0, 156, 230, 0, 257, 258, 232, 34, 165, 164, 0, 238, 237, 236, 239, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 209, 100, 207, 160, 161, 162, 0, 35, 0, 192, 193, 39, 0, 201, 0, 103, 196, 0, 199, 188, 298, 297, 104, 0, 255, 0, 256, 0, 0, 0, 113, 110, 114, 111, 112, 138, 41, 0, 42, 223, 224, 222, 43, 0, 0, 0, 0, 0, 146, 0, 0, 0, 0, 0, 0, 0, 0, 54, 55, 125, 341, 0, 343, 58, 339, 61, 62, 63, 64, 65, 0, 0, 0, 0, 0, 71, 0, 0, 242, 0, 0, 0, 0, 0, 338, 80, 330, 0, 83, 229, 133, 0, 0, 89, 91, 128, 92, 274, 129, 0, 96, 0, 98, 99, 0, 131, 134, 135, 136, 202, 150, 16, 16, 16, 4, 16, 0, 0, 0, 0, 0, 20, 21, 23, 24, 22, 0, 0, 0, 150, 150, 202, 215, 214, 212, 171, 184, 183, 210, 213, 211, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 206, 0, 0, 0, 38, 192, 0, 200, 195, 195, 189, 0, 0, 0, 0, 318, 296, 299, 0, 294, 40, 0, 0, 0, 109, 311, 115, 225, 120, 270, 0, 0, 121, 227, 0, 150, 0, 151, 320, 0, 0, 0, 0, 51, 123, 320, 56, 57, 59, 342, 344, 345, 341, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 337, 336, 334, 333, 332, 320, 0, 320, 320, 0, 272, 95, 97, 0, 217, 0, 203, 0, 0, 143, 15, 12, 14, 11, 13, 10, 0, 25, 26, 28, 27, 154, 234, 231, 155, 0, 147, 0, 142, 0, 185, 216, 175, 176, 177, 166, 178, 179, 180, 181, 182, 174, 172, 173, 170, 168, 167, 169, 208, 0, 36, 37, 194, 276, 197, 198, 188, 269, 188, 105, 152, 106, 0, 188, 318, 301, 0, 294, 0, 107, 141, 0, 318, 0, 318, 0, 0, 119, 118, 0, 398, 149, 0, 45, 46, 48, 49, 157, 53, 340, 0, 0, 0, 0, 69, 74, 0, 73, 0, 0, 77, 220, 75, 243, 244, 0, 0, 0, 0, 127, 0, 331, 81, 228, 87, 85, 347, 348, 346, 275, 276, 132, 0, 233, 202, 202, 150, 0, 0, 0, 202, 150, 150, 240, 0, 285, 285, 102, 277, 279, 190, 191, 0, 319, 0, 302, 300, 108, 295, 318, 315, 318, 313, 312, 271, 226, 0, 44, 399, 0, 0, 0, 0, 320, 0, 0, 318, 297, 0, 126, 303, 305, 307, 66, 0, 0, 72, 78, 76, 0, 0, 246, 248, 247, 250, 251, 252, 249, 254, 0, 335, 0, 218, 204, 205, 145, 29, 31, 32, 0, 148, 144, 0, 0, 285, 288, 292, 285, 292, 0, 0, 153, 317, 316, 314, 0, 398, 320, 320, 0, 320, 322, 320, 47, 318, 310, 318, 306, 0, 0, 68, 67, 221, 0, 349, 158, 0, 245, 273, 0, 235, 241, 288, 292, 288, 289, 0, 0, 283, 292, 281, 278, 280, 401, 400, 329, 328, 320, 321, 327, 309, 304, 308, 159, 0, 79, 349, 253, 30, 0, 284, 290, 288, 287, 293, 282, 0, 0, 0, 323, 0, 0, 0, 0, 0, 0, 359, 0, 0, 0, 0, 0, 0, 366, 367, 0, 0, 0, 0, 368, 358, 0, 350, 286, 291, 320, 320, 320, 387, 386, 383, 384, 388, 385, 353, 352, 0, 365, 369, 362, 361, 363, 364, 356, 360, 373, 379, 379, 379, 379, 379, 351, 0, 188, 393, 186, 392, 390, 389, 391, 354, 355, 357, 324, 325, 326, 393, 382, 380, 381, 374, 375, 377, 378, 376, 393, 0, 393, 393, 393, 393, 371, 372, 370, 187, 396, 395, 397, 394, 0, 0, 0 }; static const short yydefgoto[] = { 728, 2, 3, 4, 7, 91, 370, 371, 93, 245, 246, 247, 248, 249, 94, 95, 153, 96, 172, 418, 97, 98, 174, 593, 293, 693, 294, 135, 139, 140, 364, 125, 126, 365, 295, 459, 460, 315, 212, 127, 100, 382, 128, 129, 347, 547, 548, 149, 101, 102, 130, 311, 312, 359, 496, 497, 498, 565, 605, 607, 428, 146, 527, 299, 300, 528, 529, 530, 531, 307, 308, 583, 584, 442, 209, 210, 187, 188, 335, 478, 624, 625, 690, 709, 673, 699, 720, 516, 517 }; static const short yypact[] = { 5, -32768,-32768, 5, -105,-32768,-32768, 884,-32768, -103, 938, 1300, 1300, 1036, -54, 266, -52, 1428, 1426, -8, -6, -32768, 353, -20,-32768, 1618, -4, -28, 37,-32768,-32768, -103, 40, 1645,-32768,-32768, 44,-32768, 55, 21, 21, -32768, 1300, 1012,-32768, 21, 1300, -103, 1060,-32768, -103, -16, 46, -11, 1300, -103, 1123, 1300, 112, 309, 47, -32768, -103,-32768, 86, 50, 67, 21,-32768,-32768, -103, 1300, 1300,-32768,-32768, 126,-32768,-32768, 94, 1300, 102, -32768, 1300, 1300,-32768, -93, 141, 157, 158, -123,-32768, -30,-32768, 125,-32768,-32768,-32768,-32768, 144, -97,-32768, -1,-32768,-32768, 113, 162,-32768,-32768, 118,-32768,-32768, -32768,-32768,-32768, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1710,-32768, 178, 162,-32768,-32768, 155, 1649, 1729, 1300, 1977, 188, 172,-32768, 207,-32768, 220, 232,-32768, 1199,-32768, 52,-32768, 257, 1645, 126,-32768, 1300, 1300, 1497,-32768,-32768, 269,-32768,-32768,-32768,-32768, 21,-32768,-32768,-32768,-32768,-32768, 126, 14, 1300, 1300, 1445,-32768, 1300, 119, -48, 1300, 126, 1300, 21, 21, -32768,-32768, 1977, 1060, 1300, 1977,-32768, -138,-32768, 1977, -32768,-32768,-32768, 270, 1300, 222, 225, 202, 162, 59, 1631, 1086, 261, 1300, 1300, 1300, 1300, 1977,-32768, -138, 1300, 256, 162,-32768, 1300, 1300,-32768,-32768, 1977, 1977, 445,-32768, 1300, 1977, 1300, 1977, 1977, 300,-32768,-32768, -32768,-32768, 1199, 39, 723, 723, 884,-32768, 884, -103, 1300, 1300, 1300, 1300,-32768,-32768,-32768,-32768,-32768, 1300, 291, -103, 84, 116, 1199, 1977, 1977, 1977,-32768,-32768, -32768, 1977, 1977, 1977, 1763, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 938, 1300, 1300, 1300, 188, 1300, 235,-32768, 266, 266, 1780, 236, 267, -103, 126, -114,-32768, 271, 126, 280, 1977, 1806, -116, -109,-32768, 273,-32768,-32768, 287,-32768, -103, 126,-32768, -72, 1825, 1844, -103,-32768, 1863, 1300, 1300, 1300, 1300, 1977,-32768, 1863,-32768,-32768, -32768, 1977,-32768,-32768, 1060, 251, 1882, 1300, 1300, 1300, 0, 21, 78, 21, 21, -13, 484, -59, 1977, 1977, 1977, 1746, 309, 1863, -103, 1863, 1863, 10, 264, 1977, 1977, 327, 367, 272, 302, 307, 1300,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 168, 1977, 1977, 1977, 1977, 1977, 281,-32768,-32768, 1300,-32768, 1300,-32768, 279,-32768, 1977, 391, 391, 391, 391, 335, 335, 347, 347, 347, 250, 250, 250,-32768,-32768,-32768,-32768,-32768, 1901, 1977, 1977, -32768, 1501,-32768,-32768, 1199,-32768, 1199,-32768, 310, 287, 1300, 1199, 320,-32768, 257, 280, 1300,-32768,-32768, 285, 320, 285, 320, 1497, 126,-32768, 287, -103, 1300,-32768, 210,-32768, 1666, 1977, 1977, 1977,-32768,-32768, 1572, 1300, 1920, 1939, 1977,-32768, 21,-32768, 21, 21,-32768, 314, -32768,-32768,-32768, 469, 23, 18, -59,-32768, 1300,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1501,-32768, 10,-32768, 1199, 1199, 1844, 1300, 1300, 1300, 1199, 1844, 1844,-32768, 20, -19, -12, 317,-32768, 506,-32768,-32768, -103, 1977, 290,-32768,-32768,-32768, 1977, 320,-32768, 320, -32768,-32768,-32768,-32768, 509,-32768, 321, 1300, 1300, 293, 1300, 322, 1300, 1300, -128,-32768, 363, 346,-32768,-32768, 348, 1977, 1300, 1300,-32768,-32768,-32768, 21, 1228,-32768, -32768,-32768,-32768,-32768,-32768,-32768, 366, 318, 1977, -139, -32768,-32768,-32768,-32768, 1685, 1977, 1977, 340,-32768,-32768, 361, 364, -15, 1276, 383, -15, 383, 1501, 10,-32768, -32768,-32768,-32768, -103, 1300, 1863, 1863, 1300, 1863,-32768, 1863, 1977, 320,-32768, -114,-32768, 1572, 363, 1977, 1977, -32768, 1300, 376, 1977, -59,-32768,-32768, 1300,-32768,-32768, 1276, 383, 1276, 1958, 362, 1300,-32768, 383,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 437,-32768,-32768,-32768,-32768, -32768, 1977, 1639,-32768, 376,-32768, 1977, 365,-32768,-32768, 1276,-32768, 1977,-32768, 1300, 1300, 1300,-32768, 344, 344, 520, 1300, 1300, 1300,-32768, 1300, 1300, 1300, 1300, -103, 1300,-32768,-32768, 169, -43, 95, 1300,-32768,-32768, 1300, -32768,-32768,-32768, 1863, 1863, 1863,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, -106, 1977, 1977, 1977, 1977, 1977, 1977, 1977, 162, 1977, 31, 31, 31, 31, 31,-32768, -106, 1199, 229, 162,-32768,-32768,-32768,-32768,-32768, 1977, 1977,-32768,-32768,-32768, 229,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 229, 368, 229, 229, 229, 229,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768, 601, 602,-32768 }; static const short yypgoto[] = {-32768, 600,-32768,-32768,-32768,-32768, 371, 15,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, 433, -176, 108, -38, 360, 373,-32768, 87, -595, -411, -115, 4,-32768, -248, 331,-32768,-32768, 13, -320, 34, -267, 260, -7, -88, -32768, 16,-32768,-32768, 268, 22, 470, 9, 146, 12, -187, -61,-32768, 140, 73,-32768, -304, -348, -497, 216, -32768, 627, 221,-32768,-32768, 58, -494,-32768, 213,-32768, -245, -283, -236, 296,-32768, -45,-32768, 440, -460, 27, -32768,-32768, -281, 17,-32768, -301, 79,-32768 }; #define YYLAST 2178 static const short yytable[] = { 99, 234, 105, 192, 499, -2, 500, 388, 235, 191, 454, 503, 193, 254, 222, 424, 562, 465, 287, 103, 562, 551, 92, 562, 175, 461, 145, 150, 141, 103, 103, 142, 218, 586, 168, 691, 8, 103, 313, 540, 99, 160, 177, 99, 475, 103, 436, -298, 199, 196, 253, 466, 104, 423, 543, 213, 21, 166, 368, 430, 431, 433, 462, 99, 568, 333, 432, 421, 6, 104, 609, 228, 104, 181, 182, 314, 296, 385, 387, 189, 705, 421, 161, 229, 544, 706, 37, 251, 302, 545, 463, 41, 447, 597, 621, 334, 714, 124, 131, 132, 134, 217, 695, 422, 49, 629, 252, 541, 233, 611, 420, 634, 251, 297, 236, 422, 327, 422, 471, 162, 473, 474, 422, 161, 476, 692, 341, 437, 342, 183, 186, 438, 104, 190, 197, 186, 251, 536, 537, 331, 504, 198, 440, 201, 202, 455, 208, 325, 509, 546, 511, 163, 164, 696, 290, 165, 563, 150, 219, 220, 103, 316, 306, 566, 477, 103, 224, 170, 707, 226, 227, 514, 467, 411, 104, 171, 1, 136, 697, 143, 237, 84, 240, 103, 542, 508, 708, 510, 692, 104, 698, 567, 163, 164, 179, 310, 165, 241, 238, 239, 180, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 340, 564, 329, 330, 194, 564, 457, 591, 564, 134, 518, 151, 458, 152, 572, 169, 573, 99, 99, 99, 234, 99, 175, 367, 552, 553, 519, 303, 304, 426, 558, 171, 685, 203, 99, 366, 103, 103, 103, 716, 103, 373, 628, 374, 630, 317, 318, 419, 602, 321, 214, 608, 326, 322, 328, 717, 173, 366, 323, 176, 186, 332, 242, 178, 243, 195, 211, 324, 384, 215, 715, 337, 663, 244, 686, 580, 171, 520, 99, 448, 349, 350, 351, 352, 413, 414, 216, 354, 687, 619, 221, 356, 357, 141, 141, 316, 142, 142, 554, 360, 386, 361, 486, 559, 560, 688, 230, 487, 171, 363, 521, 718, 719, 223, 522, 689, 488, 376, 377, 378, 379, 225, 231, 232, 523, 204, 380, 16, 250, 614, 615, 363, 617, 233, 618, 251, 289, 213, 255, 106, 107, 667, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 124, 408, 409, 410, 513, 134, 456, 109, 110, 111, 638, 283, 481, 112, 154, 44, 284, 267, 268, 269, 270, 288, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 721, 710, 711, 712, 713, 443, 444, 445, 446, 722, 155, 724, 725, 726, 727, 63, 205, 495, 186, 291, 103, 451, 452, 453, 702, 703, 704, 316, 298, 668, 69, 292, 109, 110, 111, 669, 208, 137, 112, 306, 309, 336, 103, 74, 279, 280, 281, 282, 338, 670, 485, 339, 348, 138, 526, 355, 358, 103, 206, 419, 156, 362, 381, 412, 416, -219, 417, 490, 671, 491, 425, 427, 434, 635, 108, 109, 110, 111, 157, 449, 104, 112, 612, 113, 495, 535, 435, 103, 158, 464, 99, 479, 366, 366, 117, 118, 119, 636, 366, 480, 482, 483, 672, 637, 502, 159, 484, 492, 489, 501, 507, 421, 422, 538, 574, 539, 568, 569, 571, 578, 575, 441, 515, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 532, 585, 207, 123, 275, 276, 277, 278, 279, 280, 281, 282, 587, 596, 588, 267, 268, 269, 270, 549, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 595, 363, 363, 599, 555, 556, 557, 363, 495, 606, 623, 103, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 600, 632, 601, 526, 662, 675, 103, 723, 729, 730, 5, 320, 576, 577, 372, 579, 570, 581, 582, 383, 375, 407, 472, 468, 626, 301, 550, 589, 590, 267, 268, 269, 270, 594, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 561, 441, 610, 506, 683, 147, 620, 505, 512, 694, 470, 353, 604, 661, 0, 613, 0, 0, 674, 0, 0, 0, 0, 515, 0, 0, 616, 0, 0, 694, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 622, 0, 0, 0, 0, 694, 627, 0, 0, 604, 0, 604, 0, 0, 633, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 0, 0, 0, 0, 0, 0, 604, 0, 0, 0, 664, 665, 666, 0, 0, 0, 0, 676, 677, 678, 0, 679, 680, 681, 682, 0, 684, 8, 9, 10, 11, 12, 700, 13, 14, 701, 0, 0, 0, 15, 16, 17, 18, 0, 19, 0, 20, 21, 0, 0, 22, 0, 0, 0, 0, 23, 0, 24, 0, 25, 26, 0, 27, 0, 28, 0, 29, 30, 31, 0, 32, 0, 33, 34, 35, 0, 36, 37, 38, 39, 40, 0, 41, 42, 0, 0, 43, 44, 45, 0, 46, 47, 0, 48, 0, 49, 50, 51, 52, 0, 0, 53, 54, 55, 0, 0, 0, 0, 0, 56, 57, 58, 0, 0, 0, 0, 0, 59, 60, 61, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, 67, 68, 0, 69, 0, 70, 0, 71, 0, 0, 0, 72, 0, 0, 73, 0, 74, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 78, 79, 80, 0, 0, 0, 0, 81, 0, 82, 83, 0, 84, 0, 85, 0, 0, 86, 87, 88, 0, 0, 369, 0, 0, 0, 89, 0, 8, 9, 10, 11, 12, 0, 13, 14, 0, 0, 0, 0, 15, 16, 17, 18, 0, 19, 0, 20, 21, 0, 0, 22, 0, 0, 0, 0, 23, 0, 24, 0, 25, 26, 0, 27, 0, 28, 0, 29, 30, 31, 0, 32, 90, 33, 34, 35, 0, 36, 37, 38, 39, 40, 0, 41, 42, 0, 0, 43, 44, 45, 0, 46, 47, 0, 48, 16, 49, 50, 51, 52, 0, 0, 53, 54, 55, 0, 0, 106, 107, 0, 56, 57, 58, 0, 0, 0, 0, 0, 59, 60, 61, 62, 63, 64, 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, 67, 68, 0, 69, 0, 70, 0, 71, 44, 0, 0, 72, 0, 0, 73, 0, 74, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 78, 79, 80, 0, 0, 0, 0, 81, 16, 82, 83, 0, 84, 0, 85, 63, 0, 86, 87, 88, 106, 107, 0, 0, 0, 0, 89, 0, 0, 0, 69, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, 106, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 16, 0, 0, 0, 184, 0, 0, 0, 0, 0, 0, 0, 106, 107, 0, 0, 90, 0, 108, 109, 110, 111, 0, 44, 104, 112, 0, 113, 0, 0, 0, 0, 0, 63, 114, 115, 116, 0, 117, 118, 119, 0, 0, 0, 120, 121, 122, 44, 69, 0, 0, 0, 0, 0, 346, 0, 0, 63, 0, 0, 0, 74, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 106, 107, 200, 0, 0, 123, 63, 0, 0, 0, 74, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 69, 0, 104, 112, 0, 113, 0, 0, 0, 0, 0, 0, 0, 74, 44, 0, 117, 118, 119, 0, 108, 109, 110, 111, 0, 0, 104, 112, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, 16, 108, 109, 110, 111, 63, 0, 104, 112, 0, 113, 0, 106, 107, 185, 123, 0, 0, 0, 0, 69, 117, 118, 119, 0, 0, 0, 0, 0, 16, 0, 0, 0, 74, 0, 0, 0, 0, 133, 123, 0, 106, 107, 267, 268, 269, 270, 44, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 0, 185, 123, 108, 109, 110, 111, 0, 0, 104, 112, 0, 113, 0, 0, 44, 16, 0, 0, 0, 63, 0, 0, 117, 118, 119, 0, 0, 106, 107, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 74, 63, 0, 0, 106, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 69, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74, 0, 108, 109, 110, 111, 0, 0, 104, 112, 44, 113, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 117, 118, 119, 0, 0, 0, 0, 0, 0, 108, 109, 110, 111, 69, -219, 104, 112, 0, 113, 0, 0, 0, 63, 0, 0, 0, 74, 0, 0, 117, 118, 119, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 123, 0, 0, 0, 0, 0, 0, 0, 74, 0, 0, 0, 8, 0, 8, 108, 109, 110, 111, 0, 0, 104, 112, 0, 113, 16, 0, 16, 592, 123, 0, 8, 21, 0, 21, 117, 118, 119, 0, 108, 109, 110, 111, 0, 16, 104, 112, 0, 113, 603, 0, 21, 0, 0, 0, 0, 0, 0, 0, 117, 118, 119, 37, 0, 37, 0, 27, 41, 0, 41, 0, 0, 44, 0, 44, 0, 0, 123, 0, 0, 49, 37, 49, 8, 0, 0, 41, 8, 0, 0, 0, 44, 0, 0, 0, 0, 16, 0, 0, 49, 16, 123, 0, 21, 0, 0, 63, 21, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 69, 0, 63, 0, 0, 0, 0, 0, 0, 0, 37, 74, 0, 74, 37, 41, 0, 69, 0, 41, 44, 0, 0, 0, 44, 0, 0, 0, 49, 0, 74, 0, 49, 0, 84, 8, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 144, 0, 0, 84, 63, 21, 0, 0, 63, 0, 0, 0, 0, 0, 0, 148, 0, 319, 0, 69, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 8, 74, 0, 0, 37, 74, 0, 0, 639, 41, 640, 641, 0, 16, 44, 0, 0, 642, 643, 644, 21, 0, 49, 0, 84, 0, 0, 8, 84, 0, 645, 646, 0, 0, 0, 0, 0, 647, 305, 0, 16, 0, 494, 0, 0, 0, 0, 21, 63, 0, 37, 0, 648, 0, 0, 41, 0, 649, 0, 0, 44, 0, 0, 69, 343, 344, 345, 0, 49, 0, 0, 0, 0, 0, 0, 0, 74, 37, 0, 0, 0, 0, 41, 0, 0, 0, 0, 44, 0, 0, 0, 650, 0, 651, 63, 49, 285, 0, 0, 84, 0, 652, 653, 0, 0, 0, 654, 0, 0, 69, 655, 0, 0, 525, 0, 0, 0, 656, 657, 0, 0, 63, 74, 167, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 658, 0, 0, 0, 0, 0, 84, 0, 0, 659, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 660, 0, 524, 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 267, 268, 269, 270, 598, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 267, 268, 269, 270, 266, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 0, 267, 268, 269, 270, 286, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 0, 0, 0, 0, 0, 0, 0, 267, 268, 269, 270, 469, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 0, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 415, 0, 0, 0, 0, 0, 0, 0, 267, 268, 269, 270, 389, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 429, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 439, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 171, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 441, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 450, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 493, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 533, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 534, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 0, 631, 267, 268, 269, 270, 0, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282 }; static const short yycheck[] = { 7, 89, 9, 48, 415, 0, 417, 255, 38, 47, 10, 422, 50, 101, 75, 298, 35, 76, 133, 7, 35, 481, 7, 35, 31, 345, 17, 18, 15, 17, 18, 15, 70, 527, 25, 78, 16, 25, 24, 16, 47, 61, 33, 50, 34, 33, 313, 175, 55, 60, 51, 110, 175, 298, 36, 62, 36, 23, 234, 175, 305, 306, 75, 70, 203, 203, 175, 195, 173, 175, 567, 164, 175, 39, 40, 61, 24, 253, 254, 45, 675, 195, 102, 176, 66, 54, 66, 184, 149, 71, 103, 71, 328, 232, 588, 233, 691, 10, 11, 12, 13, 67, 7, 231, 84, 602, 203, 84, 231, 569, 297, 608, 184, 61, 144, 231, 177, 231, 354, 139, 356, 357, 231, 102, 114, 231, 67, 314, 69, 42, 43, 203, 175, 46, 145, 48, 184, 457, 458, 184, 423, 54, 318, 56, 57, 145, 59, 195, 431, 131, 433, 171, 172, 58, 138, 175, 175, 148, 71, 72, 148, 168, 153, 175, 154, 153, 79, 195, 137, 82, 83, 438, 231, 288, 175, 203, 171, 231, 83, 231, 210, 161, 57, 171, 161, 430, 155, 432, 231, 175, 95, 495, 171, 172, 139, 161, 175, 72, 228, 229, 145, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 9, 231, 179, 180, 231, 231, 139, 538, 231, 133, 11, 230, 145, 230, 508, 230, 510, 235, 236, 237, 319, 239, 240, 195, 483, 484, 27, 151, 152, 301, 489, 203, 74, 132, 252, 233, 235, 236, 237, 21, 239, 237, 601, 239, 603, 169, 170, 296, 563, 173, 175, 566, 176, 145, 178, 37, 230, 255, 150, 230, 184, 185, 148, 230, 150, 230, 230, 159, 195, 230, 692, 195, 631, 159, 116, 522, 203, 78, 296, 335, 204, 205, 206, 207, 291, 292, 230, 211, 130, 583, 175, 215, 216, 291, 292, 313, 291, 292, 485, 223, 195, 225, 145, 490, 491, 147, 176, 150, 203, 233, 111, 93, 94, 230, 115, 157, 159, 241, 242, 243, 244, 230, 176, 176, 125, 27, 250, 29, 195, 576, 577, 255, 579, 231, 581, 184, 175, 355, 231, 41, 42, 8, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 435, 288, 342, 170, 171, 172, 616, 203, 15, 176, 31, 76, 231, 185, 186, 187, 188, 203, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 705, 686, 687, 688, 689, 322, 323, 324, 325, 714, 61, 716, 717, 718, 719, 110, 111, 412, 335, 203, 412, 338, 339, 340, 664, 665, 666, 438, 175, 89, 125, 203, 170, 171, 172, 95, 353, 175, 176, 434, 175, 175, 434, 138, 198, 199, 200, 201, 230, 109, 367, 230, 195, 191, 449, 203, 15, 449, 153, 501, 111, 165, 175, 232, 232, 203, 203, 384, 128, 386, 203, 195, 203, 40, 169, 170, 171, 172, 129, 232, 175, 176, 574, 178, 479, 455, 203, 479, 139, 9, 501, 231, 483, 484, 189, 190, 191, 64, 489, 176, 232, 203, 162, 70, 421, 156, 203, 232, 231, 203, 427, 195, 231, 203, 9, 50, 203, 15, 232, 230, 203, 203, 439, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 450, 175, 230, 231, 194, 195, 196, 197, 198, 199, 200, 201, 203, 232, 203, 185, 186, 187, 188, 469, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 203, 483, 484, 232, 486, 487, 488, 489, 568, 195, 203, 568, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 232, 232, 231, 587, 232, 78, 587, 232, 0, 0, 3, 171, 518, 519, 236, 521, 501, 523, 524, 252, 240, 283, 355, 348, 595, 148, 479, 533, 534, 185, 186, 187, 188, 539, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 493, 203, 568, 426, 650, 17, 587, 425, 434, 655, 353, 210, 564, 625, -1, 575, -1, -1, 640, -1, -1, -1, -1, 575, -1, -1, 578, -1, -1, 675, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 592, -1, -1, -1, -1, 691, 598, -1, -1, 601, -1, 603, -1, -1, 606, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, -1, -1, -1, -1, -1, -1, 631, -1, -1, -1, 635, 636, 637, -1, -1, -1, -1, 642, 643, 644, -1, 646, 647, 648, 649, -1, 651, 16, 17, 18, 19, 20, 657, 22, 23, 660, -1, -1, -1, 28, 29, 30, 31, -1, 33, -1, 35, 36, -1, -1, 39, -1, -1, -1, -1, 44, -1, 46, -1, 48, 49, -1, 51, -1, 53, -1, 55, 56, 57, -1, 59, -1, 61, 62, 63, -1, 65, 66, 67, 68, 69, -1, 71, 72, -1, -1, 75, 76, 77, -1, 79, 80, -1, 82, -1, 84, 85, 86, 87, -1, -1, 90, 91, 92, -1, -1, -1, -1, -1, 98, 99, 100, -1, -1, -1, -1, -1, 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, 123, -1, 125, -1, 127, -1, 129, -1, -1, -1, 133, -1, -1, 136, -1, 138, 139, 140, 141, -1, -1, -1, -1, -1, -1, -1, 149, 150, 151, -1, -1, -1, -1, 156, -1, 158, 159, -1, 161, -1, 163, -1, -1, 166, 167, 168, -1, -1, 171, -1, -1, -1, 175, -1, 16, 17, 18, 19, 20, -1, 22, 23, -1, -1, -1, -1, 28, 29, 30, 31, -1, 33, -1, 35, 36, -1, -1, 39, -1, -1, -1, -1, 44, -1, 46, -1, 48, 49, -1, 51, -1, 53, -1, 55, 56, 57, -1, 59, 221, 61, 62, 63, -1, 65, 66, 67, 68, 69, -1, 71, 72, -1, -1, 75, 76, 77, -1, 79, 80, -1, 82, 29, 84, 85, 86, 87, -1, -1, 90, 91, 92, -1, -1, 41, 42, -1, 98, 99, 100, -1, -1, -1, -1, -1, 106, 107, 108, 109, 110, 111, -1, -1, -1, -1, -1, -1, -1, -1, 120, 121, 122, 123, -1, 125, -1, 127, -1, 129, 76, -1, -1, 133, -1, -1, 136, -1, 138, 139, 140, 141, -1, -1, -1, -1, -1, -1, -1, 149, 150, 151, -1, -1, -1, -1, 156, 29, 158, 159, -1, 161, -1, 163, 110, -1, 166, 167, 168, 41, 42, -1, -1, -1, -1, 175, -1, -1, -1, 125, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, 41, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, 76, 29, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, 41, 42, -1, -1, 221, -1, 169, 170, 171, 172, -1, 76, 175, 176, -1, 178, -1, -1, -1, -1, -1, 110, 185, 186, 187, -1, 189, 190, 191, -1, -1, -1, 195, 196, 197, 76, 125, -1, -1, -1, -1, -1, 57, -1, -1, 110, -1, -1, -1, 138, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, 41, 42, 43, -1, -1, 231, 110, -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, 169, 170, 171, 172, 125, -1, 175, 176, -1, 178, -1, -1, -1, -1, -1, -1, -1, 138, 76, -1, 189, 190, 191, -1, 169, 170, 171, 172, -1, -1, 175, 176, -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 189, 190, 191, 29, 169, 170, 171, 172, 110, -1, 175, 176, -1, 178, -1, 41, 42, 230, 231, -1, -1, -1, -1, 125, 189, 190, 191, -1, -1, -1, -1, -1, 29, -1, -1, -1, 138, -1, -1, -1, -1, 230, 231, -1, 41, 42, 185, 186, 187, 188, 76, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, -1, 230, 231, 169, 170, 171, 172, -1, -1, 175, 176, -1, 178, -1, -1, 76, 29, -1, -1, -1, 110, -1, -1, 189, 190, 191, -1, -1, 41, 42, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, 138, 110, -1, -1, 41, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, 76, 125, 231, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, 169, 170, 171, 172, -1, -1, 175, 176, 76, 178, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, 189, 190, 191, -1, -1, -1, -1, -1, -1, 169, 170, 171, 172, 125, 203, 175, 176, -1, 178, -1, -1, -1, 110, -1, -1, -1, 138, -1, -1, 189, 190, 191, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, 231, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, 16, -1, 16, 169, 170, 171, 172, -1, -1, 175, 176, -1, 178, 29, -1, 29, 230, 231, -1, 16, 36, -1, 36, 189, 190, 191, -1, 169, 170, 171, 172, -1, 29, 175, 176, -1, 178, 203, -1, 36, -1, -1, -1, -1, -1, -1, -1, 189, 190, 191, 66, -1, 66, -1, 51, 71, -1, 71, -1, -1, 76, -1, 76, -1, -1, 231, -1, -1, 84, 66, 84, 16, -1, -1, 71, 16, -1, -1, -1, 76, -1, -1, -1, -1, 29, -1, -1, 84, 29, 231, -1, 36, -1, -1, 110, 36, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, 125, -1, 110, -1, -1, -1, -1, -1, -1, -1, 66, 138, -1, 138, 66, 71, -1, 125, -1, 71, 76, -1, -1, -1, 76, -1, -1, -1, 84, -1, 138, -1, 84, -1, 161, 16, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, 175, -1, -1, 161, 110, 36, -1, -1, 110, -1, -1, -1, -1, -1, -1, 192, -1, 175, -1, 125, -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, 16, 138, -1, -1, 66, 138, -1, -1, 3, 71, 5, 6, -1, 29, 76, -1, -1, 12, 13, 14, 36, -1, 84, -1, 161, -1, -1, 16, 161, -1, 25, 26, -1, -1, -1, -1, -1, 32, 175, -1, 29, -1, 175, -1, -1, -1, -1, 36, 110, -1, 66, -1, 47, -1, -1, 71, -1, 52, -1, -1, 76, -1, -1, 125, 67, 68, 69, -1, 84, -1, -1, -1, -1, -1, -1, -1, 138, 66, -1, -1, -1, -1, 71, -1, -1, -1, -1, 76, -1, -1, -1, 86, -1, 88, 110, 84, 81, -1, -1, 161, -1, 96, 97, -1, -1, -1, 101, -1, -1, 125, 105, -1, -1, 175, -1, -1, -1, 112, 113, -1, -1, 110, 138, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, 134, -1, -1, -1, -1, -1, 161, -1, -1, 143, 138, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -1, 135, -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, 185, 186, 187, 188, 135, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 185, 186, 187, 188, 145, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, -1, 185, 186, 187, 188, 145, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, -1, -1, -1, -1, -1, -1, -1, 185, 186, 187, 188, 153, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, -1, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, -1, -1, -1, -1, -1, -1, -1, 185, 186, 187, 188, 232, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, -1, 203, 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/lib/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef alloca #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) #include #else /* not sparc */ #if defined (MSDOS) && !defined (__TURBOC__) #include #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) #include #pragma alloca #else /* not MSDOS, __TURBOC__, or _AIX */ #ifdef __hpux #ifdef __cplusplus extern "C" { void *alloca (unsigned int); }; #else /* not __cplusplus */ void *alloca (); #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc. */ #endif /* not GNU C. */ #endif /* alloca not defined. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT return(0) #define YYABORT return(1) #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 #ifndef YYPURE #define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #define YYLEX yylex(&yylval, &yylloc) #else #define YYLEX yylex(&yylval) #endif #endif /* If nonreentrant, generate the variables here */ #ifndef YYPURE int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */ #ifdef YYLSP_NEEDED YYLTYPE yylloc; /* location data for the lookahead */ /* symbol */ #endif int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* YYINITDEPTH indicates the initial size of the parser's stacks */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ int yyparse (void); #endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_bcopy (from, to, count) char *from; char *to; int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_bcopy (char *from, char *to, int count) { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif #line 184 "/usr/lib/bison.simple" int yyparse() { register int yystate; register int yyn; register short *yyssp; register YYSTYPE *yyvsp; int yyerrstatus; /* number of tokens to shift before error messages enabled */ int yychar1 = 0; /* lookahead token as an internal (translated) token number */ short yyssa[YYINITDEPTH]; /* the state stack */ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ short *yyss = yyssa; /* refer to the stacks thru separate pointers */ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif int yystacksize = YYINITDEPTH; #ifdef YYPURE int yychar; YYSTYPE yylval; int yynerrs; #ifdef YYLSP_NEEDED YYLTYPE yylloc; #endif #endif YYSTYPE yyval; /* the variable used to return */ /* semantic values from the action */ /* routines */ int yylen; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Starting parse\n"); #endif yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss - 1; yyvsp = yyvs; #ifdef YYLSP_NEEDED yylsp = yyls; #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif /* Get the current used size of the three stacks, in elements. */ int size = yyssp - yyss + 1; #ifdef yyoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yyls1, size * sizeof (*yylsp), &yystacksize); #else yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); #ifdef YYLSP_NEEDED yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); #endif #endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; #ifdef YYLSP_NEEDED yylsp = yyls + size - 1; #endif #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate); #endif goto yybackup; yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: "); #endif yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef YYPRINT YYPRINT (stderr, yychar, yylval); #endif fprintf (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /* Do the default action for the current state. */ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */ #if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 1: #line 274 "parse.y" { DoProgram(yyvsp[0]); ; break;} case 2: #line 277 "parse.y" { yyval = NULL; ; break;} case 3: #line 278 "parse.y" { yyval = yyvsp[-1]->DownLink(yyvsp[0]); ; break;} case 4: #line 281 "parse.y" { yyval = CommentList->DownLink(yyvsp[-3]->DownLink(yyvsp[-2]->DownLink(yyvsp[-1]))); CommentList = NULL; ; break;} case 5: #line 286 "parse.y" {yyval = NULL;; break;} case 6: #line 287 "parse.y" { yyvsp[0]->SetType(BAS_V_LABEL); yyval = yyvsp[0]; ; break;} case 7: #line 290 "parse.y" {yyval = NULL;; break;} case 10: #line 295 "parse.y" { delete yyvsp[-1]; yyval = yyvsp[-2]->DownLink(yyvsp[0]); ; break;} case 11: #line 297 "parse.y" { yyval = yyvsp[-2]->DownLink(yyvsp[-1]->DownLink(yyvsp[0])); ; break;} case 12: #line 299 "parse.y" { yyval = yyvsp[-2]->DownLink(yyvsp[-1]->DownLink(yyvsp[0])); ; break;} case 13: #line 301 "parse.y" { yyval = yyvsp[-2]->DownLink(yyvsp[-1]->DownLink(yyvsp[0])); ; break;} case 15: #line 306 "parse.y" { yyval = (new Node(BAS_S_GOTO, "", 0))->Link(yyvsp[0]); ; break;} case 16: #line 309 "parse.y" {yyval = NULL;; break;} case 20: #line 315 "parse.y" { yyval = yyvsp[0]->Link(NULL, NULL, NULL, yyvsp[-1]); ; break;} case 21: #line 316 "parse.y" { yyval = yyvsp[0]->Link(NULL, NULL, NULL, yyvsp[-1]); ; break;} case 22: #line 317 "parse.y" { yyval = yyvsp[0]->Link(NULL, NULL, NULL, yyvsp[-1]); ; break;} case 23: #line 318 "parse.y" { yyval = yyvsp[0]->Link(NULL, NULL, NULL, yyvsp[-1]); ; break;} case 24: #line 319 "parse.y" { yyval = yyvsp[0]->Link(NULL, NULL, NULL, yyvsp[-1]); ; break;} case 25: #line 322 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 26: #line 325 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 27: #line 328 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 28: #line 331 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 29: #line 334 "parse.y" { delete yyvsp[-1]; yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 30: #line 336 "parse.y" {delete yyvsp[-3]; delete yyvsp[-1]; yyval = yyvsp[-5]->Link(yyvsp[-4], yyvsp[-2], yyvsp[0]); ; break;} case 31: #line 339 "parse.y" { delete yyvsp[-1]; yyvsp[-3]->SetType(BAS_N_FORUNTIL); yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 32: #line 342 "parse.y" { delete yyvsp[-1]; yyvsp[-3]->SetType(BAS_N_FORWHILE); yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 34: #line 348 "parse.y" { yyvsp[0]->SetType(BAS_V_FUNCTION); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 35: #line 350 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 36: #line 351 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); delete yyvsp[-1]; ; break;} case 37: #line 353 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); delete yyvsp[-1]; ; break;} case 38: #line 355 "parse.y" {yyval = yyvsp[0]; delete yyvsp[-2]; delete yyvsp[-1]; ; break;} case 39: #line 357 "parse.y" {yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 40: #line 358 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[0]); delete yyvsp[-1]; ; break;} case 41: #line 359 "parse.y" { yyvsp[-1]->SetType(BAS_S_FUNCTIONEXIT); yyval = yyvsp[-1]; delete yyvsp[0]; ; break;} case 42: #line 361 "parse.y" { yyvsp[-1]->SetType(BAS_S_SUBEXIT); yyval = yyvsp[-1]; delete yyvsp[0]; ; break;} case 43: #line 363 "parse.y" {yyvsp[-1]->SetType(BAS_S_GOTO); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 44: #line 364 "parse.y" { yyval = yyvsp[-4]->Link(yyvsp[-2], yyvsp[0]); delete yyvsp[-3]; delete yyvsp[-1]; ; break;} case 45: #line 366 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-1], yyvsp[0]); delete yyvsp[-2]; ; break;} case 46: #line 368 "parse.y" { delete yyvsp[-1]; yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 47: #line 370 "parse.y" { delete yyvsp[-3]; delete yyvsp[-1]; yyval = yyvsp[-5]->Link(yyvsp[-4], yyvsp[-2], yyvsp[0]); ; break;} case 48: #line 372 "parse.y" { delete yyvsp[-1]; yyvsp[-3]->SetType(BAS_N_FORUNTIL); yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 49: #line 375 "parse.y" { delete yyvsp[-1]; yyvsp[-3]->SetType(BAS_N_FORWHILE); yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 51: #line 379 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[0]); delete yyvsp[-1]; ; break;} case 52: #line 381 "parse.y" { yyvsp[0]->SetType(BAS_S_FNEXIT); yyval = yyvsp[0]; ; break;} case 53: #line 382 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-1], yyvsp[0]); delete yyvsp[-2]; ; break;} case 54: #line 384 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 55: #line 385 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 56: #line 386 "parse.y" { yyvsp[-2]->SetType(BAS_S_GOSUB); yyval = yyvsp[-2]->Link(yyvsp[0]); delete yyvsp[-1]; ; break;} case 57: #line 388 "parse.y" { yyvsp[-2]->SetType(BAS_S_GOTO); yyval = yyvsp[-2]->Link(yyvsp[0]); delete yyvsp[-1]; ; break;} case 58: #line 390 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); NeedIostreamH = 1; ; break;} case 59: #line 392 "parse.y" { yyvsp[-2]->SetType(BAS_S_LINPUT); yyval = yyvsp[-2]->Link(yyvsp[0]); delete yyvsp[-1]; NeedIostreamH = 1; ; break;} case 61: #line 396 "parse.y" { yyvsp[-1]->SetType(BAS_S_GOTO); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 62: #line 398 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 63: #line 399 "parse.y" {yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 64: #line 400 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); NeedIostreamH = 1; ; break;} case 65: #line 402 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 66: #line 403 "parse.y" { yyval = yyvsp[-4]->Link(yyvsp[-2], yyvsp[0]); delete yyvsp[-3]; delete yyvsp[-1]; ; break;} case 67: #line 405 "parse.y" { yyval = yyvsp[-5]->Link(yyvsp[-2], yyvsp[0]); delete yyvsp[-4]; delete yyvsp[-3]; delete yyvsp[-1]; ; break;} case 68: #line 408 "parse.y" { yyval = yyvsp[-5]->Link(yyvsp[-2], yyvsp[0]); delete yyvsp[-4]; delete yyvsp[-3]; delete yyvsp[-1]; ; break;} case 69: #line 411 "parse.y" { delete yyvsp[-1]; yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 71: #line 414 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 72: #line 415 "parse.y" { yyvsp[-4]->SetType(BAS_N_ONERROR); yyval = yyvsp[-4]->Link(yyvsp[0]); delete yyvsp[-3]; delete yyvsp[-2]; delete yyvsp[-1]; ; break;} case 73: #line 418 "parse.y" { yyvsp[-3]->SetType(BAS_N_ONERROR); yyval = yyvsp[-3]->Link(yyvsp[0]); delete yyvsp[-2]; delete yyvsp[-1]; ; break;} case 74: #line 420 "parse.y" { yyvsp[-3]->SetType(BAS_N_ONERROR); yyval = yyvsp[-3]->Link(yyvsp[0]); delete yyvsp[-2]; delete yyvsp[-1]; ; break;} case 75: #line 422 "parse.y" { yyvsp[-3]->SetType(BAS_N_ONGOTO); yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); delete yyvsp[-1]; ; break;} case 76: #line 424 "parse.y" { yyvsp[-4]->SetType(BAS_N_ONGOTO); yyval = yyvsp[-4]->Link(yyvsp[-3], yyvsp[0]); delete yyvsp[-2]; delete yyvsp[-1]; ; break;} case 77: #line 426 "parse.y" { yyvsp[-3]->SetType(BAS_N_ONGOSUB); yyval = yyvsp[-3]->Link(yyvsp[-2], yyvsp[0]); delete yyvsp[-1]; ; break;} case 78: #line 428 "parse.y" { yyvsp[-4]->SetType(BAS_N_ONGOSUB); yyval = yyvsp[-4]->Link(yyvsp[-3], yyvsp[0]); delete yyvsp[-2]; delete yyvsp[-1]; ; break;} case 79: #line 430 "parse.y" { yyval = yyvsp[-6]->Link(yyvsp[-5], yyvsp[-4], yyvsp[-1], yyvsp[0]); delete yyvsp[-3]; delete yyvsp[-2]; ; break;} case 80: #line 433 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); NeedIostreamH = 1; ; break;} case 81: #line 434 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-1], yyvsp[0]); delete yyvsp[-2]; ; break;} case 83: #line 437 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1] ; break;} case 84: #line 438 "parse.y" { yyval = yyvsp[0]; NeedDataList = 1; ; break;} case 85: #line 439 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-1], yyvsp[0]); delete yyvsp[-2]; ; break;} case 86: #line 441 "parse.y" { yyval = yyvsp[0]; NeedDataList = 1; ; break;} case 87: #line 442 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-1], yyvsp[0]); delete yyvsp[-2]; ; break;} case 89: #line 445 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 91: #line 447 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 92: #line 448 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 95: #line 451 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[0]); delete yyvsp[-1]; ; break;} case 96: #line 453 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 97: #line 454 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[0]); delete yyvsp[-1]; ; break;} case 98: #line 456 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 99: #line 457 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 100: #line 460 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 102: #line 462 "parse.y" { delete yyvsp[-3]; delete yyvsp[-1]; yyval = yyvsp[-4]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 103: #line 464 "parse.y" { NeedDataList = 1; yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 104: #line 465 "parse.y" { yyval = yyvsp[-1]->Link(NULL, NULL, yyvsp[0]); ; break;} case 105: #line 466 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-1], yyvsp[-2], yyvsp[0]); ; break;} case 106: #line 468 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-1], yyvsp[-2], yyvsp[0]); ; break;} case 107: #line 470 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-2], NULL, yyvsp[-1], yyvsp[0]); ; break;} case 108: #line 472 "parse.y" { yyval = yyvsp[-4]->Link(yyvsp[-2], NULL, yyvsp[-1], yyvsp[0]); delete yyvsp[-3]; ; break;} case 109: #line 474 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[0], yyvsp[-1]); ; break;} case 110: #line 475 "parse.y" { yyvsp[-1]->SetType(BAS_S_FUNCTIONEND); yyval = yyvsp[-1]; delete yyvsp[0]; ; break;} case 111: #line 477 "parse.y" { yyvsp[-1]->SetType(BAS_N_ENDSELECT); delete yyvsp[0]; yyval = yyvsp[-1]; ; break;} case 112: #line 479 "parse.y" { yyvsp[-1]->SetType(BAS_S_SUBEND); delete yyvsp[0]; ; break;} case 113: #line 481 "parse.y" { yyvsp[-1]->SetType(BAS_S_FNEND); delete yyvsp[0]; ; break;} case 114: #line 483 "parse.y" {yyvsp[-1]->SetType(BAS_N_ENDRECORD); delete yyvsp[0]; yyval = yyvsp[-1]; ; break;} case 115: #line 485 "parse.y" {yyvsp[-2]->SetType(BAS_N_ENDRECORD); delete yyvsp[-1]; yyval = yyvsp[-2]; delete yyvsp[0]; ; break;} case 117: #line 488 "parse.y" { delete yyvsp[0]; yyval = NULL; ; break;} case 118: #line 489 "parse.y" { yyvsp[-3]->SetType(BAS_N_EXTERNALFUNCTION); delete yyvsp[-1]; yyval = yyvsp[-3]->Link(NULL, yyvsp[-2], yyvsp[0]); ; break;} case 119: #line 493 "parse.y" { yyvsp[-3]->SetType(BAS_N_EXTERNALCONSTANT); delete yyvsp[-1]; yyval = yyvsp[-3]->Link(NULL, yyvsp[-2], yyvsp[0]); ; break;} case 120: #line 497 "parse.y" { yyvsp[-2]->SetType(BAS_N_EXTERNALSUB); delete yyvsp[-1]; yyval = yyvsp[-2]->Link(NULL, yyvsp[0]); ; break;} case 121: #line 500 "parse.y" { yyval = yyvsp[-2]->Link(NULL, yyvsp[-1], yyvsp[0]); ; break;} case 123: #line 503 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[-1], NULL, yyvsp[0]); ; break;} case 125: #line 505 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 126: #line 506 "parse.y" { delete yyvsp[-3]; delete yyvsp[-1]; yyval = yyvsp[-4]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 127: #line 508 "parse.y" { yyval = NULL; delete yyvsp[-3]; delete yyvsp[-2]; delete yyvsp[-1]; ; break;} case 128: #line 510 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 129: #line 511 "parse.y" { yyval = yyvsp[-1]->Link(NULL, NULL, yyvsp[0]); ; break;} case 131: #line 513 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 132: #line 514 "parse.y" { delete yyvsp[-3]; delete yyvsp[-2]; yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 133: #line 516 "parse.y" { yyvsp[-1]->Link(yyvsp[0]); ; break;} case 134: #line 517 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 135: #line 518 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 136: #line 519 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 138: #line 521 "parse.y" { yyvsp[0]->SetType(BAS_N_ENDVARIANT); delete yyvsp[-1]; yyval = yyvsp[0]; ; break;} case 140: #line 526 "parse.y" { yyval = NULL; ; break;} case 141: #line 527 "parse.y" { yyval = yyvsp[-1]; delete yyvsp[-2]; delete yyvsp[0]; ; break;} case 142: #line 530 "parse.y" { yyval = (yyvsp[-2]->Link(NULL, NULL, yyvsp[-1]))->DownLink(yyvsp[0]); ; break;} case 143: #line 532 "parse.y" { yyvsp[-2]->SetType(BAS_N_VARTYPE); yyval = (yyvsp[-2]->Link(NULL, NULL, yyvsp[-1]))->DownLink(yyvsp[0]); ; break;} case 144: #line 534 "parse.y" { yyval = yyvsp[-4]->DownLink(yyvsp[-3]->Link(NULL, NULL, yyvsp[-1]))-> DownLink(yyvsp[0]); delete yyvsp[-2]; ; break;} case 145: #line 538 "parse.y" { yyvsp[-4]->SetType(BAS_N_VARTYPE); yyval = yyvsp[-4]->Link(NULL, NULL, yyvsp[-3]->Link(NULL, NULL, yyvsp[-1]))->DownLink(yyvsp[0]); delete yyvsp[-2]; ; break;} case 146: #line 542 "parse.y" { yyval = yyvsp[-1]->DownLink(yyvsp[0]); ; break;} case 147: #line 543 "parse.y" { yyval = (yyvsp[-2]->Link(NULL, NULL, yyvsp[-1]))->DownLink(yyvsp[0]); ; break;} case 148: #line 545 "parse.y" { yyval = (yyvsp[-4]->Link(NULL, NULL, yyvsp[-3]->Link(NULL, NULL, yyvsp[-1])))->DownLink(yyvsp[0]); delete yyvsp[-2]; ; break;} case 149: #line 548 "parse.y" { yyval = (yyvsp[-3]->Link(NULL, NULL, yyvsp[-1]))->DownLink(yyvsp[0]); delete yyvsp[-2]; ; break;} case 150: #line 552 "parse.y" { yyval = NULL; ; break;} case 151: #line 553 "parse.y" { delete yyvsp[-1]; yyval = yyvsp[0]; ; break;} case 153: #line 557 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 154: #line 561 "parse.y" { yyvsp[-1]->SetType(BAS_N_ASSIGN); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 155: #line 565 "parse.y" { yyvsp[-1]->SetType(BAS_N_ASSIGNLIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 157: #line 571 "parse.y" { yyvsp[-1]->SetType(BAS_N_FORASSIGN); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 159: #line 576 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 166: #line 585 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 167: #line 586 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 168: #line 587 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 169: #line 588 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 170: #line 589 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 171: #line 590 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 172: #line 591 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 173: #line 592 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 174: #line 593 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 175: #line 594 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 176: #line 595 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 177: #line 596 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 178: #line 597 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 179: #line 598 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 180: #line 599 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 181: #line 600 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 182: #line 601 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 183: #line 602 "parse.y" { yyvsp[-1]->SetType(BAS_N_UMINUS); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 184: #line 604 "parse.y" { yyvsp[-1]->SetType(BAS_N_UPLUS); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 185: #line 606 "parse.y" { delete yyvsp[0]; yyval = yyvsp[-2]->Link(yyvsp[-1]); ; break;} case 187: #line 610 "parse.y" {yyval = yyvsp[-1]; delete yyvsp[-2]; delete yyvsp[0]; ; break;} case 188: #line 613 "parse.y" { yyval = NULL; ; break;} case 190: #line 615 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 191: #line 617 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 192: #line 621 "parse.y" { yyval = NULL; ; break;} case 193: #line 622 "parse.y" {yyval = (new Node(BAS_S_CLOSE, "", 0))->Link(yyvsp[0]); ; break;} case 194: #line 623 "parse.y" { delete yyvsp[-1]; yyval = yyvsp[-2]->DownLink(yyvsp[0]); ; break;} case 195: #line 627 "parse.y" { yyval = NULL; ; break;} case 197: #line 629 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 198: #line 631 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 200: #line 636 "parse.y" { yyvsp[-1]->SetType(BAS_N_UMINUS); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 202: #line 641 "parse.y" { yyval = NULL; ; break;} case 204: #line 643 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 205: #line 645 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 206: #line 649 "parse.y" { yyval = NULL; ; break;} case 208: #line 651 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 210: #line 656 "parse.y" { delete yyvsp[-1]; yyval=yyvsp[0]; ; break;} case 211: #line 657 "parse.y" { yyvsp[-1]->SetType(BAS_X_UNARYLT); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 212: #line 659 "parse.y" { yyvsp[-1]->SetType(BAS_X_UNARYLE); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 213: #line 661 "parse.y" { yyvsp[-1]->SetType(BAS_X_UNARYGT); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 214: #line 663 "parse.y" { yyvsp[-1]->SetType(BAS_X_UNARYGE); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 215: #line 665 "parse.y" { yyvsp[-1]->SetType(BAS_X_UNARYNEQ); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 216: #line 667 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 218: #line 671 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 219: #line 675 "parse.y" {yyval = NULL; ; break;} case 221: #line 679 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 222: #line 683 "parse.y" { yyvsp[0]->SetType(BAS_V_USELABEL); yyval = yyvsp[0]; ; break;} case 223: #line 684 "parse.y" { yyvsp[0]->SetType(BAS_V_USELABEL); yyval = yyvsp[0]; ; break;} case 224: #line 685 "parse.y" { yyvsp[0]->SetType(BAS_V_USELABEL); yyval = yyvsp[0]; ; break;} case 225: #line 686 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 226: #line 689 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 228: #line 694 "parse.y" { delete yyvsp[-1]; yyval = yyvsp[-2]->DownLink(yyvsp[0]); ; break;} case 229: #line 696 "parse.y" {yyval = (new Node(BAS_S_READ, "", 0))->Link(yyvsp[0]); ; break;} case 231: #line 700 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 233: #line 704 "parse.y" { if (yyvsp[-1] == NULL) { yyvsp[-2]->SetType(BAS_N_NULL); yyval = yyvsp[-3]->Link(yyvsp[-2]); } else { yyval = yyvsp[-3]->Link(yyvsp[-1]); delete yyvsp[-2]; } delete yyvsp[0]; ; break;} case 234: #line 713 "parse.y" { yyvsp[0]->SetType(BAS_N_STRUCTNAME); yyval = yyvsp[0]; ; break;} case 235: #line 714 "parse.y" { yyvsp[-3]->SetType(BAS_N_STRUCTNAME); if (yyvsp[-1] == NULL) { yyvsp[-2]->SetType(BAS_N_NULL); yyval = yyvsp[-3]->Link(yyvsp[-2]); } else { yyval = yyvsp[-3]->Link(yyvsp[-1]); delete yyvsp[-2]; } delete yyvsp[0]; ; break;} case 240: #line 730 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[-1]); delete yyvsp[-2]; delete yyvsp[0]; ; break;} case 241: #line 732 "parse.y" { yyvsp[-5]->SetType(BAS_N_TYPEFUN); yyval = yyvsp[-5]->Link(yyvsp[-3], yyvsp[-1]); delete yyvsp[-4]; delete yyvsp[-2]; delete yyvsp[0]; ; break;} case 242: #line 738 "parse.y" { yyval = NULL ; break;} case 243: #line 739 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 244: #line 740 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 245: #line 743 "parse.y" { delete yyvsp[-2]; delete yyvsp[0]; yyval = NULL; ; break;} case 246: #line 744 "parse.y" { IntegerType = VARTYPE_BYTE; delete yyvsp[-1]; delete yyvsp[0]; yyval = NULL; ; break;} case 247: #line 746 "parse.y" { IntegerType = VARTYPE_WORD; delete yyvsp[-1]; delete yyvsp[0]; yyval = NULL; ; break;} case 248: #line 748 "parse.y" { IntegerType = VARTYPE_LONG; delete yyvsp[-1]; delete yyvsp[0]; yyval = NULL; ; break;} case 249: #line 750 "parse.y" { RealType = VARTYPE_SINGLE; delete yyvsp[-1]; delete yyvsp[0]; yyval = NULL; ; break;} case 250: #line 752 "parse.y" { RealType = VARTYPE_DOUBLE; delete yyvsp[-1]; delete yyvsp[0]; yyval = NULL; ; break;} case 251: #line 754 "parse.y" { RealType = VARTYPE_GFLOAT; delete yyvsp[-1]; delete yyvsp[0]; yyval = NULL; ; break;} case 252: #line 756 "parse.y" { RealType = VARTYPE_HFLOAT; delete yyvsp[-1]; delete yyvsp[0]; yyval = NULL; ; break;} case 253: #line 760 "parse.y" { delete yyvsp[-1]; yyval = NULL; ; break;} case 254: #line 761 "parse.y" { yyval = NULL; ; break;} case 255: #line 764 "parse.y" { yyval = NULL; ; break;} case 269: #line 784 "parse.y" { delete yyvsp[-2]; delete yyvsp[0]; delete yyvsp[-1]; yyval = yyvsp[-3]; ; break;} case 271: #line 789 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 272: #line 793 "parse.y" { yyvsp[-1]->SetType(BAS_V_FUNCTION); yyval = yyvsp[-1]; ; break;} case 273: #line 794 "parse.y" { yyvsp[-4]->SetType(BAS_V_FUNCTION); yyval = yyvsp[-4]->Link(yyvsp[-1]); delete yyvsp[-2]; delete yyvsp[0]; ; break;} case 274: #line 799 "parse.y" { yyval = NULL; ; break;} case 275: #line 800 "parse.y" { delete yyvsp[-1]; delete yyvsp[0]; yyval = NULL; ; break;} case 276: #line 803 "parse.y" { yyval = NULL; ; break;} case 278: #line 805 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 279: #line 809 "parse.y" { yyval = yyvsp[0]; ; break;} case 280: #line 810 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 281: #line 813 "parse.y" { yyval = yyvsp[-2]->Link(NULL, yyvsp[-1], yyvsp[0]); ; break;} case 282: #line 814 "parse.y" { yyval = yyvsp[-3]->Link(yyvsp[0], yyvsp[-1], yyvsp[-2]); ; break;} case 283: #line 816 "parse.y" { yyval = yyvsp[-2]->Link(NULL, yyvsp[-1], yyvsp[0]); ; break;} case 284: #line 818 "parse.y" { yyvsp[-3]->SetType(BAS_N_VARTYPE); yyval = yyvsp[-3]->Link(yyvsp[0], yyvsp[-1], yyvsp[-2]); ; break;} case 285: #line 822 "parse.y" { yyval = NULL; ; break;} case 286: #line 823 "parse.y" { delete yyvsp[-2]; delete yyvsp[0]; yyval = yyvsp[-3]->Link(yyvsp[-1]); ; break;} case 287: #line 825 "parse.y" { delete yyvsp[-2]; delete yyvsp[-1]; yyval = yyvsp[-1]; ; break;} case 288: #line 829 "parse.y" { yyval = NULL; ; break;} case 289: #line 830 "parse.y" { yyval = yyvsp[0]; ; break;} case 290: #line 831 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(NULL, yyvsp[0]); ; break;} case 291: #line 833 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 292: #line 837 "parse.y" { yyval = NULL; ; break;} case 293: #line 838 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 294: #line 841 "parse.y" { yyval = NULL; ; break;} case 295: #line 842 "parse.y" { yyvsp[-1]->SetType(BAS_N_ASSIGN); yyval = yyvsp[-1]->Link(NULL, yyvsp[0]); ; break;} case 296: #line 846 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 298: #line 850 "parse.y" { yyvsp[0]->SetType(BAS_N_VARTYPE); yyval=yyvsp[0]; ; break;} case 300: #line 854 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 301: #line 858 "parse.y" { yyval = yyvsp[-1]->Link(NULL, NULL, yyvsp[0]); ; break;} case 302: #line 859 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[-1], NULL, yyvsp[0]); ; break;} case 304: #line 863 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 306: #line 868 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 308: #line 872 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 309: #line 876 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[-1], NULL, yyvsp[0]); ; break;} case 310: #line 877 "parse.y" { yyval = yyvsp[-1]->Link(NULL, NULL, yyvsp[0]); ; break;} case 312: #line 881 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 313: #line 885 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[-1], NULL, yyvsp[0]); ; break;} case 314: #line 886 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[-1], yyvsp[-3], yyvsp[0]); ; break;} case 315: #line 887 "parse.y" { yyval = yyvsp[-2]->Link(yyvsp[-1], NULL, yyvsp[0]); ; break;} case 316: #line 888 "parse.y" { yyvsp[-3]->SetType(BAS_N_VARTYPE); yyval = yyvsp[-2]->Link(yyvsp[-1], yyvsp[-3], yyvsp[0]); ; break;} case 317: #line 893 "parse.y" { yyval = yyvsp[-1]; delete yyvsp[-2]; delete yyvsp[0]; ; break;} case 318: #line 896 "parse.y" { yyval = NULL; ; break;} case 319: #line 897 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 320: #line 900 "parse.y" { yyval = NULL; ; break;} case 321: #line 901 "parse.y" { yyvsp[-3]->SetType(BAS_N_LIST); yyvsp[-2]->SetType(BAS_V_RMSRECORD); yyval = yyvsp[-3]->Link(yyvsp[-2]->Link(yyvsp[-1]), yyvsp[0]); ; break;} case 322: #line 905 "parse.y" { yyvsp[-2]->SetType(BAS_N_LIST); yyval = yyvsp[-2]->Link(yyvsp[-1], yyvsp[0]); ; break;} case 323: #line 907 "parse.y" { yyvsp[-4]->SetType(BAS_N_LIST); delete yyvsp[-2]; yyval = yyvsp[-4]->Link(yyvsp[-3]->Link(yyvsp[-1]), yyvsp[0]); ; break;} case 324: #line 911 "parse.y" { yyvsp[-6]->SetType(BAS_N_LIST); delete yyvsp[-4]; yyval = yyvsp[-6]->Link(yyvsp[-5]->Link(yyvsp[-3], yyvsp[-2], yyvsp[-1]), yyvsp[0]); ; break;} case 325: #line 915 "parse.y" { yyvsp[-6]->SetType(BAS_N_LIST); delete yyvsp[-4]; yyval = yyvsp[-6]->Link(yyvsp[-5]->Link(yyvsp[-3], yyvsp[-2], yyvsp[-1]), yyvsp[0]); ; break;} case 326: #line 919 "parse.y" { yyvsp[-6]->SetType(BAS_N_LIST); delete yyvsp[-4]; yyval = yyvsp[-6]->Link(yyvsp[-5]->Link(yyvsp[-3], yyvsp[-2], yyvsp[-1]), yyvsp[0]); ; break;} case 327: #line 922 "parse.y" { yyvsp[-3]->SetType(BAS_N_LIST); yyval = yyvsp[-3]->Link(yyvsp[-2]->Link(yyvsp[-1]), yyvsp[0]); ; break;} case 328: #line 924 "parse.y" { yyvsp[-3]->SetType(BAS_N_LIST); yyval = yyvsp[-3]->Link(yyvsp[-2]->Link(yyvsp[-1]), yyvsp[0]); ; break;} case 329: #line 926 "parse.y" { yyvsp[-3]->SetType(BAS_N_LIST); yyval = yyvsp[-3]->Link(yyvsp[-2]->Link(yyvsp[-1]), yyvsp[0]); ; break;} case 330: #line 930 "parse.y" { yyval = yyvsp[0]; ; break;} case 331: #line 931 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 332: #line 934 "parse.y" { yyval = NULL; ; break;} case 333: #line 935 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 334: #line 936 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 335: #line 937 "parse.y" { yyvsp[-3]->Link(yyvsp[-2]); yyvsp[-1]->Link(yyvsp[0]); yyval = (new Node(BAS_N_LIST, ";", 0))-> Link(yyvsp[-3], yyvsp[-1]); ; break;} case 336: #line 941 "parse.y" { yyvsp[-1]->SetType(BAS_N_RECORD); yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 337: #line 943 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 338: #line 944 "parse.y" { yyval = yyvsp[0]; ; break;} case 339: #line 947 "parse.y" { yyval = yyvsp[0]; ; break;} case 340: #line 948 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 341: #line 951 "parse.y" { yyval = NULL; ; break;} case 342: #line 952 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 343: #line 953 "parse.y" { yyval = yyvsp[0]; ; break;} case 344: #line 956 "parse.y" { yyvsp[0]->SetType(BAS_N_LIST); yyval = yyvsp[0]; ; break;} case 345: #line 957 "parse.y" { yyvsp[0]->SetType(BAS_N_LIST); yyval = yyvsp[0]; ; break;} case 349: #line 965 "parse.y" { yyval = NULL; ; break;} case 350: #line 966 "parse.y" { yyval = yyvsp[-1]->DownLink(yyvsp[0]); ; break;} case 351: #line 969 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 352: #line 971 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 353: #line 973 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 354: #line 975 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 355: #line 977 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 356: #line 979 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 357: #line 981 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 358: #line 983 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 359: #line 984 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 360: #line 985 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 361: #line 987 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 362: #line 989 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 363: #line 991 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 364: #line 993 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 365: #line 995 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 366: #line 997 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 367: #line 998 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 368: #line 999 "parse.y" { yyval = yyvsp[0]; delete yyvsp[-1]; ; break;} case 369: #line 1000 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); delete yyvsp[-2]; ; break;} case 370: #line 1002 "parse.y" { delete yyvsp[-4]; delete yyvsp[-2]; yyval = yyvsp[-3]->Link(yyvsp[-1]); ; break;} case 371: #line 1004 "parse.y" { delete yyvsp[-3]; yyval = yyvsp[-2]->Link(yyvsp[-1]); ; break;} case 372: #line 1006 "parse.y" { delete yyvsp[-4]; delete yyvsp[-2]; yyval = yyvsp[-3]->Link(yyvsp[-1]); ; break;} case 373: #line 1008 "parse.y" { delete yyvsp[-2]; yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 374: #line 1012 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 375: #line 1013 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 376: #line 1014 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 377: #line 1015 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 378: #line 1016 "parse.y" {yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 379: #line 1019 "parse.y" { yyval = NULL; ; break;} case 393: #line 1039 "parse.y" { yyval = NULL; ; break;} case 394: #line 1040 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 395: #line 1041 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 396: #line 1042 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 397: #line 1043 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[0]); ; break;} case 398: #line 1046 "parse.y" { yyval = NULL; ; break;} case 400: #line 1048 "parse.y" { yyvsp[-1]->SetType(BAS_N_LIST); yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} case 401: #line 1052 "parse.y" { yyval = yyvsp[-1]->Link(yyvsp[-2], yyvsp[0]); ; break;} } /* the action file gets copied in in place of this dollarsign */ #line 465 "/usr/lib/bison.simple" yyvsp -= yylen; yyssp -= yylen; #ifdef YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; #ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; msg = (char *) malloc(size + 15); if (msg != 0) { strcpy(msg, "parse error"); if (count < 5) { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; } } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #ifdef YYLSP_NEEDED yylsp--; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, "); #endif *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; } #line 1054 "parse.y" /* * Display error messages */ int yyerror(char *s) { cerr << "Parse error: " << s << " near line " << xline << endl; if (include_stack_pointer > 0) { cout << " in included file " << include_name[include_stack_pointer - 1] << endl; } return 0; } parse.h100644 765 144 12500 6263655522 11113 0ustar kevinusers#ifndef YYSTYPE #define YYSTYPE int #endif #define BAS_S_ACCESS 258 #define BAS_S_ACTIVE 259 #define BAS_S_ALLOW 260 #define BAS_S_ALTERNATE 261 #define BAS_S_ANY 262 #define BAS_S_APPEND 263 #define BAS_S_AS 264 #define BAS_S_BACK 265 #define BAS_S_BLOCK 266 #define BAS_S_BLOCKSIZE 267 #define BAS_S_BUCKETSIZE 268 #define BAS_S_BUFFER 269 #define BAS_S_BY 270 #define BAS_S_BYTE 271 #define BAS_S_CALL 272 #define BAS_S_CASE 273 #define BAS_S_CHAIN 274 #define BAS_S_CHANGE 275 #define BAS_S_CHANGES 276 #define BAS_S_CLOSE 277 #define BAS_S_COMMON 278 #define BAS_S_CONSTANT 279 #define BAS_S_CONTIGUOUS 280 #define BAS_S_CONNECT 281 #define BAS_S_COUNT 282 #define BAS_S_DATA 283 #define BAS_S_DECIMAL 284 #define BAS_S_DECLARE 285 #define BAS_S_DEF 286 #define BAS_S_DEFAULTNAME 287 #define BAS_S_DELETE 288 #define BAS_S_DESC 289 #define BAS_S_DIM 290 #define BAS_S_DOUBLE 291 #define BAS_S_DUPLICATES 292 #define BAS_S_ELSE 293 #define BAS_S_END 294 #define BAS_S_EQ 295 #define BAS_S_ERL 296 #define BAS_S_ERR 297 #define BAS_S_ERROR 298 #define BAS_S_EXIT 299 #define BAS_S_EXPLICIT 300 #define BAS_S_EXTEND 301 #define BAS_S_EXTENDSIZE 302 #define BAS_S_EXTERNAL 303 #define BAS_S_FIELD 304 #define BAS_S_FILE 305 #define BAS_S_FILL 306 #define BAS_S_FILESIZE 307 #define BAS_S_FIND 308 #define BAS_S_FIXED 309 #define BAS_S_FNEND 310 #define BAS_S_FNEXIT 311 #define BAS_S_FOR 312 #define BAS_S_FORTRAN 313 #define BAS_S_FREE 314 #define BAS_S_FROM 315 #define BAS_S_FUNCTION 316 #define BAS_S_FUNCTIONEND 317 #define BAS_S_FUNCTIONEXIT 318 #define BAS_S_GE 319 #define BAS_S_GET 320 #define BAS_S_GFLOAT 321 #define BAS_S_GO 322 #define BAS_S_GOSUB 323 #define BAS_S_GOTO 324 #define BAS_S_GT 325 #define BAS_S_HFLOAT 326 #define BAS_S_IF 327 #define BAS_S_INACTIVE 328 #define BAS_S_INDEXED 329 #define BAS_S_INPUT 330 #define BAS_S_INTEGER 331 #define BAS_S_ITERATE 332 #define BAS_S_KEY 333 #define BAS_S_KILL 334 #define BAS_S_LET 335 #define BAS_S_LINE 336 #define BAS_S_LINPUT 337 #define BAS_S_LIST 338 #define BAS_S_LONG 339 #define BAS_S_LSET 340 #define BAS_S_MAP 341 #define BAS_S_MARGIN 342 #define BAS_S_MODE 343 #define BAS_S_MODIFY 344 #define BAS_S_MOVE 345 #define BAS_S_NAME 346 #define BAS_S_NEXT 347 #define BAS_S_NOCHANGES 348 #define BAS_S_NODUPLICATES 349 #define BAS_S_NONE 350 #define BAS_S_NOREWIND 351 #define BAS_S_NOSPAN 352 #define BAS_S_ON 353 #define BAS_S_OPEN 354 #define BAS_S_OPTION 355 #define BAS_S_ORGANIZATION 356 #define BAS_S_OTHERWISE 357 #define BAS_S_OUTPUT 358 #define BAS_S_OVERFLOW 359 #define BAS_S_PRIMARY 360 #define BAS_S_PRINT 361 #define BAS_S_PUT 362 #define BAS_S_RANDOM 363 #define BAS_S_READ 364 #define BAS_S_REAL 365 #define BAS_S_RECORD 366 #define BAS_S_RECORDTYPE 367 #define BAS_S_RECORDSIZE 368 #define BAS_S_REF 369 #define BAS_S_REGARDLESS 370 #define BAS_S_RELATIVE 371 #define BAS_S_REMAP 372 #define BAS_S_REMARK 373 #define BAS_S_REMARKLINE 374 #define BAS_S_RESTORE 375 #define BAS_S_RESET 376 #define BAS_S_RESUME 377 #define BAS_S_RETURN 378 #define BAS_S_REWIND 379 #define BAS_S_RFA 380 #define BAS_S_ROUNDING 381 #define BAS_S_RSET 382 #define BAS_S_SCRATCH 383 #define BAS_S_SELECT 384 #define BAS_S_SEQUENTIAL 385 #define BAS_S_SINGLE 386 #define BAS_S_SIZE 387 #define BAS_S_SLEEP 388 #define BAS_S_SPAN 389 #define BAS_S_STEP 390 #define BAS_S_STOP 391 #define BAS_S_STREAM 392 #define BAS_S_STRING 393 #define BAS_S_SUB 394 #define BAS_S_SUBEND 395 #define BAS_S_SUBEXIT 396 #define BAS_S_SUBSCRIPT 397 #define BAS_S_TEMPORARY 398 #define BAS_S_THEN 399 #define BAS_S_TO 400 #define BAS_S_TYPE 401 #define BAS_S_UNDEFINED 402 #define BAS_S_UNLESS 403 #define BAS_S_UNLOCK 404 #define BAS_S_UNTIL 405 #define BAS_S_UPDATE 406 #define BAS_S_USEROPEN 407 #define BAS_S_USING 408 #define BAS_S_VALUE 409 #define BAS_S_VARIABLE 410 #define BAS_S_VARIANT 411 #define BAS_S_VIRTUAL 412 #define BAS_S_WAIT 413 #define BAS_S_WHILE 414 #define BAS_S_WINDOWSIZE 415 #define BAS_S_WORD 416 #define BAS_S_WRITE 417 #define BAS_P_INCLUDE 418 #define BAS_P_FROM 419 #define BAS_P_CDD 420 #define BAS_P_TITLE 421 #define BAS_P_SBTTL 422 #define BAS_P_IDENT 423 #define BAS_V_FUNCTION 424 #define BAS_V_FLOAT 425 #define BAS_V_INTEGER 426 #define BAS_V_INT 427 #define BAS_V_LABEL 428 #define BAS_V_USELABEL 429 #define BAS_V_NAME 430 #define BAS_V_TEXTSTRING 431 #define BAS_V_RMSRECORD 432 #define BAS_V_PREDEF 433 #define BAS_X_UNARYLT 434 #define BAS_X_UNARYLE 435 #define BAS_X_UNARYGT 436 #define BAS_X_UNARYGE 437 #define BAS_X_UNARYNEQ 438 #define BAS_X_STRREF 439 #define BAS_X_NEQ 440 #define BAS_X_GE 441 #define BAS_X_LE 442 #define BAS_S_EQV 443 #define BAS_S_NOT 444 #define BAS_S_AND 445 #define BAS_S_OR 446 #define BAS_S_IMP 447 #define BAS_S_XOR 448 #define UMINUS 449 #define BAS_N_UMINUS 450 #define BAS_N_UPLUS 451 #define BAS_N_ASSIGN 452 #define BAS_N_FORASSIGN 453 #define BAS_N_ASSIGNLIST 454 #define BAS_N_LIST 455 #define BAS_N_ENDIF 456 #define BAS_N_ONGOTO 457 #define BAS_N_ONGOSUB 458 #define BAS_N_ONERROR 459 #define BAS_N_ENDSELECT 460 #define BAS_N_ENDRECORD 461 #define BAS_N_EXTERNALFUNCTION 462 #define BAS_N_EXTERNALSUB 463 #define BAS_N_EXTERNALCONSTANT 464 #define BAS_N_FORUNTIL 465 #define BAS_N_FORWHILE 466 #define BAS_N_CASEELSE 467 #define BAS_N_NULL 468 #define BAS_N_VARTYPE 469 #define BAS_N_ENDVARIANT 470 #define BAS_N_RECORD 471 #define BAS_N_STRUCTNAME 472 #define BAS_N_TYPEFUN 473 extern YYSTYPE yylval; parse.y100644 765 144 73235 6263655206 11147 0ustar kevinusers/* Parse.y * * History: * * 01.01.00 - 08/30/1996 - Kevin Handy * Set version number to 1.1, and install on internet. * * 01.01.01 - 09/04/1996 - Kevin Handy * Added "BLOCK" for get clause. * * 01.01.02 - 09/26/1996 - Kevin Handy * Lose two 'bstruct' and 'tempch' variables that were * defined but never used, and two debug macros that * are no longer used. * * 01.01.03 - 10/09/1996 - Kevin Handy * Added BAS_V_PREDEF constants. * * 01.01.04 - 10/22/1996 - Kevin Handy * Handle new variables 'IntegerType' and 'RealType', * as well as new variable types 'SINGLE', 'GFLOAT', * and 'HFLOAT'. * * 01.01.05 - 11/12/1996 - Kevin Handy * Have "close" generate a 'downlink' of closes instead * of a close linked to a list, so can lose function from * nodes.cc. * Same for "read". * * 01.02.01 - 11/12/1996 - Kevin Handy * "forassignment" shouldn't allow a list for the lvalue. */ %{ #include #include "basic.h" #include "nodes.h" #ifndef YYSTYPE #define YYSTYPE Node * #endif #ifndef YYDEBUG #define YYDEBUG 0 #endif %} %start program %token BAS_S_ACCESS %token BAS_S_ACTIVE %token BAS_S_ALLOW %token BAS_S_ALTERNATE %token BAS_S_ANY %token BAS_S_APPEND %token BAS_S_AS %token BAS_S_BACK %token BAS_S_BLOCK %token BAS_S_BLOCKSIZE %token BAS_S_BUCKETSIZE %token BAS_S_BUFFER %token BAS_S_BY %token BAS_S_BYTE %token BAS_S_CALL %token BAS_S_CASE %token BAS_S_CHAIN %token BAS_S_CHANGE %token BAS_S_CHANGES %token BAS_S_CLOSE %token BAS_S_COMMON %token BAS_S_CONSTANT %token BAS_S_CONTIGUOUS %token BAS_S_CONNECT %token BAS_S_COUNT %token BAS_S_DATA %token BAS_S_DECIMAL %token BAS_S_DECLARE %token BAS_S_DEF %token BAS_S_DEFAULTNAME %token BAS_S_DELETE %token BAS_S_DESC %token BAS_S_DIM %token BAS_S_DOUBLE %token BAS_S_DUPLICATES %token BAS_S_ELSE %token BAS_S_END %token BAS_S_EQ %token BAS_S_ERL %token BAS_S_ERR %token BAS_S_ERROR %token BAS_S_EXIT %token BAS_S_EXPLICIT %token BAS_S_EXTEND %token BAS_S_EXTENDSIZE %token BAS_S_EXTERNAL %token BAS_S_FIELD %token BAS_S_FILE %token BAS_S_FILL %token BAS_S_FILESIZE %token BAS_S_FIND %token BAS_S_FIXED %token BAS_S_FNEND %token BAS_S_FNEXIT %token BAS_S_FOR %token BAS_S_FORTRAN %token BAS_S_FREE %token BAS_S_FROM %token BAS_S_FUNCTION %token BAS_S_FUNCTIONEND %token BAS_S_FUNCTIONEXIT %token BAS_S_GE %token BAS_S_GET %token BAS_S_GFLOAT %token BAS_S_GO %token BAS_S_GOSUB %token BAS_S_GOTO %token BAS_S_GT %token BAS_S_HFLOAT %token BAS_S_IF %token BAS_S_INACTIVE %token BAS_S_INDEXED %token BAS_S_INPUT %token BAS_S_INTEGER %token BAS_S_ITERATE %token BAS_S_KEY %token BAS_S_KILL %token BAS_S_LET %token BAS_S_LINE %token BAS_S_LINPUT %token BAS_S_LIST %token BAS_S_LONG %token BAS_S_LSET %token BAS_S_MAP %token BAS_S_MARGIN %token BAS_S_MODE %token BAS_S_MODIFY %token BAS_S_MOVE %token BAS_S_NAME %token BAS_S_NEXT %token BAS_S_NOCHANGES %token BAS_S_NODUPLICATES %token BAS_S_NONE %token BAS_S_NOREWIND %token BAS_S_NOSPAN %token BAS_S_ON %token BAS_S_OPEN %token BAS_S_OPTION %token BAS_S_ORGANIZATION %token BAS_S_OTHERWISE %token BAS_S_OUTPUT %token BAS_S_OVERFLOW %token BAS_S_PRIMARY %token BAS_S_PRINT %token BAS_S_PUT %token BAS_S_RANDOM %token BAS_S_READ %token BAS_S_REAL %token BAS_S_RECORD %token BAS_S_RECORDTYPE %token BAS_S_RECORDSIZE %token BAS_S_REF %token BAS_S_REGARDLESS %token BAS_S_RELATIVE %token BAS_S_REMAP %token BAS_S_REMARK %token BAS_S_REMARKLINE %token BAS_S_RESTORE %token BAS_S_RESET %token BAS_S_RESUME %token BAS_S_RETURN %token BAS_S_REWIND %token BAS_S_RFA %token BAS_S_ROUNDING %token BAS_S_RSET %token BAS_S_SCRATCH %token BAS_S_SELECT %token BAS_S_SEQUENTIAL %token BAS_S_SINGLE %token BAS_S_SIZE %token BAS_S_SLEEP %token BAS_S_SPAN %token BAS_S_STEP %token BAS_S_STOP %token BAS_S_STREAM %token BAS_S_STRING %token BAS_S_SUB %token BAS_S_SUBEND %token BAS_S_SUBEXIT %token BAS_S_SUBSCRIPT %token BAS_S_TEMPORARY %token BAS_S_THEN %token BAS_S_TO %token BAS_S_TYPE %token BAS_S_UNDEFINED %token BAS_S_UNLESS %token BAS_S_UNLOCK %token BAS_S_UNTIL %token BAS_S_UPDATE %token BAS_S_USEROPEN %token BAS_S_USING %token BAS_S_VALUE %token BAS_S_VARIABLE %token BAS_S_VARIANT %token BAS_S_VIRTUAL %token BAS_S_WAIT %token BAS_S_WHILE %token BAS_S_WINDOWSIZE %token BAS_S_WORD %token BAS_S_WRITE %token BAS_P_INCLUDE %token BAS_P_FROM %token BAS_P_CDD %token BAS_P_TITLE %token BAS_P_SBTTL %token BAS_P_IDENT %token BAS_V_FUNCTION %token BAS_V_FLOAT %token BAS_V_INTEGER %token BAS_V_INT %token BAS_V_LABEL %token BAS_V_USELABEL %token BAS_V_NAME %token BAS_V_TEXTSTRING %token BAS_V_RMSRECORD %token BAS_V_PREDEF %token BAS_X_UNARYLT %token BAS_X_UNARYLE %token BAS_X_UNARYGT %token BAS_X_UNARYGE %token BAS_X_UNARYNEQ %left BAS_X_STRREF %left BAS_X_NEQ BAS_X_GE BAS_X_LE BAS_S_EQV %left BAS_S_NOT %left '+' '-' %left '*' '/' %right '^' %left '=' '>' '<' %left BAS_S_AND BAS_S_OR BAS_S_IMP BAS_S_XOR %nonassoc UMINUS %left ',' %token BAS_N_UMINUS %token BAS_N_UPLUS %token BAS_N_ASSIGN %token BAS_N_FORASSIGN %token BAS_N_ASSIGNLIST %token BAS_N_LIST %token BAS_N_ENDIF %token BAS_N_ONGOTO %token BAS_N_ONGOSUB %token BAS_N_ONERROR %token BAS_N_ENDSELECT %token BAS_N_ENDRECORD %token BAS_N_EXTERNALFUNCTION %token BAS_N_EXTERNALSUB %token BAS_N_EXTERNALCONSTANT %token BAS_N_FORUNTIL %token BAS_N_FORWHILE %token BAS_N_CASEELSE %token BAS_N_NULL %token BAS_N_VARTYPE %token BAS_N_ENDVARIANT %token BAS_N_RECORD %token BAS_N_STRUCTNAME %token BAS_N_TYPEFUN %% /* Grammer rules */ program: doprogram { DoProgram($1); } ; doprogram: /* Empty */ { $$ = NULL; } | nline doprogram { $$ = $1->DownLink($2); } ; nline: linenum label statement '\n' { $$ = CommentList->DownLink($1->DownLink($2->DownLink($3))); CommentList = NULL; } ; linenum: /* Empty */ {$$ = NULL;} | BAS_V_INTEGER { $1->SetType(BAS_V_LABEL); $$ = $1; } ; label: /* Empty */ {$$ = NULL;} | BAS_V_LABEL ; statement: statementx | statement '\\' statementx { delete $2; $$ = $1->DownLink($3); } | statement BAS_S_THEN statementw { $$ = $1->DownLink($2->DownLink($3)); } | statement BAS_S_ELSE statementw { $$ = $1->DownLink($2->DownLink($3)); } | statement BAS_N_ENDIF statementx { $$ = $1->DownLink($2->DownLink($3)); } ; statementw: statementx | BAS_V_INTEGER { $$ = (new Node(BAS_S_GOTO, "", 0))->Link($1); } /* For 'THEN 1000' */ statementx: /* Empty */ {$$ = NULL;} | stmtnomod | stmtmodlist ; stmtmodlist: stmtmod | stmtmodlist ifmod { $$ = $2->Link(NULL, NULL, NULL, $1); } | stmtmodlist unlessmod { $$ = $2->Link(NULL, NULL, NULL, $1); } | stmtmodlist formod { $$ = $2->Link(NULL, NULL, NULL, $1); } | stmtmodlist whilemod { $$ = $2->Link(NULL, NULL, NULL, $1); } | stmtmodlist untilmod { $$ = $2->Link(NULL, NULL, NULL, $1); } ; ifmod: BAS_S_IF expression { $$ = $1->Link($2); } ; unlessmod: BAS_S_UNLESS expression { $$ = $1->Link($2); } ; whilemod: BAS_S_WHILE expression { $$ = $1->Link($2); } ; untilmod: BAS_S_UNTIL expression { $$ = $1->Link($2); } ; formod: BAS_S_FOR forassignment BAS_S_TO expression { delete $3; $$ = $1->Link($2, $4); } | BAS_S_FOR forassignment BAS_S_TO expression BAS_S_STEP expression {delete $3; delete $5; $$ = $1->Link($2, $4, $6); } | BAS_S_FOR forassignment BAS_S_UNTIL expression { delete $3; $1->SetType(BAS_N_FORUNTIL); $$ = $1->Link($2, $4); } | BAS_S_FOR forassignment BAS_S_WHILE expression { delete $3; $1->SetType(BAS_N_FORWHILE); $$ = $1->Link($2, $4); } ; stmtmod: assignment | BAS_S_CALL variable { $2->SetType(BAS_V_FUNCTION); $$ = $1->Link($2); } | BAS_S_CHAIN expression {$$ = $1->Link($2); } | BAS_S_CHAIN expression BAS_S_LINE expression { $$ = $1->Link($2, $4); delete $3; } | BAS_S_CHANGE expression BAS_S_TO expression { $$ = $1->Link($2, $4); delete $3; } | BAS_S_CLOSE '#' closelist {$$ = $3; delete $1; delete $2; } | BAS_S_CLOSE closelist {$$ = $2; delete $1; } | BAS_S_DELETE '#' expression { $$ = $1->Link($3); delete $2; } | BAS_S_EXIT BAS_S_FUNCTION { $1->SetType(BAS_S_FUNCTIONEXIT); $$ = $1; delete $2; } | BAS_S_EXIT BAS_S_SUB { $1->SetType(BAS_S_SUBEXIT); $$ = $1; delete $2; } | BAS_S_EXIT lineno {$1->SetType(BAS_S_GOTO); $$ = $1->Link($2); } | BAS_S_FIELD '#' expression ',' fieldlist { $$ = $1->Link($3, $5); delete $2; delete $4; } | BAS_S_FIND '#' expression getclause { $$ = $1->Link($3, $4); delete $2; } | BAS_S_FOR forassignment BAS_S_TO expression { delete $3; $$ = $1->Link($2, $4); } | BAS_S_FOR forassignment BAS_S_TO expression BAS_S_STEP expression { delete $3; delete $5; $$ = $1->Link($2, $4, $6); } | BAS_S_FOR forassignment BAS_S_UNTIL expression { delete $3; $1->SetType(BAS_N_FORUNTIL); $$ = $1->Link($2, $4); } | BAS_S_FOR forassignment BAS_S_WHILE expression { delete $3; $1->SetType(BAS_N_FORWHILE); $$ = $1->Link($2, $4); } | BAS_S_FNEXIT | BAS_S_FREE '#' expression { $$ = $1->Link($3); delete $2; } | BAS_S_FUNCTIONEXIT { $1->SetType(BAS_S_FNEXIT); $$ = $1; } | BAS_S_GET '#' expression getclause { $$ = $1->Link($3, $4); delete $2; } | BAS_S_GOSUB lineno {$$ = $1->Link($2); } | BAS_S_GOTO lineno {$$ = $1->Link($2); } | BAS_S_GO BAS_S_SUB lineno { $1->SetType(BAS_S_GOSUB); $$ = $1->Link($3); delete $2; } | BAS_S_GO BAS_S_TO lineno { $1->SetType(BAS_S_GOTO); $$ = $1->Link($3); delete $2; } | BAS_S_INPUT optinput { $$ = $1->Link($2); NeedIostreamH = 1; } | BAS_S_INPUT BAS_S_LINE optinput { $1->SetType(BAS_S_LINPUT); $$ = $1->Link($3); delete $2; NeedIostreamH = 1; } | BAS_S_ITERATE | BAS_S_ITERATE lineno { $1->SetType(BAS_S_GOTO); $$ = $1->Link($2); } | BAS_S_KILL expression {$$ = $1->Link($2); } | BAS_S_LET assignment {$$ = $2; delete $1; } | BAS_S_LINPUT optinput { $$ = $1->Link($2); NeedIostreamH = 1; } | BAS_S_LSET assignment {$$ = $1->Link($2); } | BAS_S_MARGIN '#' expression ',' expression { $$ = $1->Link($3, $5); delete $2; delete $4; } | BAS_S_MOVE BAS_S_TO '#' expression ',' expression { $$ = $1->Link($4, $6); delete $2; delete $3; delete $5; } | BAS_S_MOVE BAS_S_FROM '#' expression ',' expression { $$ = $1->Link($4, $6); delete $2; delete $3; delete $5; } | BAS_S_NAME expression BAS_S_AS expression { delete $3; $$ = $1->Link($2, $4); } | BAS_S_NEXT | BAS_S_NEXT variable { $$ = $1->Link($2); } | BAS_S_ON BAS_S_ERROR BAS_S_GO BAS_S_TO lineno { $1->SetType(BAS_N_ONERROR); $$ = $1->Link($5); delete $2; delete $3; delete $4; } | BAS_S_ON BAS_S_ERROR BAS_S_GOTO lineno { $1->SetType(BAS_N_ONERROR); $$ = $1->Link($4); delete $2; delete $3; } | BAS_S_ON BAS_S_ERROR BAS_S_GO BAS_S_BACK { $1->SetType(BAS_N_ONERROR); $$ = $1->Link($4); delete $2; delete $3; } | BAS_S_ON expression BAS_S_GOTO linelist { $1->SetType(BAS_N_ONGOTO); $$ = $1->Link($2, $4); delete $3; } | BAS_S_ON expression BAS_S_GO BAS_S_TO linelist { $1->SetType(BAS_N_ONGOTO); $$ = $1->Link($2, $5); delete $3; delete $4; } | BAS_S_ON expression BAS_S_GOSUB linelist { $1->SetType(BAS_N_ONGOSUB); $$ = $1->Link($2, $4); delete $3; } | BAS_S_ON expression BAS_S_GO BAS_S_SUB linelist { $1->SetType(BAS_N_ONGOSUB); $$ = $1->Link($2, $5); delete $3; delete $4; } | BAS_S_OPEN expression optfor BAS_S_AS BAS_S_FILE chexpression openlist { $$ = $1->Link($2, $3, $6, $7); delete $4; delete $5; } | BAS_S_PRINT optprint { $$ = $1->Link($2); NeedIostreamH = 1; } | BAS_S_PUT '#' expression getclause { $$ = $1->Link($3, $4); delete $2; } | BAS_S_RANDOM | BAS_S_READ readlist { $$ = $2; delete $1 } | BAS_S_RESET { $$ = $1; NeedDataList = 1; } | BAS_S_RESET '#' expression getclause { $$ = $1->Link($3, $4); delete $2; } | BAS_S_RESTORE { $$ = $1; NeedDataList = 1; } | BAS_S_RESTORE '#' expression getclause { $$ = $1->Link($3, $4); delete $2; } | BAS_S_RESUME | BAS_S_RESUME lineno { $$ = $1->Link($2); } | BAS_S_RETURN | BAS_S_RSET assignment { $$ = $1->Link($2); } | BAS_S_SLEEP expression { $$ = $1->Link($2); } | BAS_S_STOP | BAS_S_SUBEXIT | BAS_S_UNLOCK '#' expression { $$ = $1->Link($3); delete $2; } | BAS_S_UNTIL expression { $$ = $1->Link($2); } | BAS_S_UPDATE '#' expression { $$ = $1->Link($3); delete $2; } | BAS_S_WAIT expression { $$ = $1->Link($2); } | BAS_S_WHILE expression { $$ = $1->Link($2); } ; stmtnomod: BAS_S_CASE caseexprlist { $$ = $1->Link($2); } | BAS_N_CASEELSE | BAS_S_COMMON '(' BAS_V_NAME ')' funparlist { delete $2; delete $4; $$ = $1->Link($3, $5); } | BAS_S_DATA datalist { NeedDataList = 1; $$ = $1->Link($2); } | BAS_S_DECLARE declarelist { $$ = $1->Link(NULL, NULL, $2); } | BAS_S_DECLARE vartype BAS_S_CONSTANT assignlist { $$ = $1->Link($3, $2, $4); } | BAS_S_DECLARE vartype BAS_S_FUNCTION fundeflist { $$ = $1->Link($3, $2, $4); } | BAS_S_DEF optvartype fundef funequ { $$ = $1->Link($2, NULL, $3, $4); } | BAS_S_DEF '*' optvartype fundef funequ { $$ = $1->Link($3, NULL, $4, $5); delete $2; } | BAS_S_DIM opchan dimdeflist { $$ = $1->Link($3, $2); } | BAS_S_END BAS_S_FUNCTION { $1->SetType(BAS_S_FUNCTIONEND); $$ = $1; delete $2; } | BAS_S_END BAS_S_SELECT { $1->SetType(BAS_N_ENDSELECT); delete $2; $$ = $1; } | BAS_S_END BAS_S_SUB { $1->SetType(BAS_S_SUBEND); delete $2; } | BAS_S_END BAS_S_DEF { $1->SetType(BAS_S_FNEND); delete $2; } | BAS_S_END BAS_S_RECORD {$1->SetType(BAS_N_ENDRECORD); delete $2; $$ = $1; } | BAS_S_END BAS_S_RECORD BAS_V_NAME {$1->SetType(BAS_N_ENDRECORD); delete $2; $$ = $1; delete $3; } | BAS_S_END | BAS_S_EXTEND { delete $1; $$ = NULL; } | BAS_S_EXTERNAL vartype BAS_S_FUNCTION fundeflist { $1->SetType(BAS_N_EXTERNALFUNCTION); delete $3; $$ = $1->Link(NULL, $2, $4); } | BAS_S_EXTERNAL vartype BAS_S_CONSTANT variablelist { $1->SetType(BAS_N_EXTERNALCONSTANT); delete $3; $$ = $1->Link(NULL, $2, $4); } | BAS_S_EXTERNAL BAS_S_SUB fundeflist { $1->SetType(BAS_N_EXTERNALSUB); delete $2; $$ = $1->Link(NULL, $3); } | BAS_S_EXTERNAL vartype variablelist { $$ = $1->Link(NULL, $2, $3); } | BAS_S_FNEND | BAS_S_FUNCTION vartype fundef { $$ = $1->Link($2, NULL, $3); } | BAS_S_FUNCTIONEND | BAS_S_IF expression { $$ = $1->Link($2); } | BAS_S_MAP '(' BAS_V_NAME ')' maplist { delete $2; delete $4; $$ = $1->Link($3, $5); } | BAS_S_OPTION BAS_S_SIZE '=' optiontype { $$ = NULL; delete $1; delete $2; delete $3; } | BAS_S_SELECT expression { $$ = $1->Link($2); } | BAS_S_SUB fundef { $$ = $1->Link(NULL, NULL, $2); } | BAS_S_SUBEND | BAS_P_INCLUDE BAS_V_TEXTSTRING { $$ = $1->Link($2); } | BAS_P_INCLUDE BAS_P_FROM BAS_P_CDD BAS_V_TEXTSTRING { delete $1; delete $2; $$ = $3->Link($4); } | BAS_S_RECORD BAS_V_NAME { $1->Link($2); } | BAS_P_TITLE BAS_V_TEXTSTRING { $$ = $1->Link($2); } | BAS_P_SBTTL BAS_V_TEXTSTRING { $$ = $1->Link($2); } | BAS_P_IDENT BAS_V_TEXTSTRING { $$ = $1->Link($2); } | BAS_S_VARIANT | BAS_S_END BAS_S_VARIANT { $2->SetType(BAS_N_ENDVARIANT); delete $1; $$ = $2; } | vardef ; opchan: /* Empty */ { $$ = NULL; } | '#' expression ',' { $$ = $2; delete $1; delete $3; } ; vardef: vartype variablex morevartype { $$ = ($1->Link(NULL, NULL, $2))->DownLink($3); } | BAS_V_NAME variablex morevartype { $1->SetType(BAS_N_VARTYPE); $$ = ($1->Link(NULL, NULL, $2))->DownLink($3); } | vartype variablex '=' expression morevartype { $$ = $1->DownLink($2->Link(NULL, NULL, $4))-> DownLink($5); delete $3; } | BAS_V_NAME variablex '=' expression morevartype { $1->SetType(BAS_N_VARTYPE); $$ = $1->Link(NULL, NULL, $2->Link(NULL, NULL, $4))->DownLink($5); delete $3; } | BAS_S_FILL morevartype { $$ = $1->DownLink($2); } | vartype BAS_S_FILL morevartype { $$ = ($1->Link(NULL, NULL, $2))->DownLink($3); } | vartype BAS_S_FILL '=' expression morevartype { $$ = ($1->Link(NULL, NULL, $2->Link(NULL, NULL, $4)))->DownLink($5); delete $3; } | BAS_S_FILL '=' expression morevartype { $$ = ($1->Link(NULL, NULL, $3))->DownLink($4); delete $2; } ; morevartype: /* Empty */ { $$ = NULL; } | ',' vardef { delete $1; $$ = $2; } ; assignlist: assignment | assignment ',' assignlist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; assignment: aslist '=' expression { $2->SetType(BAS_N_ASSIGN); $$ = $2->Link($1, $3); } ; aslist: variable ',' aslist { $2->SetType(BAS_N_ASSIGNLIST); $$ = $2->Link($1, $3); } | variable ; forassignment: variable '=' expression { $2->SetType(BAS_N_FORASSIGN); $$ = $2->Link($1, $3); } ; chexpression: expression | '#' expression { $$ = $2; delete $1; } ; expression: variable | constant | function | BAS_V_PREDEF | BAS_S_ERR | BAS_S_ERL | expression BAS_S_EQV expression { $$ = $2->Link($1, $3); } | expression BAS_S_IMP expression { $$ = $2->Link($1, $3); } | expression BAS_S_OR expression { $$ = $2->Link($1, $3); } | expression BAS_S_XOR expression { $$ = $2->Link($1, $3); } | expression BAS_S_AND expression { $$ = $2->Link($1, $3); } | BAS_S_NOT expression %prec UMINUS { $$ = $1->Link($2); } | expression '>' expression { $$ = $2->Link($1, $3); } | expression '<' expression { $$ = $2->Link($1, $3); } | expression '=' expression { $$ = $2->Link($1, $3); } | expression BAS_X_NEQ expression { $$ = $2->Link($1, $3); } | expression BAS_X_GE expression { $$ = $2->Link($1, $3); } | expression BAS_X_LE expression { $$ = $2->Link($1, $3); } | expression '+' expression { $$ = $2->Link($1, $3); } | expression '-' expression { $$ = $2->Link($1, $3); } | expression '*' expression { $$ = $2->Link($1, $3); } | expression '/' expression { $$ = $2->Link($1, $3); } | expression '^' expression { $$ = $2->Link($1, $3); } | '-' expression %prec UMINUS { $1->SetType(BAS_N_UMINUS); $$ = $1->Link($2); } | '+' expression %prec UMINUS { $1->SetType(BAS_N_UPLUS); $$ = $1->Link($2); } | '(' expression ')' { delete $3; $$ = $1->Link($2); } ; prenexprlist: variable | '(' exprlist ')' {$$ = $2; delete $1; delete $3; } ; exprlist: /* Empty */ { $$ = NULL; } | expression | expression ',' exprlist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } | nullexpr ',' exprlist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; closelist: /* Empty */ { $$ = NULL; } | expression {$$ = (new Node(BAS_S_CLOSE, "", 0))->Link($1); } | closelist ',' closelist { delete $2; $$ = $1->DownLink($3); } ; datalist: /* Empty */ { $$ = NULL; } | dataitem | dataitem ',' datalist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } | nullexpr ',' datalist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; dataitem: constant | '-' constant { $1->SetType(BAS_N_UMINUS); $$ = $1->Link($2); } | BAS_V_NAME ; paramlist: /* Empty */ { $$ = NULL; } | expressionx | expressionx ',' paramlist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } | nullexpr ',' paramlist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; caseexprlist: /* Empty */ { $$ = NULL; } | caseexpression | caseexpression ',' caseexprlist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; caseexpression: expression | '=' expression { delete $1; $$=$2; } | '<' expression { $1->SetType(BAS_X_UNARYLT); $$ = $1->Link($2); } | BAS_X_LE expression { $1->SetType(BAS_X_UNARYLE); $$ = $1->Link($2); } | '>' expression { $1->SetType(BAS_X_UNARYGT); $$ = $1->Link($2); } | BAS_X_GE expression { $1->SetType(BAS_X_UNARYGE); $$ = $1->Link($2); } | BAS_X_NEQ expression { $1->SetType(BAS_X_UNARYNEQ); $$ = $1->Link($2); } | expression BAS_S_TO expression { $$ = $2->Link($1, $3); } ; expressionx: expression | expression BAS_S_BY tranmech { $$ = $2->Link($1, $3); } ; nullexpr: /* Empty */ {$$ = NULL; } ; linelist: lineno | lineno ',' linelist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; lineno: BAS_V_NAME { $1->SetType(BAS_V_USELABEL); $$ = $1; } | BAS_V_INTEGER { $1->SetType(BAS_V_USELABEL); $$ = $1; } | BAS_V_INT { $1->SetType(BAS_V_USELABEL); $$ = $1; } | BAS_S_OTHERWISE lineno { $$ = $1->Link($2); } ; variablelist: variable ',' variablelist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } | variable ; readlist: readlist ',' readlist { delete $2; $$ = $1->DownLink($3); } | variable {$$ = (new Node(BAS_S_READ, "", 0))->Link($1); } ; variable: variablex | variable BAS_X_STRREF variabley { $$ = $2->Link($1, $3); } ; variablex: BAS_V_NAME | BAS_V_NAME '(' paramlist ')' { if ($3 == NULL) { $2->SetType(BAS_N_NULL); $$ = $1->Link($2); } else { $$ = $1->Link($3); delete $2; } delete $4; } ; variabley: BAS_V_NAME { $1->SetType(BAS_N_STRUCTNAME); $$ = $1; } | BAS_V_NAME '(' paramlist ')' { $1->SetType(BAS_N_STRUCTNAME); if ($3 == NULL) { $2->SetType(BAS_N_NULL); $$ = $1->Link($2); } else { $$ = $1->Link($3); delete $2; } delete $4; } ; constant: BAS_V_INT | BAS_V_INTEGER | BAS_V_FLOAT | BAS_V_TEXTSTRING ; function: BAS_V_FUNCTION '(' paramlist ')' { $$ = $1->Link($3); delete $2; delete $4; } | vartypetwo '(' expression ',' vartypeone ')' { $1->SetType(BAS_N_TYPEFUN); $$ = $1->Link($3, $5); delete $2; delete $4; delete $6; } ; optfor: /* null */ { $$ = NULL } | BAS_S_FOR BAS_S_INPUT { $$ = $2; delete $1; } | BAS_S_FOR BAS_S_OUTPUT { $$ = $2; delete $1; } ; optiontype: '(' optionlist ')' { delete $1; delete $3; $$ = NULL; } | BAS_S_INTEGER BAS_S_BYTE { IntegerType = VARTYPE_BYTE; delete $1; delete $2; $$ = NULL; } | BAS_S_INTEGER BAS_S_WORD { IntegerType = VARTYPE_WORD; delete $1; delete $2; $$ = NULL; } | BAS_S_INTEGER BAS_S_LONG { IntegerType = VARTYPE_LONG; delete $1; delete $2; $$ = NULL; } | BAS_S_REAL BAS_S_SINGLE { RealType = VARTYPE_SINGLE; delete $1; delete $2; $$ = NULL; } | BAS_S_REAL BAS_S_DOUBLE { RealType = VARTYPE_DOUBLE; delete $1; delete $2; $$ = NULL; } | BAS_S_REAL BAS_S_GFLOAT { RealType = VARTYPE_GFLOAT; delete $1; delete $2; $$ = NULL; } | BAS_S_REAL BAS_S_HFLOAT { RealType = VARTYPE_HFLOAT; delete $1; delete $2; $$ = NULL; } ; optionlist: optiontype ',' optionlist { delete $2; $$ = NULL; } | optiontype { $$ = NULL; } ; optvartype: /* Null */ { $$ = NULL; } | vartype ; vartype: vartypeone | vartypetwo ; vartypeone: BAS_S_BYTE | BAS_S_DOUBLE | BAS_S_GFLOAT | BAS_S_HFLOAT | BAS_S_LONG | BAS_S_WORD ; vartypetwo: BAS_S_INTEGER | BAS_S_REAL | BAS_S_STRING | BAS_S_RFA | BAS_S_DECIMAL '(' exprlist ')' { delete $2; delete $4; delete $3; $$ = $1; } ; fundeflist: fundef | fundeflist ',' fundef { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; fundef: BAS_V_NAME funby { $1->SetType(BAS_V_FUNCTION); $$ = $1; } | BAS_V_NAME funby '(' funparlist ')' { $1->SetType(BAS_V_FUNCTION); $$ = $1->Link($4); delete $3; delete $5; } ; funby: { $$ = NULL; } /* This stuff Ignored for now */ | BAS_S_BY tranmech { delete $1; delete $2; $$ = NULL; } ; funparlist: { $$ = NULL; } | funpar | funparlist ',' funpar { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; funpar: funpara { $$ = $1; } | funpara BAS_S_BY tranmech { $$ = $2->Link($1, $3); } ; funpara: vartype fundim funsiz { $$ = $1->Link(NULL, $2, $3); } | vartype BAS_V_NAME fundim funsiz { $$ = $1->Link($4, $3, $2); } | BAS_V_NAME fundim funsiz { $$ = $1->Link(NULL, $2, $3); } | BAS_V_NAME BAS_V_NAME fundim funsiz { $1->SetType(BAS_N_VARTYPE); $$ = $1->Link($4, $3, $2); } ; fundim: /* Empty */ { $$ = NULL; } | BAS_S_DIM '(' fundimcom ')' { delete $2; delete $4; $$ = $1->Link($3); } | '(' fundimcom ')' { delete $1; delete $2; $$ = $2; } ; fundimcom: /* empty */ { $$ = NULL; } | expression { $$ = $1; } | ',' fundimcom { $1->SetType(BAS_N_LIST); $$ = $1->Link(NULL, $2); } | expression ',' fundimcom { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; funsiz: /* empty */ { $$ = NULL; } | '=' expression { $$ = $2; delete $1; } ; funequ: /* Empty */ { $$ = NULL; } | '=' expression { $1->SetType(BAS_N_ASSIGN); $$ = $1->Link(NULL, $2); } ; declarelist: needvartype varnamelist { $$ = $1->Link($2); } ; needvartype: vartype | BAS_V_NAME { $1->SetType(BAS_N_VARTYPE); $$=$1; } ; varnamelist: varname | varname ',' varnamelist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; varname: BAS_V_NAME dimsz { $$ = $1->Link(NULL, NULL, $2); } | BAS_V_NAME dimdim dimsz { $$ = $1->Link($2, NULL, $3); } ; maplist: maplistone | maplist ',' maplistone { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; maplistone: mapnamelist | needvartype mapnamelist { $$ = $1->Link($2); } ; mapnamelist: mapname | mapname ',' mapnamelist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; mapname: BAS_V_NAME dimdim dimsz { $$ = $1->Link($2, NULL, $3); } | BAS_V_NAME dimsz { $$ = $1->Link(NULL, NULL, $2); } ; dimdeflist: dimdef | dimdef ',' dimdeflist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; dimdef: vartype dimdim dimsz { $$ = $1->Link($2, NULL, $3); } | vartype BAS_V_NAME dimdim dimsz { $$ = $2->Link($3, $1, $4); } | BAS_V_NAME dimdim dimsz { $$ = $1->Link($2, NULL, $3); } | BAS_V_NAME BAS_V_NAME dimdim dimsz { $1->SetType(BAS_N_VARTYPE); $$ = $2->Link($3, $1, $4); } ; dimdim: '(' exprlist ')' { $$ = $2; delete $1; delete $3; } ; dimsz: /* Empty */ { $$ = NULL; } | '=' expression { $$ = $2; delete $1; } ; getclause: /* empty */ { $$ = NULL; } | ',' BAS_S_RECORD expression getclause { $1->SetType(BAS_N_LIST); $2->SetType(BAS_V_RMSRECORD); $$ = $1->Link($2->Link($3), $4); } | ',' BAS_S_REGARDLESS getclause { $1->SetType(BAS_N_LIST); $$ = $1->Link($2, $3); } | ',' BAS_S_KEY '#' expression getclause { $1->SetType(BAS_N_LIST); delete $3; $$ = $1->Link($2->Link($4), $5); } | ',' BAS_S_KEY '#' expression BAS_S_EQ expression getclause { $1->SetType(BAS_N_LIST); delete $3; $$ = $1->Link($2->Link($4, $5, $6), $7); } | ',' BAS_S_KEY '#' expression BAS_S_GE expression getclause { $1->SetType(BAS_N_LIST); delete $3; $$ = $1->Link($2->Link($4, $5, $6), $7); } | ',' BAS_S_KEY '#' expression BAS_S_GT expression getclause { $1->SetType(BAS_N_LIST); delete $3; $$ = $1->Link($2->Link($4, $5, $6), $7); } | ',' BAS_S_RFA expression getclause { $1->SetType(BAS_N_LIST); $$ = $1->Link($2->Link($3), $4); } | ',' BAS_S_COUNT expression getclause { $1->SetType(BAS_N_LIST); $$ = $1->Link($2->Link($3), $4); } | ',' BAS_S_BLOCK expression getclause { $1->SetType(BAS_N_LIST); $$ = $1->Link($2->Link($3), $4); } ; optprint: optprint1 { $$ = $1; } | optprint1 hemisemi optprint { $$ = $2->Link($1, $3); } ; optprint1: /* Empty */ { $$ = NULL; } | '#' expression { $$ = $1->Link($2); } | BAS_S_USING expression { $$ = $1->Link($2); } | '#' expression BAS_S_USING expression { $1->Link($2); $3->Link($4); $$ = (new Node(BAS_N_LIST, ";", 0))-> Link($1, $3); } | BAS_S_RECORD expression { $1->SetType(BAS_N_RECORD); $$ = $1->Link($2); } | BAS_S_COUNT expression { $$ = $1->Link($2); } | expression { $$ = $1; } ; optinput: optinput1 { $$ = $1; } | optinput1 hemisemi optinput { $$ = $2->Link($1, $3); } ; optinput1: /* Empty */ { $$ = NULL; } | '#' expression { $$ = $1->Link($2); } | expression { $$ = $1; } ; hemisemi: ',' { $1->SetType(BAS_N_LIST); $$ = $1; } | ';' { $1->SetType(BAS_N_LIST); $$ = $1; } ; tranmech: BAS_S_VALUE | BAS_S_DESC | BAS_S_REF ; openlist: /* Empty */ { $$ = NULL; } | openitem openlist { $$ = $1->DownLink($2); } ; openitem: ',' BAS_S_ORGANIZATION orgclause { $$ = $2->Link($3); delete $1; } | ',' BAS_S_ALLOW allowtype { $$ = $2->Link($3); delete $1; } | ',' BAS_S_ACCESS allowtype { $$ = $2->Link($3); delete $1; } | ',' BAS_S_RECORDTYPE recordtype { $$ = $2->Link($3); delete $1; } | ',' BAS_S_RECORDSIZE expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_FILESIZE expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_WINDOWSIZE expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_TEMPORARY { $$ = $2; delete $1; } | ',' BAS_S_CONTIGUOUS { $$ = $2; delete $1; } | ',' BAS_S_MAP variable { $$ = $2->Link($3); delete $1; } | ',' BAS_S_CONNECT expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_BUFFER expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_DEFAULTNAME expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_EXTENDSIZE expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_BLOCKSIZE expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_NOREWIND { $$ = $2; delete $1; } | ',' BAS_S_NOSPAN { $$ = $2; delete $1; } | ',' BAS_S_SPAN { $$ = $2; delete $1; } | ',' BAS_S_BUCKETSIZE expression { $$ = $2->Link($3); delete $1; } | ',' BAS_S_PRIMARY BAS_S_KEY prenexprlist dupcha { delete $1; delete $3; $$ = $2->Link($4); } | ',' BAS_S_PRIMARY prenexprlist dupcha { delete $1; $$ = $2->Link($3); } | ',' BAS_S_ALTERNATE BAS_S_KEY prenexprlist dupcha { delete $1; delete $3; $$ = $2->Link($4); } | ',' BAS_S_MODE expression { delete $1; $$ = $2->Link($3); } ; orgclause: BAS_S_INDEXED orgtype {$$ = $1->Link($2); } | BAS_S_RELATIVE orgtype {$$ = $1->Link($2); } | BAS_S_VIRTUAL orgtype {$$ = $1->Link($2); } | BAS_S_SEQUENTIAL orgtype {$$ = $1->Link($2); } | BAS_S_UNDEFINED orgtype {$$ = $1->Link($2); } ; orgtype: /* Empty */ { $$ = NULL; } | BAS_S_STREAM | BAS_S_VARIABLE | BAS_S_FIXED ; allowtype: BAS_S_NONE | BAS_S_READ | BAS_S_WRITE | BAS_S_MODIFY | BAS_S_APPEND | BAS_S_SCRATCH ; recordtype: BAS_S_LIST | BAS_S_FORTRAN | BAS_S_NONE | BAS_S_ANY ; dupcha: /* Empty */ { $$ = NULL; } | BAS_S_NODUPLICATES dupcha { $$ = $1->Link($2); } | BAS_S_DUPLICATES dupcha { $$ = $1->Link($2); } | BAS_S_CHANGES dupcha { $$ = $1->Link($2); } | BAS_S_NOCHANGES dupcha { $$ = $1->Link($2); } ; fieldlist: /* Empty */ { $$ = NULL; } | fielditem | fielditem ',' fieldlist { $2->SetType(BAS_N_LIST); $$ = $2->Link($1, $3); } ; fielditem: expression BAS_S_AS variablex { $$ = $2->Link($1, $3); } ; %% /* * Display error messages */ int yyerror(char *s) { cerr << "Parse error: " << s << " near line " << xline << endl; if (include_stack_pointer > 0) { cout << " in included file " << include_name[include_stack_pointer - 1] << endl; } return 0; } printusing.c100644 765 144 3635 6263644734 12172 0ustar kevinusers/* * Fucntions to process a print using format field */ static void UsingStringAttach(char* Output, const char* Value, int Size, int Position); int UsingString(const char* Format, const char* Value, char* Output) { int OutLength = 0; /* Current length of output file */ int FormatPtr = 0; /* Pointer into format string */ int Size = 0; /* Size available to output string */ int Position; /* 0=Left, 1=Right, 2=Center */ char FormatChar; /* Format character to use */ /* * Scan over characters that won't start the format */ while (Format[FormatPtr] != '\0') { switch (Format[FormatPtr]) { case '/': FormatPtr++; Size = 2; Output[OutputLength + 1] = '\0'; while ((Format[FormatPtr] != '\0') && (Format[FormatPtr] != '/')) { Size++; FormatPtr++; } UsingStringAttach(Output, Value, Size, 0); OutputLength = strlen(Output); FormatPtr++; break; case '\'': FormatPtr++; Size = 1; Output[OutputLength + 1] = '\0'; FormatChar = Format[FormatPtr]; switch { case 'c': case 'C': Position = 1; break; case 'l': case 'L': Position = 0; break; case 'r': case 'R': Position = 2; break; default: FormatChar = 0; break; } while (Format[FormatPtr] == FormatChar) { Size++; FormatPtr++; } UsingStringAttach(Output, Value, Size, Position); OutputLength = strlen(Output); break; case '!': FormatPtr++; if (Value[0] != '\0') { Output[OutputLength++] = Value[0]; } else { Output[OutputLength++] = ' '; } break; default: Output[OutLength++] = Format[FormatPtr++]; break; } } } static void UsingStringAttach(char* Output, const char* Value, int Size, int Position) { int NeedSpaces; /* Spaces needed to get proper length */ int OutputPos = strlen(Output); NeedSpaces = Size - strlen(Value); if (NeedSpaces < 0) { NeedSpaces = 0; } } shellsort.bas100644 765 144 742 6227567716 12312 0ustar kevinusers10 dim a%(1000%) n% = 200% a%(i%) = rnd * 10000. for i% = 1% to n% print "Original List" print a%(i%), for i% = 1% to n% print h% = 1% h% = h% * 3% + 1% until h% > n% 100 h% = h% / 3% for i% = h% + 1% to n% v% = a%(i%) j% = i% while (a%(j%-h%) > v%) a%(j%) = a%(j% - h%) j% = j% - h% goto 105 if (j% < h%) next 105 a%(j%) = v% next i% 110 goto 100 unless h% = 1% print print "Sorted List" print a%(i%), for i% = 1% to n% print 32767 end strbubblesort.bas100644 765 144 1114 6263654541 13172 0ustar kevinusers10 ! ! Lets test a bunch of the string functions with a simple ! bubble sort routine. Lot's of exchanges and comparisons, ! input, and output. ! dim a$(200%) n% = 0% 20 print "String: "; input a$ if a$ <> "." then n% = n% + 1% a$(n%) = a$ goto 20 end if print "Starting lineup" print a$(i%) for i% = 1% to n% print print "Sorted list" 100 for i% = 1% to n% for j% = 1% to n% - 1% if (a$(j%) > a$(j%+1%)) then temp$ = a$(j%) a$(j%) = a$(j% + 1%) a$(j% + 1%) = temp$ end if next j% next i% print a$(i%) for i% = 1% to n% 32767 end strdef.h100644 765 144 17453 6242161020 11262 0ustar kevinusers/* * str.h * * Code for VAX STR$ routines * * Description: * * This file contains various 'str$' functions equivalent * to those available in Vax/VMS string library. * * Bugs: * * Not compatible at the binary level. * * No seperate "string zone" to allocate memory from, * uses malloc/free instead. * * History * * Oct 10, 1996 - Kevin Handy * Preliminary design */ /* * Used for differences between C and C++ */ #ifdef __cplusplus #define PROTO #else #define PROTO #endif #define DOSIGNAL(x) assert(x && 0) #ifndef min #define min(x,y) ((x)<(y) ? (x) : (y)) #define max(x,y) ((x)>(y) ? (x) : (y)) #endif /* * String error messages */ #define STR$_FACILITY 36 #define STR$_FATINTERR 2392132 #define STR$_DIVBY_ZER 2392140 #define STR$_ILLSTRCLA 2392148 #define STR$_STRIS_INT 2392156 #define STR$_WRONUMARG 2392164 #define STR$_INSVIRMEM 2392172 #define STR$_STRTOOLON 2392180 #define STR$_ERRFREDYN 2392188 #define STR$_TRU 2392576 #define STR$_NOMATCH 2392584 #define STR$_INVDELIM 2392592 #define STR$_NOELEM 2392600 #define STR$_NEGSTRLEN 2393089 #define STR$_ILLSTRPOS 2393097 #define STR$_ILLSTRSPE 2393105 #define STR$_MATCH 2393113 #define STR$_NORMAL 1 /* * Constants */ extern const unsigned long str$_facility; extern const unsigned long str$_fatinterr; extern const unsigned long str$_divby_zer; extern const unsigned long str$_errfredyn; extern const unsigned long str$_illstrcla; extern const unsigned long str$_illstrpos; extern const unsigned long str$_illstrspe; extern const unsigned long str$_insvirmem; extern const unsigned long str$_invdelim; extern const unsigned long str$_match; extern const unsigned long str$_negstrlen; extern const unsigned long str$_noelem; extern const unsigned long str$_nomatch; extern const unsigned long str$_normal; extern const unsigned long str$_strtoolon; extern const unsigned long str$_stris_int; extern const unsigned long str$_tru; extern const unsigned long str$_wronumarg; /* * Prototypes */ PROTO unsigned long str$add(const unsigned long* asign, const long* aexp, const struct dsc$descriptor_s* adigits, const unsigned long* bsign, const long* bexp, const struct dsc$descriptor_s* bdigits, unsigned long* csign, long* cexp, struct dsc$descriptor_s* cdigits); PROTO void str$analyze_sdesc(const struct dsc$descriptor_s* input_descriptor, unsigned short* word_integer_length, char** data_address); PROTO unsigned long str$append(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string); PROTO long str$case_blind_compare( const struct dsc$descriptor_s* first_source_string, const struct dsc$descriptor_s* second_source_string); PROTO long str$compare( const struct dsc$descriptor_s* first_source_string, const struct dsc$descriptor_s* second_source_string); PROTO long str$compare_eql( const struct dsc$descriptor_s* first_source_string, const struct dsc$descriptor_s* second_source_string); PROTO long str$compare_multi( const struct dsc$descriptor_s* first_source_string, const struct dsc$descriptor_s* second_source_string, const long* flags_value, const long* foreign_language); PROTO unsigned long str$concat(struct dsc$descriptor_s* destination_string, ...); PROTO unsigned long str$copy_dx(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string); PROTO unsigned long str$copy_r(struct dsc$descriptor_s* destination_string, const short* word_integer_source_length, const void* source_string_address); PROTO unsigned long str$divide( const unsigned long* asign, const long* aexp, const struct dsc$descriptor_s* a_digits, const unsigned long* bsign, const long* bexp, const struct dsc$descriptor_s* b_digits, const long* total_digits, const long* round_truncate_indicator, unsigned long* csign, long* cexp, struct dsc$descriptor_s* cdigits); PROTO unsigned long str$dupl_char(struct dsc$descriptor_s* destination_string, const long* repetition_count, const char* ascii_character); PROTO unsigned long str$element(struct dsc$descriptor_s* destination_string, const long* element_number, const struct dsc$descriptor_s* delimiter_string, const struct dsc$descriptor_s* source_string); PROTO long str$find_first_in_set(const struct dsc$descriptor_s* source_string, const struct dsc$descriptor_s* set_of_characters); PROTO long str$find_first_not_in_set( const struct dsc$descriptor_s* source_string, const struct dsc$descriptor_s* set_of_characters); PROTO unsigned long str$find_first_substring( const struct dsc$descriptor_s* source_string, long* index, long* substring_index, ...); PROTO unsigned long str$free1_dx(struct dsc$descriptor_s* string_descriptor); PROTO unsigned long str$get1_dx(unsigned short* word_integer_length, struct dsc$descriptor_s* character_string); PROTO unsigned long str$left(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string, const long* end_position); PROTO unsigned long str$len_extr(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string, const long* start_position, const long* longword_integer_length); PROTO unsigned long str$match_wild(const struct dsc$descriptor_s* candidate_string, const struct dsc$descriptor_s* pattern_string); PROTO unsigned long str$mul(const unsigned long* asign, const long aexp, const struct dsc$descriptor_s* adigits, const unsigned long* bsign, const long* bexp, const struct dsc$descriptor_s* bdigits, unsigned long* csign, long* cexp, struct dsc$descriptor_s* cdigits); PROTO unsigned long str$position(const struct dsc$descriptor_s* source_string, const struct dsc$descriptor_s* substring, long* start_position); PROTO unsigned long str$pos_extr(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* cource_string, const long* start_position, const long* end_position); PROTO unsigned long str$prefix(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string); PROTO unsigned long str$recip( const unsigned long* asign, const long* aexp, const struct dsc$descriptor_s* adigits, const unsigned long* bsign, const long* bexp, const struct dsc$descriptor_s* bdigits, unsigned long* csign, long* cexp, struct dsc$descriptor_s* cdigits); PROTO unsigned long str$replace(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string, const long* start_position, const long* end_position, const struct dsc$descriptor_s* replacement_string); PROTO unsigned long str$right(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string, const long* start_position); PROTO unsigned long str$round(const long* places, unsigned long* flags, const unsigned long* asign, const long* aexp, const struct dsc$descriptor_s* adigits, const unsigned long* bsign, const long* bexp, const struct dsc$descriptor_s* bdigits, unsigned long* csign, long* cexp, struct dsc$descriptor_s* cdigits); PROTO unsigned long str$translate(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string, const struct dsc$descriptor_s* translation_string, const struct dsc$descriptor_s* match_string); PROTO unsigned long str$trim(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string, unsigned short* resultant_length); PROTO unsigned long str$upcase(struct dsc$descriptor_s* destination_string, const struct dsc$descriptor_s* source_string); /* * Some special functions that are not really part of str$, * but are used internally be them */ PROTO unsigned long str$$is_string_class( const struct dsc$descriptor_s* test_string); PROTO unsigned int str$$resize(struct dsc$descriptor_s* dest, short int size); PROTO unsigned long str$$copy_fill(char* dest_ptr, unsigned short dest_length, const char* source_ptr, unsigned short source_length, char fill); test.bas100644 765 144 425 6262663507 11242 0ustar kevinusers1 a$ = "This is" b$ = " a test" a% = 7% a = 6 print right(a$, 3) + b$, a%, a print "Mid("; i%; ")"; mid("This is a test", i%, 3%); & " len "; len(mid("This is a test", i%, 3%)) & for i% = 1% to 19% test$ = "X" print string$(i%, test$) for i% = 1% to 10% end variable.cc100644 765 144 16002 6242161046 11713 0ustar kevinusers/******************************************************************************* Program: variable.cc 01.00.00 Title: Routines to handle variables. Description: This file contains routines to handle the variable definitions necessary for basic. Bugs: History: 01.01.00 - 08/30/1996 - Kevin Handy Update version number to 1.1, and update on internet. 01.01.01 - 10/22/1996 - Kevin Handy Handle new 'IntegerType' and 'RealType' variables. *******************************************************************************/ /* * System Include Files */ #include #include #include #include #include // // Project Include Files // #include "variable.h" #include "basic.h" #include "parse.h" // // Module #defined Constants // // // Module #defined Functions // // // Module Structure Definitions // // // Module Function Prototypes // // // Module Variables // /******************************************************************************* Member Function: VariableStruct() Title: Constructs a variable item. Description: This routine fill add a variable to the variable table. Bugs: *******************************************************************************/ VariableStruct::VariableStruct ( char *VarName, int newType, int newClass, int newOutput ) { BasicName = NULL; Type = newType; Class = newClass; CName = NULL; Output = newOutput; Left = NULL; Right = NULL; // Array = NULL; EverUsed = 0; // // Allocate space for variable name // if (VarName) { char* ThisName = new char[strlen(VarName)+1]; strcpy(ThisName, VarName); BasicName = ThisName; } } /******************************************************************************* Member Function: ~VariableStruct() Title: Destruct a variable. Description: Destroys variables. Bugs: *******************************************************************************/ VariableStruct::~VariableStruct() { delete BasicName; delete CName; } /******************************************************************************* Member Function: Dump() Title: Print out variable. Description: Prints out a variables information. Bugs: Ugly output. *******************************************************************************/ void VariableStruct::Dump() { // // Print out this variable // cout << "Var: " << BasicName; if (Class == VARCLASS_ARRAY) { cout << "[]"; } cout << ", Type " << Type; switch (Type) { case VARTYPE_DYNSTR: cout << " Dynamic String"; break; case VARTYPE_FIXSTR: cout << " Fixed length string"; break; case VARTYPE_WORD: cout << " 16 bit integer"; break; case VARTYPE_INTEGER: cout << " integer (" << IntegerType << ")"; break; case VARTYPE_LONG: cout << " 32 bit integer"; break; case VARTYPE_REAL: cout << " float(" << RealType << ")"; break; case VARTYPE_DOUBLE: cout << " double"; break; case VARTYPE_STRUCT: cout << " Structure"; break; case VARTYPE_VOID: cout << " Void"; break; case VARTYPE_BYTE: cout << " Byte"; break; case VARTYPE_RFA: cout << " RFA"; break; case VARTYPE_LABEL: cout << " Label"; break; case VARTYPE_DECIMAL: cout << " Decimal"; break; case VARTYPE_SINGLE: cout << " Single"; break; case VARTYPE_GFLOAT: cout << " GFloat"; break; case VARTYPE_HFLOAT: cout << " HFloat"; break; default: cout << " Undefined"; break; } cout << ", Class " << Class; switch (Class) { case VARCLASS_NONE: cout << " Regular variable"; break; case VARCLASS_ARRAY: cout << " An Array"; break; case VARCLASS_FUNC: cout << " Function"; break; case VARCLASS_CONST: cout << " Constant"; break; default: cout << " Undefined"; break; } if (CName != 0) { cout << ", CName " << CName; if (Class == VARCLASS_ARRAY) { cout << "[]"; } } cout << endl; } /******************************************************************************* Member Function: VariableStruct::OutputDef() Title: Dump out one variable node. Description: This function will output one variables definition to the output file. These are only used if the definition isn't output as part of the source code. Bugs: *******************************************************************************/ void VariableStruct::OutputDef ( ostream& os, int Level ) { // // Local Variables // char* OldSep; int ActualType = Type; // // Skip if already output // if (Output == TRUE) { return; } // // Tab over // Indent(os, Level); // // Validation Check // assert(BasicName != 0); // // Output This Variable // switch (Class) { case VARCLASS_CONST: os << "const "; break; } // // Change "Integer" and "Real" to more exact type // switch(ActualType) { case VARTYPE_INTEGER: ActualType = IntegerType; break; case VARTYPE_REAL: ActualType = RealType; break; } switch(ActualType) { case VARTYPE_DYNSTR: os << "BString "; break; case VARTYPE_FIXSTR: os << "char "; break; case VARTYPE_INTEGER: os << "intx "; break; case VARTYPE_WORD: os << "short int "; break; case VARTYPE_LONG: os << "long "; break; case VARTYPE_REAL: os << "floatx "; break; case VARTYPE_DOUBLE: os << "double "; break; case VARTYPE_VOID: os << "void "; break; case VARTYPE_BYTE: os << "char "; break; case VARTYPE_RFA: os << "RFA "; break; case VARTYPE_DECIMAL: os << "Decimal "; break; case VARTYPE_SINGLE: os << "float "; break; case VARTYPE_GFLOAT: os << "double "; break; case VARTYPE_HFLOAT: os << "long double "; break; default: os << "unknown "; break; } // // Pick a good name // if (CName != 0) { os << CName; } else { os << BasicName; } switch(Type) { case VARTYPE_FIXSTR: os << "[]"; break; } // // Add brackets if this is an array definition // switch (Class) { case VARCLASS_ARRAY: // // Default array dimension under Basic is 0..10 // for most Basic's I've seen. // os << "[11]"; break; case VARCLASS_FUNC: os << "()"; break; } os << ";" << endl; // // Flag this one as having been output. // Output = TRUE; } /******************************************************************************* Local Function: Indent() Title: Indents to current level. Description: This function is used to indent the code. Bugs: *******************************************************************************/ void VariableStruct::Indent(ostream& os, int Level) { int TabLoop; for (TabLoop = 1; TabLoop <= Level; TabLoop++) { os << "\t"; } } /******************************************************************************* Member Function: SetCName() Title: Sets up the C Variable Name. Description: Assigned the C variable name. Bugs: *******************************************************************************/ void VariableStruct::SetCName(const char* NewName) { // // Lose old value // delete CName; // // Move over new value // CName = new char[strlen(NewName) + 1]; strcpy(CName, NewName); } variable.h100644 765 144 7100 6242161020 11524 0ustar kevinusers/******************************************************************************* Program: Variable.h 01.01 Title: Header file for variable table Description: This is the header file for the variable table/ Bugs: Lousy. Needs complete re-write History: 01.01.02 - 10/22/1996 - Kevin Handy Added 'SINGLE', "GFLOAT', HFLOAT' types. *******************************************************************************/ // // Variable.h - Some stuff just in case if isn't defined anywhere else // #ifndef _VARIABLE_H_ #define _VARIABLE_H_ #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif // // Include files // #include #include "nodes.h" /* * Variable Type Definitions */ #define VARTYPE_DYNSTR 1 /* Dynamic String */ #define VARTYPE_FIXSTR 2 /* Fixed length string */ #define VARTYPE_WORD 3 /* 16 bit integer */ #define VARTYPE_INTEGER 4 /* 16 bit integer */ #define VARTYPE_LONG 5 /* 32 bit integer */ #define VARTYPE_REAL 6 /* float type */ #define VARTYPE_DOUBLE 7 /* double type */ #define VARTYPE_STRUCT 8 /* Structure */ #define VARTYPE_VOID 9 /* Void (no) return */ #define VARTYPE_BYTE 10 /* Byte (char) */ #define VARTYPE_RFA 11 /* RFA */ #define VARTYPE_LABEL 12 /* Label */ #define VARTYPE_DECIMAL 13 /* Label */ #define VARTYPE_SINGLE 14 /* Single precision float */ #define VARTYPE_GFLOAT 15 /* GFloat floating point */ #define VARTYPE_HFLOAT 16 /* HFloat floating point */ #define VARCLASS_NONE 0 /* Regular variable */ #define VARCLASS_ARRAY 1 /* An Array */ #define VARCLASS_FUNC 2 /* Function */ #define VARCLASS_CONST 3 /* Constant */ #define VARCLASS_LABEL 4 /* Label */ // // Structure defining variables // class VariableStruct { public: char *BasicName; /* Name used in BASIC */ int Type; /* Type (integer, real, ...) */ int Class; /* Variable Class (function, array, ...) */ char *CName; /* Name to be used in C */ int Output; /* Already output to source? */ struct VariableStruct *Left; /* Pointer to next variable (Less) */ struct VariableStruct *Right; /* Pointer to next variable (Greater) */ // Node *Array; /* Array Definition Info */ int EverUsed; /* Is it ever used (Label) */ public: VariableStruct(char *VarName = "", int Type = 0, int Class = 0, int Output = FALSE); ~VariableStruct(); VariableStruct *VariableAdd(); void Dump(); void OutputDef(ostream& os, int Level); char* GetName() { if (CName != "") return CName; else return BasicName; } void SetCName(const char* NewName); void SetClass(const int NewClass) { Class = NewClass; } private: void Indent(ostream& os, int Level); }; // // Class that holds a list of variables class VariableList { private: VariableStruct* Global; VariableStruct* Local; public: VariableList(); ~VariableList(); void VariableList::InitFunctions(void); void InitOneFunction(char *BasName, char *CName, int Type); VariableList* Append(VariableStruct* Variable, int GlobalFlag = FALSE); VariableStruct *Lookup(char *VarName, Node *ArrayRef); VariableStruct *LookupCpp(char *VarName); int LookupReserved(char *VarName); void Define(Node *ThisNode, int GlobalFlag = FALSE, int ThisOutput = FALSE); void Dump(); void Fixup(); void OutputDef(ostream& os, int Level); void ClearLocal(); private: void Fixup1(VariableStruct* Variable); void Fixup2(VariableStruct* Variable); void Fixup3(VariableStruct* Variable); VariableStruct *LookupCppTree(VariableStruct* Variable, char *VarName); void VariableList::DumpTree(VariableStruct* Variable); void VariableList::DeleteTree(VariableStruct* Node); void VariableList::OutputDefTree(ostream& os, VariableStruct* VarTable, int Level); }; #endif varlist.cc100644 765 144 52354 6264103371 11625 0ustar kevinusers/******************************************************************************* Program: varlist.cc 01.00.00 Title: Routines to handle variables. Description: This file contains routines to handle the variable definitions necessary for basic. Bugs: History: 01.01.00 - 08/30/1996 - Kevin Handy Update version to 1.1, and install on internet. 01.01.01 - 10/09/1996 - Kevin Handy Changes "ascii" from "(char)(x)" to "Ascii(x)". 01.01.02 - 10/20/1996 - Kevin Handy Output 'sqrt' instead of 'sqr' for square root. Added several more functions to table. 01.02.01 - 01/01/1997 - Kevin Handy Output Qstring when STRING$() is callewd, because of problems with existing c++ functions. Also Qspace for space. 01.02.02 - 01/02/1997 - Kevin Handy Output "trm" instead of "trim" for the trim function 01.02.03 - 01/05/1997 - Kevin Handy Handle num$ and num1$ as Qnum and Qnum1. *******************************************************************************/ /* * System Include Files */ #include #include #include #include #include // // Project Include Files // #include "variable.h" #include "basic.h" #include "parse.h" // // Module #defined Constants // // // Module #defined Functions // // // Module Structure Definitions // // // Module Function Prototypes // // // Module Variables // /******************************************************************************* Member Function: VariableList() Title: Constructs a variable list. Description: This routine creates a variable list. Bugs: *******************************************************************************/ VariableList::VariableList() { Global = NULL; Local = NULL; // // Load in hard coded function list // InitFunctions(); } /******************************************************************************* Member Function: ~VariableList() Title: Destruct a variable List. Description: Destroys variable Lists. Bugs: *******************************************************************************/ VariableList::~VariableList() { DeleteTree(Local); DeleteTree(Global); } void VariableList::DeleteTree(VariableStruct* Nodex) { if (Nodex != NULL) { if (Nodex->Left != NULL) { DeleteTree(Nodex->Left); } if (Nodex->Right != NULL) { DeleteTree(Nodex->Right); } delete Nodex; } } /******************************************************************************* Member Function: VariableList::Lookup() Title: Look for a variable in the table using it's basic name. Description: This routine will scan the variable table for the occurance of a specified variable. Bugs: *******************************************************************************/ VariableStruct *VariableList::Lookup ( char *VarName, Node *ArrayRef ) { VariableStruct *VarTable = Local; // // Scan the list // while (VarTable != NULL) { int Direction; // // Is this it? // Direction = strcmp(VarTable->BasicName, VarName); if (Direction == 0) { // // Handle allowing a variable name as being // an array and a non-array in the same // program. // switch(VarTable->Class) { case VARCLASS_ARRAY: if (ArrayRef != 0) { return(VarTable); } VarTable = VarTable->Left; break; case VARCLASS_FUNC: return(VarTable); default: if (ArrayRef == 0) { return(VarTable); } VarTable = VarTable->Left; break; } } else { if (Direction > 0) { VarTable = VarTable->Right; } else { VarTable = VarTable->Left; } } } VarTable = Global; // // Scan the list // while (VarTable) { int Direction; // // Is this it? // Direction = strcmp(VarTable->BasicName, VarName); if (Direction == 0) { // // Handle allowing a variable name as being // an array and a non-array in the same // program. // switch(VarTable->Class) { case VARCLASS_ARRAY: if (ArrayRef != 0) { return(VarTable); } VarTable = VarTable->Left; break; case VARCLASS_FUNC: return(VarTable); default: if (ArrayRef == 0) { return(VarTable); } VarTable = VarTable->Left; break; } break; } else { if (Direction > 0) { VarTable = VarTable->Right; } else { VarTable = VarTable->Left; } } } // // Didn't find it // return(0); } /******************************************************************************* Mamber Function: VariableList::LookupCpp() Title: Look for a variable in the table using the C++ name. Description: This routine will scan the variable table for the occurance of a specified variable. Bugs: *******************************************************************************/ VariableStruct *VariableList::LookupCpp ( char *VarName ) { VariableStruct *VarTable = NULL; if (Local != NULL) { VarTable = LookupCppTree(Local, VarName); } if ((Global != NULL) && (VarTable == NULL)) { VarTable = LookupCppTree(Global, VarName); } return VarTable; } VariableStruct *VariableList::LookupCppTree ( VariableStruct* Nodex, char* VarName ) { VariableStruct *VarTable; // // Is this it? // if ((Nodex->CName != NULL) && (strcmp(Nodex->CName, VarName) == 0)) { return(Nodex); } // // Look at left side of nodex // if (Nodex->Left != NULL) { VarTable = LookupCppTree(Nodex->Left, VarName); if (VarTable != NULL) { return VarTable; } } // // Look at right side of nodex // if (Nodex->Right != NULL) { VarTable = LookupCppTree(Nodex->Right, VarName); if (VarTable != NULL) { return VarTable; } } // // Didn't find it // return NULL; } /******************************************************************************* Mamber Function: VariableList::LookupReserved() Title: Look for a variable in the list of reserved names and the already used names using the C++ name. Description: This routine will scan the variable table for the occurance of a specified variable. Bugs: *******************************************************************************/ // // This list represent names that are not available for one reason or // another to a C++ program for use as a variable name. It keeps // generated names from overlapping too badly with existing functions // and reserved words. // // Do not include constants that have been appended to the variable // list in the startup routines. That would be redundant, and a // duplication of effort. // static const char* ReservedList[] = { "atof", "atoi", "auto", "break", "case", "char", "cin", "class", "const", "continue", "cout", "default", "delete", "do", "double", "else", "extern", "far", "fclose", "float", "fopen", "for", "fprintf", "free", "goto", "if", "int", "long", "malloc", "namespace", "near", "new", "operator", "printf", "public", "private", "register", "return", "scanf", "short", "sprintf", "static", "strcmp", "struct", "switch", "union", "using", "virtual", "void", "volatile", "template", "throw", "typedef", "unsigned", "while", 0 }; int VariableList::LookupReserved ( char *VarName ) { // // Look through reserved word list // for (int i = 0; ReservedList[i] != 0; i++) { if (strcmp(ReservedList[i] , VarName) == 0) { return TRUE; } } // // Look through list of already used names // VariableStruct *VarTable = LookupCpp(VarName); if (VarTable != NULL) { return TRUE; } else { return FALSE; } } /******************************************************************************* Member Function: VariableList::Dump() Title: Print out variable table. Description: Prints out the variables stored in the variable table. Bugs: Ugly output. *******************************************************************************/ void VariableList::Dump() { // // Dump out global variables // cerr << endl << "Global Variables:" << endl; if (Global != NULL) { DumpTree(Global); } // // Dump out local variables // cerr << endl << "Local Variables:" << endl; if (Local != NULL) { DumpTree(Local); } cerr << endl; } void VariableList::DumpTree(VariableStruct* Variable) { if (Variable != NULL) { DumpTree(Variable->Right); Variable->Dump(); DumpTree(Variable->Left); } } /******************************************************************************* Member Function: VariableList::Define() Title: Define the current node as a variable. Description: This function tries to define the current node as a variable. It is used to define those variables that are not defined in some other manner by the user. Bugs: *******************************************************************************/ void VariableList::Define(Node *ThisNode, int GlobalFlag, int ThisOutput) { // // Local Variables // int Type; VariableStruct *ThisVar; int ThisClass = VARCLASS_NONE; // // If the name starts fn..., then it must be a function // (it's the law) // if (strncmp(ThisNode->GetText(), "FN", 2) == 0) { ThisNode->SetType(BAS_V_FUNCTION); } // // Is it already defined as a variable? // if ((ThisVar = Lookup(ThisNode->GetText(), ThisNode->GetTree(0))) != NULL) { // // Force the node to be a function if that is what it is. // if (ThisVar->Class == VARCLASS_FUNC) { ThisNode->SetType(BAS_V_FUNCTION); } return; } // // Check the last letter of the variable to determine what type // it ought to be. // switch(ThisNode->GetText()[strlen(ThisNode->GetText()) - 1]) { case '$': Type = VARTYPE_DYNSTR; break; case '%': Type = VARTYPE_INTEGER; break; default: Type = VARTYPE_REAL; break; } // // Is this an array reference? // if (ThisNode->GetTree(0) != NULL) { ThisClass = VARCLASS_ARRAY; } // // Add the variable to the list // VariableStruct* NewVariable = new VariableStruct( ThisNode->GetText(), Type, ThisClass, ThisOutput); Append(NewVariable, GlobalFlag); } /******************************************************************************* Member Function: VariableList::ClearLocal() Title: Destroy the local variable List. Description: Destroys local variable Lists, leaving the global list alone. Bugs: *******************************************************************************/ void VariableList::ClearLocal() { VariableStruct* ThisItem = Local; VariableStruct* NextItem; // // Delete everything saved up // DeleteTree(Local); // // Clear pointer // Local = 0; } /******************************************************************************* Member Function: Append() Title: Add a variable to the table. Description: This routine will add a variable to the end of the variable table. Bugs: Assumes variable is not already in the table. *******************************************************************************/ VariableList *VariableList::Append(VariableStruct* Variable, int GlobalFlag) { VariableStruct* Down; if (GlobalFlag) { Down = Global; } else { Down = Local; } // // Insert it into the table // if (Down != NULL) { // // Find a good place to attach it to // while(1) { int Compare = strcmp(Down->BasicName, Variable->BasicName); if (Compare > 0) { if (Down->Right != NULL) { Down = Down->Right; } else { Down->Right = Variable; return this; } } else { if (Down->Left != NULL) { Down = Down->Left; } else { Down->Left = Variable; return this; } } } } else { if (GlobalFlag) { Global = Variable; } else { Local = Variable; } } return(this); } /******************************************************************************* Member Function: VariableList::Fixup() Title: Fix up variable names Description: This function changes all of the variable names from formats that BASIC likes, into those that C likes. Algorithm: 1. Convert those variables that can be to simply lower case versions of the upper case basic names. 2. For variables with trailing characters "%", try leaving the "%" off, and make sure there are no duplicates. 3. Any variables left over, convert to lower case, changing unallowed characters to underscores. Make sure that they don't duplicate any other name. 4. Additional to step 3, add a "Vn" to the variable to make unique. Bugs: *******************************************************************************/ void VariableList::Fixup() { // // Local Variables // // // Do the various stages of fixup // Fixup1(Local); Fixup2(Local); Fixup3(Local); } /******************************************************************************* Member Function: Fixup1() Title: Fix up variable names Description: 1. Convert those variables that can be to simply lower case versions of the upper case basic names. Bugs: *******************************************************************************/ void VariableList::Fixup1(VariableStruct* VarList) { // // Local Variables // char tempname[64]; char *ThisName; // // Do the various stages of fixup // if (VarList != NULL) { // // Don't re-convert, don't allow illegal basic characters. // if ((VarList->CName == NULL) && (strchr(VarList->BasicName, '.') == 0) && (strchr("%$", VarList->BasicName[ strlen(VarList->BasicName)-1]) == 0)) { if ((VarList->Type == VARTYPE_LABEL) && (isdigit(VarList->BasicName[0]))) { // // Lables are never reserved, so always // give them a specific value // strcpy(tempname, "L_"); strcat(tempname, VarList->BasicName); ThisName = new char[strlen(tempname)+1]; strcpy(ThisName, tempname); VarList->CName = ThisName; } else { strcpy(tempname, VarList->BasicName); strlwr(tempname); // // Don't assign if used by another variable // if (Variables->LookupReserved(tempname) == FALSE) { ThisName = new char[strlen(tempname)+1]; strcpy(ThisName, tempname); VarList->CName = ThisName; } } } // // Point to next // Fixup1(VarList->Left); Fixup1(VarList->Right); } } /******************************************************************************* Member Function: Fixup2() Title: Fix up variable names Description: 2. For variables with trailing characters "%", try leaving the "%" off, and make sure there are no duplicates. Bugs: *******************************************************************************/ void VariableList::Fixup2(VariableStruct* VarList) { // // Local Variables // char tempname[64]; char *ThisName; // // Do the various stages of fixup // if (VarList != NULL) { // // Don't re-convert, don't allow illegal basic characters. // if ((VarList->CName == NULL) && (strchr(VarList->BasicName, '.') == 0) && (strchr("%$", VarList->BasicName[ strlen(VarList->BasicName) - 1]) != 0)) { strcpy(tempname, VarList->BasicName); strlwr(tempname); // // Lose '$', '%' // tempname[strlen(tempname) - 1] = '\0'; if (Variables->LookupReserved(tempname) == FALSE) { ThisName = new char[strlen(tempname)+1]; strcpy(ThisName, tempname); VarList->CName = ThisName; } } // // Point to next // Fixup2(VarList->Left); Fixup2(VarList->Right); } } /******************************************************************************* Member Function: VariableList::Fixup3() Title: Fix up variable names Description: 3. Any variables left over, convert to lower case, changing unallowed characters to underscores. Make sure that they don't duplicate any other name. 4. Additional to step 3, add a "Vn" to the variable to make unique. Bugs: *******************************************************************************/ static int vcount = 0; /* Current forced variable counter */ void VariableList::Fixup3(VariableStruct* VarList) { // // Local Variables // char tempname[64]; char number[6]; char *ThisName; int loop; // // Do the various stages of fixup // if (VarList != NULL) { // // Don't re-convert, don't allow illegal basic characters. // if (VarList->CName == NULL) { if ((VarList->Type == VARTYPE_LABEL) && (isdigit(VarList->BasicName[0]))) { strcpy(tempname, "L_"); strcat(tempname, VarList->BasicName); } else { strcpy(tempname, VarList->BasicName); strlwr(tempname); } if (strchr("%$", tempname[strlen(tempname)-1]) != 0) { tempname[strlen(tempname)-1] = '\0'; } for (loop = 0; tempname[loop] != 0; loop++) { if (strchr(".", tempname[loop]) != 0) { tempname[loop] = '_'; } } if (Variables->LookupReserved(tempname) == FALSE) { ThisName = new char[strlen(tempname)+1]; strcpy(ThisName, tempname); VarList->CName = ThisName; } else { strcat(tempname, "_V"); sprintf(number, "%d", vcount++); strcat(tempname, number); ThisName = new char[strlen(tempname) + 1]; strcpy(ThisName, tempname); VarList->CName = ThisName; } } // // Point to next // Fixup3(VarList->Left); Fixup3(VarList->Right); } } /******************************************************************************* Member Function: VariableList::OutputDef() Title: Output any variables that have not yet been dumped. Description: This function will output any variables that have not been dumped by any previous routines. Bugs: *******************************************************************************/ void VariableList::OutputDef(ostream& os, int Level) { OutputDefTree(os, Local, Level); } void VariableList::OutputDefTree(ostream& os, VariableStruct* VarTable, int Level) { // // Determine type of variable // if (VarTable != NULL) { // // Handle left hand side first // OutputDefTree(os, VarTable->Right, Level); // // Output this variable // VarTable->OutputDef(os, Level); // // Handle rightt hand side first // OutputDefTree(os, VarTable->Left, Level); } } /******************************************************************************* Local Function: VariableList::InitFunctions() Title: Initialize function names. Description: This function initializes several built in basic functions that have compatible C functions (same parameters). Bugs: *******************************************************************************/ void VariableList::InitFunctions(void) { InitOneFunction("ABS", "fabs", VARTYPE_DOUBLE); InitOneFunction("ABS%", "abs", VARTYPE_DOUBLE); InitOneFunction("ASCII", "Ascii", VARTYPE_LONG); InitOneFunction("ATN", "atan", VARTYPE_DOUBLE); InitOneFunction("COS", "cos", VARTYPE_DOUBLE); InitOneFunction("CVT$%", "cvtai", VARTYPE_LONG); InitOneFunction("CVT%$", "cvtia", VARTYPE_DYNSTR); InitOneFunction("CVT$F", "cvtaf", VARTYPE_DOUBLE); InitOneFunction("CVTF$", "cvtfa", VARTYPE_DYNSTR); InitOneFunction("CVT$$", "cvtaa", VARTYPE_DYNSTR); InitOneFunction("EDIT$", "edit", VARTYPE_DOUBLE); InitOneFunction("EXP", "exp", VARTYPE_DOUBLE); InitOneFunction("FIX", "fix", VARTYPE_DOUBLE); InitOneFunction("FORMAT$", "format", VARTYPE_DYNSTR); InitOneFunction("INT", "floor", VARTYPE_DOUBLE); InitOneFunction("LEFT", "left", VARTYPE_DYNSTR); InitOneFunction("LEFT$", "left", VARTYPE_DYNSTR); InitOneFunction("LEN", "strlen", VARTYPE_LONG); InitOneFunction("LOC", "&", VARTYPE_LONG); InitOneFunction("LOG", "log", VARTYPE_DOUBLE); InitOneFunction("LOG10", "log10", VARTYPE_DOUBLE); InitOneFunction("MID", "mid", VARTYPE_DYNSTR); InitOneFunction("MID$", "mid", VARTYPE_DYNSTR); InitOneFunction("MAG", "fabs", VARTYPE_DOUBLE); InitOneFunction("NUM$", "Qnum", VARTYPE_DYNSTR); InitOneFunction("NUM1$", "Qnum1", VARTYPE_DYNSTR); InitOneFunction("RIGHT", "right", VARTYPE_DYNSTR); InitOneFunction("RIGHT$", "right", VARTYPE_DYNSTR); InitOneFunction("RND", "floatrand", VARTYPE_DOUBLE); InitOneFunction("SIN", "sin", VARTYPE_DOUBLE); InitOneFunction("SPACE$", "Qspace", VARTYPE_DYNSTR); InitOneFunction("SQRT", "sqrt", VARTYPE_DOUBLE); InitOneFunction("SQR", "sqr", VARTYPE_DOUBLE); InitOneFunction("STRING$", "Qstring", VARTYPE_DYNSTR); InitOneFunction("SWAP%", "swab", VARTYPE_LONG); InitOneFunction("TAN", "tan", VARTYPE_DOUBLE); InitOneFunction("TRM$", "trm", VARTYPE_DYNSTR); InitOneFunction("VAL", "atof", VARTYPE_DOUBLE); InitOneFunction("VAL%", "atoi", VARTYPE_LONG); } /******************************************************************************* Local Function: VariableList::InitOneFunction() Title: Initialize function names. Description: This function fills in remaining blanks for a function. Bugs: This function is defined to be used be InitFunctions only. *******************************************************************************/ void VariableList::InitOneFunction(char *BasName, char *CName, int Type) { VariableStruct *ThisVar; char *B1Name; char *C1Name; // // Create malloc'd copies of names // B1Name = new char [strlen(BasName) + 1]; strcpy(B1Name, BasName); C1Name = new char[strlen(CName) + 1]; strcpy(C1Name, CName); // // Create area for function definition // ThisVar = new VariableStruct; // // Slap together a structure // ThisVar->BasicName = B1Name; ThisVar->Type = Type; ThisVar->Class = VARCLASS_FUNC; ThisVar->CName = C1Name; ThisVar->Output = 1; // ThisVar->Array = NULL; // // Hook into variable definition table // Append(ThisVar, TRUE); } works.bas100644 765 144 4564 6264107100 11440 0ustar kevinusers1 ! ! This is a test program to show a few of the things ! that are actually working in the btran translator. ! ! It is not meant as a useful program, it just gives ! a sample of some of the features that seem to work ! completely, and to show that some fairly complex ! programs can be compiled using this. ! ! I am leaving out things that don't work, because ! this is a showcase of what does work, not what ! doesn't work. ! Uncomment this next line to use 32bit int's instead ! of the defauolt 16bit int's. option size = integer long 100 PRINT "Test Program To Show " + & "Things That Really Work" PRINT 110 PRINT "Enter a number "; INPUT A PRINT "You Entered "; A PRINT 120 ! ! For loop on statement ! PRINT "Implied FOR loop" PRINT I%, FOR I% = 1% TO 100% PRINT PRINT 200 ! ! Let's calculate some primes (slowly) ! I'm not using any fancy calculations, just a brute force ! check to execerise the math sections. ! PRINT "Prime Numbers" CRFLAG% = 0% ! Loops don't work all the way to 32767% in 16bit mode, ! because it increments to -32786 before the test FOR I% = 5% TO 3276% STEP 2% FOR J% = 3% TO I% / 2% STEP 2% IF ((I% / J%) * J%) = I% THEN GOTO 220 END IF NEXT J% PRINT I%, CRFLAG% = CRFLAG% + 1% IF CRFLAG% = 10% THEN PRINT CRFLAG% = 0% END IF 220 NEXT I% 290 PRINT PRINT 300 ! ! Print a triangle (Play with some simple string functions) ! PRINT "Triangle" FOR I% = 1% TO 10% FOR J% = 1% to 11% - I% PRINT " "; NEXT J% FOR J% = 1% TO I% * 2% - 1% PRINT "*"; NEXT J% PRINT NEXT I% ! ! And again using different functions to test string addition ! (Would look cool to loop backwards, but that ! seems to test the loop variable backwards) ! FOR I% = 1% TO 10% TEXT$ = "" TEXT$ = TEXT$ + " " FOR J% = 1% TO 11% - I% TEXT$ = TEXT$ + "*" FOR J% = 1% TO I% * 2% - 1% PRINT TEXT$ NEXT I% ! ! And one more time for some string function tests ! FOR I% = 1% TO 10% PRINT SPACE$(11% - I%); STRING$(I% * 2% - 1%, ASCII("*")) NEXT I% PRINT ! ! Let's do a graph ! PRINT "Sine Wave" FOR I = -PI TO PI STEP 0.2 X% = SIN(I) * 25 + 27 X$ = SPACE$(26%) + "|" + SPACE$(26%) X$ = LEFT(X$, X% - 1%) + "*" + RIGHT(X$, X% + 1%) X% = COS(I) * 25 + 27 X$ = LEFT(X$, X% - 1%) + "+" + RIGHT(X$, X% + 1%) X1$ = TRM$(X$) + "" PRINT X1$; " "; NUM1$(LEN(X1$)) NEXT I 32767 END xbasic100755 765 144 223 6263645076 10771 0ustar kevinusers#!/bin/tcsh btran <$1.bas >/tmp/$$.cpp g++ /tmp/$$.cpp -o $1.exe -I/home/kevin/str -I/home/kevin/basic /home/kevin/str/strlib.a -lm rm /tmp/$$.cpp yuck.bas100644 765 144 1101 6227567727 11256 0ustar kevinusers1 ! Lots of yucky code that is impossible to parse correctly ! All cases are contrived, ! ! A pair of For loops that jump back and forth ! (Just looking at it, you wouldn't think that "LOOP2" ! or "MIDDLE" should ever get printed) ! ! You may need to append a semi-colon after the label in the ! C++ output file, because some compilers don't like a ! label followed by a close bracket. ! 1000 FOR I% = 1% TO 10% PRINT "LOOP1 -"; I% GOTO 1100 1010 NEXT I% PRINT "MIDDLE" 1050 FOR I% = 1% TO 10% PRINT "LOOP2 -"; I% GOTO 1010 1100 NEXT I% 32767 END yywrap.c100644 765 144 35 6263644734 11252 0ustar kevinusersint yywrap() { return 1; }