gcompile.cc
来自「Gambit 是一个游戏库理论软件」· CC 代码 · 共 2,005 行 · 第 1/5 页
CC
2,005 行
/* A Bison parser, made from gcompile.yy by GNU Bison version 1.28 */#define YYBISON 1 /* Identify Bison output. */#define yyparse gcl_yyparse#define yylex gcl_yylex#define yyerror gcl_yyerror#define yylval gcl_yylval#define yychar gcl_yychar#define yydebug gcl_yydebug#define yynerrs gcl_yynerrs#define LOR 257#define LAND 258#define LNOT 259#define EQU 260#define NEQ 261#define LTN 262#define LEQ 263#define GTN 264#define GEQ 265#define PLUS 266#define MINUS 267#define STAR 268#define SLASH 269#define ASSIGN 270#define SEMI 271#define LBRACK 272#define DBLLBRACK 273#define RBRACK 274#define LBRACE 275#define RBRACE 276#define RARROW 277#define LARROW 278#define DBLARROW 279#define COMMA 280#define HASH 281#define DOT 282#define CARET 283#define UNDERSCORE 284#define AMPER 285#define WRITE 286#define READ 287#define PERCENT 288#define DIV 289#define LPAREN 290#define RPAREN 291#define DOLLAR 292#define IF 293#define WHILE 294#define FOR 295#define NEWFUNC 296#define DELFUNC 297#define TYPEDEF 298#define INCLUDE 299#define NAME 300#define BOOLEAN 301#define INTEGER 302#define FLOAT 303#define TEXT 304#define STDOUT 305#define gNULL 306#define FLOATPREC 307#define RATIONALPREC 308#define CRLF 309#define EOC 310#define UWRITE 311#define UMINUS 312#line 1 "gcompile.yy"//// $Source: /home/gambit/CVS/gambit/sources/gcl/gcompile.cc,v $// $Date: 2002/08/27 18:57:17 $// $Revision: 1.2 $//// DESCRIPTION:// Parser input file for GCL//// This file is part of Gambit// Copyright (c) 2002, The Gambit Project//// 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 2 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.//#include <stdlib.h>#include <ctype.h>#include "base/gmisc.h"#include "base/gstream.h"#include "base/gtext.h"#include "math/rational.h"#include "base/glist.h"#include "base/gstack.h"#include "gsm.h"#include "gsminstr.h"#include "gsmfunc.h"#include "portion.h"#include "base/system.h"gStack<gText> GCL_InputFileNames(4);static GSM *gsm; \static bool record_funcbody, in_funcdecl;static unsigned int current_char, current_line;static gText current_expr, current_file, current_rawline;static gText funcbody, funcname, funcdesc, paramtype, functype; static gList<gText> formals, types; static gList<Portion *> portions;static gList<bool> refs;static gStack<gText> funcnames;static gText tval;static gclExpression *exprtree;static gTriState bval;static double dval;static gInteger ival;static char nextchar(void);static void ungetchar(char c);static gclExpression *NewFunction(gclExpression *expr);static gclExpression *DeleteFunction(void);static void RecoverFromError(void);int GCLParse(const gText& line, const gText &file, int lineno, const gText& rawline); int Execute(void); void gcl_yyerror(char *s);int gcl_yylex(void);#line 76 "gcompile.yy"typedef union { gclExpression *eval; gclParameterList *pval; gclReqParameterList *rpval; gclOptParameterList *opval; gclListConstant *lcval;} YYSTYPE;#include <stdio.h>#ifndef __cplusplus#ifndef __STDC__#define const#endif#endif#define YYFINAL 189#define YYFLAG -32768#define YYNTBASE 59#define YYTRANSLATE(x) ((unsigned)(x) <= 312 ? yytranslate[x] : 95)static const char yytranslate[] = { 0, 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, 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, 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};#if YYDEBUG != 0static const short yyprhs[] = { 0, 0, 3, 6, 9, 11, 13, 17, 21, 24, 28, 31, 34, 38, 42, 46, 50, 54, 57, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 111, 115, 119, 123, 127, 136, 143, 150, 161, 162, 163, 172, 173, 179, 180, 186, 188, 190, 192, 193, 195, 197, 201, 203, 207, 209, 210, 215, 216, 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245, 248, 252, 254, 257, 261, 263, 267, 268, 275, 276, 277, 281, 283, 284, 288, 289, 290, 295, 296, 300, 301, 303, 305, 309, 310, 311, 317, 318, 319, 327, 329};static const short yyrhs[] = { 60, 56, 0, 1, 56, 0, 1, 55, 0, 74, 0, 61, 0, 36, 60, 37, 0, 60, 17, 60, 0, 60, 17, 0, 60, 16, 60, 0, 60, 16, 0, 32, 60, 0, 60, 27, 60, 0, 60, 30, 60, 0, 60, 12, 60, 0, 60, 13, 60, 0, 60, 31, 60, 0, 12, 60, 0, 13, 60, 0, 60, 14, 60, 0, 60, 15, 60, 0, 60, 34, 60, 0, 60, 35, 60, 0, 60, 28, 60, 0, 60, 29, 60, 0, 60, 6, 60, 0, 60, 7, 60, 0, 60, 8, 60, 0, 60, 9, 60, 0, 60, 10, 60, 0, 60, 11, 60, 0, 5, 60, 0, 60, 4, 60, 0, 60, 3, 60, 0, 60, 32, 60, 0, 60, 33, 60, 0, 39, 18, 60, 26, 60, 26, 60, 20, 0, 39, 18, 60, 26, 60, 20, 0, 40, 18, 60, 26, 60, 20, 0, 41, 18, 60, 26, 60, 26, 60, 26, 60, 20, 0, 0, 0, 42, 62, 18, 77, 26, 63, 60, 20, 0, 0, 43, 64, 18, 77, 20, 0, 0, 66, 18, 65, 67, 20, 0, 46, 0, 53, 0, 54, 0, 0, 68, 0, 70, 0, 68, 26, 70, 0, 69, 0, 68, 26, 69, 0, 60, 0, 0, 46, 71, 73, 60, 0, 0, 70, 26, 46, 72, 73, 60, 0, 23, 0, 25, 0, 47, 0, 48, 0, 49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0, 46, 0, 38, 46, 0, 38, 38, 46, 0, 75, 0, 21, 22, 0, 21, 76, 22, 0, 60, 0, 76, 26, 60, 0, 0, 66, 78, 18, 87, 20, 79, 0, 0, 0, 44, 80, 81, 0, 85, 0, 0, 46, 82, 83, 0, 0, 0, 36, 84, 81, 37, 0, 0, 46, 86, 14, 0, 0, 88, 0, 89, 0, 88, 26, 89, 0, 0, 0, 46, 90, 94, 91, 81, 0, 0, 0, 21, 46, 92, 94, 93, 60, 22, 0, 23, 0, 25, 0};#endif#if YYDEBUG != 0static const short yyrline[] = { 0, 165, 166, 167, 170, 171, 172, 173, 175, 177, 179, 181, 184, 187, 190, 193, 196, 199, 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240, 243, 246, 249, 252, 257, 260, 263, 265, 268, 269, 271, 274, 275, 277, 277, 281, 282, 283, 286, 287, 288, 289, 292, 293, 295, 297, 297, 299, 300, 303, 303, 305, 307, 309, 311, 313, 315, 317, 319, 321, 323, 325, 327, 330, 331, 334, 335, 339, 340, 342, 343, 344, 346, 347, 349, 349, 350, 351, 353, 353, 355, 356, 358, 359, 361, 362, 363, 364, 365, 366, 378, 379};#endif#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)static const char * const yytname[] = { "$","error","$undefined.","LOR","LAND","LNOT","EQU","NEQ","LTN","LEQ","GTN","GEQ","PLUS","MINUS","STAR","SLASH","ASSIGN","SEMI","LBRACK","DBLLBRACK","RBRACK","LBRACE","RBRACE","RARROW","LARROW","DBLARROW","COMMA","HASH","DOT","CARET","UNDERSCORE","AMPER","WRITE","READ","PERCENT","DIV","LPAREN","RPAREN","DOLLAR","IF","WHILE","FOR","NEWFUNC","DELFUNC","TYPEDEF","INCLUDE","NAME","BOOLEAN","INTEGER","FLOAT","TEXT","STDOUT","gNULL","FLOATPREC","RATIONALPREC","CRLF","EOC","UWRITE","UMINUS","program","expression","function","@1","@2","@3","@4","funcname","parameterlist","reqparameterlist","parameter","optparameterlist","@5","@6","arrow","constant","list","listels","signature","@7","TYPEopt","@8","typename","@9","optparen","@10","starname","@11","formallist","formalparams","formalparam","@12","@13","@14","@15","binding", NULL};#endifstatic const short yyr1[] = { 0, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 62, 63, 61, 64, 61, 65, 61, 66, 66, 66, 67, 67, 67, 67, 68, 68, 69, 71, 70, 72, 70, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 76, 76, 78, 77, 79, 80, 79, 81, 82, 81, 83, 84, 83, 86, 85, 87, 87, 88, 88, 90, 91, 89, 92, 93, 89, 94, 94};static const short yyr2[] = { 0, 2, 2, 2, 1, 1, 3, 3, 2, 3, 2, 2, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 8, 6, 6, 10, 0, 0, 8, 0, 5, 0, 5, 1, 1, 1, 0, 1, 1, 3, 1, 3, 1, 0, 4, 0, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 3, 1, 3, 0, 6, 0, 0, 3, 1, 0, 3, 0, 0, 4, 0, 3, 0, 1, 1, 3, 0, 0, 5, 0, 0, 7, 1, 1};static const short yydefact[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 43, 71, 63, 64, 65, 66, 67, 68, 69, 70, 0, 5, 0, 4, 74, 3, 2, 31, 17, 18, 75, 77, 0, 11, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 45, 76, 0, 6, 73, 0, 0, 0, 0, 0, 33, 32, 25, 26, 27, 28, 29, 30, 14, 15, 19, 20, 9, 7, 12, 23, 24, 13, 16, 34, 35, 21, 22, 50, 78, 0, 0, 0, 47, 48, 49, 79, 0, 0, 71, 56, 0, 51, 54, 52, 0, 0, 0, 0, 41, 44, 0, 46, 0, 0, 37, 0, 38, 0, 92, 0, 61, 62, 0, 55, 53, 59, 0, 0, 0, 96, 0, 93, 94, 0, 58, 0, 36, 0, 99, 0, 81, 0, 42, 0, 0, 0, 102, 103, 97, 82, 80, 95, 60, 39, 100, 0, 0, 0, 85, 98, 84, 83, 0, 87, 0, 101, 88, 86, 91, 0, 0, 89, 0, 0, 0};static const short yydefgoto[] = { 187, 114, 24, 43, 134, 44, 102, 25, 115, 116, 117, 118, 125, 150, 137, 26, 27, 35, 111, 122, 165, 171, 174, 178, 182, 184, 175, 179, 145, 146, 147, 154, 170, 160, 172, 163};static const short yypact[] = { 128, -32, 228, 228, 228, 178, 228, 228, -17, 7, 12, 25,-32768,-32768, 26,-32768,-32768,-32768,-32768,-32768,-32768, 50, 69, 66,-32768, 73,-32768,-32768,-32768,-32768, 804, 59, 59,-32768, 728, 62, 761, 330, 56,-32768, 228, 228, 228, 85, 90, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, 228,-32768,-32768,-32768, 228,-32768,-32768, 398, 431, 464, -26, -26, 4, 804, 834, 834, 834, 834, 834, 834, 174, 174, 80, 80, 761, 728,-32768, 80, 59,-32768, 174, 794, 794, 80, 80, 278, 728, 228, 228, 228,-32768,-32768,-32768,-32768, 91, 95, 67, 728, 96, 92,-32768, 93, 365, 497, 530, 102,-32768,-32768, 88,-32768, 278, 75,-32768, 228,-32768, 228, -20, 228,-32768,-32768, 228,-32768, 93,-32768, 563, 596, 77,-32768, 104, 99,-32768, 629, 728, 88,-32768, 228,-32768, 89, 82, -20,-32768, 228, 662, 89,-32768,-32768,-32768,-32768,-32768,-32768, 728,-32768,-32768, 81, 81, 228, 114,-32768,-32768,-32768, 695, 100, 117,-32768,-32768,-32768,-32768, 81, 98,-32768, 138, 139,-32768};static const short yypgoto[] = {-32768, 0,-32768,-32768,-32768,-32768,-32768, -41,-32768,-32768, 15, 16,-32768,-32768, -6,-32768,-32768,-32768, 68,-32768,-32768,-32768, -162,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -11,-32768,-32768,-32768,-32768, -13};#define YYLAST 869static const short yytable[] = { 23, 143, 30, 31, 32, 34, 36, 37, 46, 176, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 107, 38, 185, 28, 29, 40, 144, 108, 109, 39, 41, 59, 60, 61, 62, 63, 110, 110, 66, 67, 74, 75, 76, 42, -47, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, -48, 45, 46, 103, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 70, -47, 59, -49, 71, 62, -57, 69, -57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 73, 77, 119, 120, 121, 59, 78, 61, 62, 135, 161, 136, 162, 124, 126, 123, 127, 128, 133, 140, 68, 153, 155, 156, 164, 173, -90, 1, 141, 183, 142, 2, 148, 186, 181, 149, 188, 189, 3, 4, 138, 139, 158, 166, 112, 169, 0, 5, 0, 0, 159, 0, 0, 0, 0, 0, 167, 0, 6, 0, 0, 0, 7, 0, 8, 9, 10, 11, 12, 13, 177, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 2, 0, 0, 0, 0, 55, 56, 3, 4, 0, 0, 0, 0, 0, 0, 0, 5, 33,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?