gram.c 98 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208
  1. /* A Bison parser, made by GNU Bison 2.3. */
  2. /* Skeleton implementation for Bison's Yacc-like parsers in C
  3. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
  4. Free Software Foundation, Inc.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. Boston, MA 02110-1301, USA. */
  17. /* As a special exception, you may create a larger work that contains
  18. part or all of the Bison parser skeleton and distribute that work
  19. under terms of your choice, so long as that work isn't itself a
  20. parser generator using the skeleton or a modified version thereof
  21. as a parser skeleton. Alternatively, if you modify or redistribute
  22. the parser skeleton itself, you may (at your option) remove this
  23. special exception, which will cause the skeleton and the resulting
  24. Bison output files to be licensed under the GNU General Public
  25. License without this special exception.
  26. This special exception was added by the Free Software Foundation in
  27. version 2.2 of Bison. */
  28. /* C LALR(1) parser skeleton written by Richard Stallman, by
  29. simplifying the original so-called "semantic" parser. */
  30. /* All symbols defined below should begin with yy or YY, to avoid
  31. infringing on user name space. This should be done even for local
  32. variables, as they might otherwise be expanded by user macros.
  33. There are some unavoidable exceptions within include files to
  34. define necessary library symbols; they are noted "INFRINGES ON
  35. USER NAME SPACE" below. */
  36. /* Identify Bison output. */
  37. #define YYBISON 1
  38. /* Bison version. */
  39. #define YYBISON_VERSION "2.3"
  40. /* Skeleton name. */
  41. #define YYSKELETON_NAME "yacc.c"
  42. /* Pure parsers. */
  43. #define YYPURE 0
  44. /* Using locations. */
  45. #define YYLSP_NEEDED 0
  46. /* Tokens. */
  47. #ifndef YYTOKENTYPE
  48. # define YYTOKENTYPE
  49. /* Put the tokens into the symbol table, so that GDB and other debuggers
  50. know about them. */
  51. enum yytokentype {
  52. NUMBER = 258,
  53. IDENT = 259,
  54. SEP = 260,
  55. ABS = 261,
  56. SQRT = 262,
  57. EXP = 263,
  58. LOG = 264,
  59. LOG10 = 265,
  60. SIN = 266,
  61. COS = 267,
  62. TAN = 268,
  63. ASIN = 269,
  64. ACOS = 270,
  65. ATAN = 271,
  66. SINH = 272,
  67. COSH = 273,
  68. TANH = 274,
  69. ASINH = 275,
  70. ACOSH = 276,
  71. ATANH = 277,
  72. FLOOR = 278,
  73. CEIL = 279,
  74. J0 = 280,
  75. J1 = 281,
  76. Y0 = 282,
  77. Y1 = 283,
  78. LGAMMA = 284,
  79. GAMMA = 285,
  80. ERF = 286,
  81. ERFC = 287,
  82. INVERF = 288,
  83. NORM = 289,
  84. INVNORM = 290,
  85. IGAMMA = 291,
  86. IBETA = 292,
  87. EVERY = 293,
  88. FROM = 294,
  89. PRINT = 295,
  90. STEP = 296,
  91. EXAM = 297,
  92. UMINUS = 298
  93. };
  94. #endif
  95. /* Tokens. */
  96. #define NUMBER 258
  97. #define IDENT 259
  98. #define SEP 260
  99. #define ABS 261
  100. #define SQRT 262
  101. #define EXP 263
  102. #define LOG 264
  103. #define LOG10 265
  104. #define SIN 266
  105. #define COS 267
  106. #define TAN 268
  107. #define ASIN 269
  108. #define ACOS 270
  109. #define ATAN 271
  110. #define SINH 272
  111. #define COSH 273
  112. #define TANH 274
  113. #define ASINH 275
  114. #define ACOSH 276
  115. #define ATANH 277
  116. #define FLOOR 278
  117. #define CEIL 279
  118. #define J0 280
  119. #define J1 281
  120. #define Y0 282
  121. #define Y1 283
  122. #define LGAMMA 284
  123. #define GAMMA 285
  124. #define ERF 286
  125. #define ERFC 287
  126. #define INVERF 288
  127. #define NORM 289
  128. #define INVNORM 290
  129. #define IGAMMA 291
  130. #define IBETA 292
  131. #define EVERY 293
  132. #define FROM 294
  133. #define PRINT 295
  134. #define STEP 296
  135. #define EXAM 297
  136. #define UMINUS 298
  137. /* Copy the first part of user declarations. */
  138. #line 1 "gram.y"
  139. /* Copyright Nicholas B. Tufillaro, 1982-1994. All rights reserved.
  140. *
  141. * GNU enhancements Copyright (C) 1996, 1999, 2005, 2008, Free Software
  142. * Foundation, Inc.
  143. */
  144. /*
  145. * Grammar for ode:
  146. * Most things are self-explanatory.
  147. * When you're done with a lexptr-type object
  148. * you should free it with lfree. They are
  149. * used for passing constants around while parsing
  150. * (computing the value of) a cexpr. The macros
  151. * for evaluating operators and functions are the
  152. * most important thing to be familiar with before
  153. * toying with the semantics.
  154. */
  155. #include "sys-defines.h"
  156. #include "ode.h"
  157. #include "extern.h"
  158. /*
  159. * Value is true iff operands pass ONECON.
  160. */
  161. #define TWOCON(x,y) (ONECON(x) && ONECON(y))
  162. #define THREECON(x,y,z) (ONECON(x) && ONECON(y) && ONECON(z))
  163. /*
  164. * Value must be a (struct expr *). Returns true if its arg, when
  165. * evaluated, would put a constant on the stack.
  166. */
  167. #define ONECON(x) (x->ex_oper == O_CONST && x->ex_next == NULL)
  168. /*
  169. * Performs ordinary binary arithmetic, when there are two constants in an
  170. * expr (`op' is a C operator that includes an assignment, e.g., +=).
  171. */
  172. #define COMBINE(x,y,r,op) {x->ex_value op y->ex_value; efree(y); r = x;}
  173. /*
  174. * Generates stack code for a binary operation, as for a dyadic operator in
  175. * an expression. E.g., op = O_PLUS.
  176. */
  177. #define BINARY(x,y,r,op) {struct expr *ep=ealloc();\
  178. ep->ex_oper = op;\
  179. concat(y,ep);\
  180. concat(r=x,y);}
  181. /*
  182. * Generates stack code for a ternary operation, as for a triadic operator in
  183. * an expression. E.g., op = O_IBETA.
  184. */
  185. #define TERNARY(x,y,z,r,op) {struct expr *ep=ealloc();\
  186. ep->ex_oper = op;\
  187. concat(z,ep);\
  188. concat(y,z);\
  189. concat(r=x,y);}
  190. /*
  191. * Performs ordinary unary arithmetic, when there is a constant in an expr.
  192. * "-" seems to work as a monadic operator.
  193. */
  194. #define CONFUNC(x,r,f) {x->ex_value = f(x->ex_value); r = x;}
  195. /*
  196. * Generates stack code for a unary operation, as for a monadic operator in
  197. * an expression.
  198. */
  199. #define UNARY(oprnd,r,op) {struct expr *ep=ealloc();\
  200. ep->ex_oper = op;\
  201. concat(r=oprnd,ep);}
  202. /*
  203. * Performs binary arithmetic in a cexpr (`op' is a C operator that
  204. * includes an assignment, e.g. +=).
  205. */
  206. #define CEXOP(x,y,r,op) {x->lx_u.lxu_value op y->lx_u.lxu_value;\
  207. lfree(y);\
  208. r = x;}
  209. /*
  210. * Performs unary arithmetic in a cexpr.
  211. */
  212. #define CEXFUNC(x,r,f) {x->lx_u.lxu_value = f(x->lx_u.lxu_value); r=x;}
  213. /*
  214. * A hook for future upgrades in error reporting
  215. */
  216. static char *errmess = NULL;
  217. bool erritem;
  218. /* Enabling traces. */
  219. #ifndef YYDEBUG
  220. # define YYDEBUG 0
  221. #endif
  222. /* Enabling verbose error messages. */
  223. #ifdef YYERROR_VERBOSE
  224. # undef YYERROR_VERBOSE
  225. # define YYERROR_VERBOSE 1
  226. #else
  227. # define YYERROR_VERBOSE 0
  228. #endif
  229. /* Enabling the token table. */
  230. #ifndef YYTOKEN_TABLE
  231. # define YYTOKEN_TABLE 0
  232. #endif
  233. #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  234. typedef union YYSTYPE
  235. #line 85 "gram.y"
  236. {
  237. struct lex *lexptr;
  238. struct expr *exprptr;
  239. struct prt *prtptr;
  240. int simple;
  241. }
  242. /* Line 187 of yacc.c. */
  243. #line 274 "gram.c"
  244. YYSTYPE;
  245. # define yystype YYSTYPE /* obsolescent; will be withdrawn */
  246. # define YYSTYPE_IS_DECLARED 1
  247. # define YYSTYPE_IS_TRIVIAL 1
  248. #endif
  249. /* Copy the second part of user declarations. */
  250. /* Line 216 of yacc.c. */
  251. #line 287 "gram.c"
  252. #ifdef short
  253. # undef short
  254. #endif
  255. #ifdef YYTYPE_UINT8
  256. typedef YYTYPE_UINT8 yytype_uint8;
  257. #else
  258. typedef unsigned char yytype_uint8;
  259. #endif
  260. #ifdef YYTYPE_INT8
  261. typedef YYTYPE_INT8 yytype_int8;
  262. #elif (defined __STDC__ || defined __C99__FUNC__ \
  263. || defined __cplusplus || defined _MSC_VER)
  264. typedef signed char yytype_int8;
  265. #else
  266. typedef short int yytype_int8;
  267. #endif
  268. #ifdef YYTYPE_UINT16
  269. typedef YYTYPE_UINT16 yytype_uint16;
  270. #else
  271. typedef unsigned short int yytype_uint16;
  272. #endif
  273. #ifdef YYTYPE_INT16
  274. typedef YYTYPE_INT16 yytype_int16;
  275. #else
  276. typedef short int yytype_int16;
  277. #endif
  278. #ifndef YYSIZE_T
  279. # ifdef __SIZE_TYPE__
  280. # define YYSIZE_T __SIZE_TYPE__
  281. # elif defined size_t
  282. # define YYSIZE_T size_t
  283. # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
  284. || defined __cplusplus || defined _MSC_VER)
  285. # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  286. # define YYSIZE_T size_t
  287. # else
  288. # define YYSIZE_T unsigned int
  289. # endif
  290. #endif
  291. #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
  292. #ifndef YY_
  293. # if YYENABLE_NLS
  294. # if ENABLE_NLS
  295. # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
  296. # define YY_(msgid) dgettext ("bison-runtime", msgid)
  297. # endif
  298. # endif
  299. # ifndef YY_
  300. # define YY_(msgid) msgid
  301. # endif
  302. #endif
  303. /* Suppress unused-variable warnings by "using" E. */
  304. #if ! defined lint || defined __GNUC__
  305. # define YYUSE(e) ((void) (e))
  306. #else
  307. # define YYUSE(e) /* empty */
  308. #endif
  309. /* Identity function, used to suppress warnings about constant conditions. */
  310. #ifndef lint
  311. # define YYID(n) (n)
  312. #else
  313. #if (defined __STDC__ || defined __C99__FUNC__ \
  314. || defined __cplusplus || defined _MSC_VER)
  315. static int
  316. YYID (int i)
  317. #else
  318. static int
  319. YYID (i)
  320. int i;
  321. #endif
  322. {
  323. return i;
  324. }
  325. #endif
  326. #if ! defined yyoverflow || YYERROR_VERBOSE
  327. /* The parser invokes alloca or malloc; define the necessary symbols. */
  328. # ifdef YYSTACK_USE_ALLOCA
  329. # if YYSTACK_USE_ALLOCA
  330. # ifdef __GNUC__
  331. # define YYSTACK_ALLOC __builtin_alloca
  332. # elif defined __BUILTIN_VA_ARG_INCR
  333. # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
  334. # elif defined _AIX
  335. # define YYSTACK_ALLOC __alloca
  336. # elif defined _MSC_VER
  337. # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
  338. # define alloca _alloca
  339. # else
  340. # define YYSTACK_ALLOC alloca
  341. # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  342. || defined __cplusplus || defined _MSC_VER)
  343. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  344. # ifndef _STDLIB_H
  345. # define _STDLIB_H 1
  346. # endif
  347. # endif
  348. # endif
  349. # endif
  350. # endif
  351. # ifdef YYSTACK_ALLOC
  352. /* Pacify GCC's `empty if-body' warning. */
  353. # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
  354. # ifndef YYSTACK_ALLOC_MAXIMUM
  355. /* The OS might guarantee only one guard page at the bottom of the stack,
  356. and a page size can be as small as 4096 bytes. So we cannot safely
  357. invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
  358. to allow for a few compiler-allocated temporary stack slots. */
  359. # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
  360. # endif
  361. # else
  362. # define YYSTACK_ALLOC YYMALLOC
  363. # define YYSTACK_FREE YYFREE
  364. # ifndef YYSTACK_ALLOC_MAXIMUM
  365. # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
  366. # endif
  367. # if (defined __cplusplus && ! defined _STDLIB_H \
  368. && ! ((defined YYMALLOC || defined malloc) \
  369. && (defined YYFREE || defined free)))
  370. # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  371. # ifndef _STDLIB_H
  372. # define _STDLIB_H 1
  373. # endif
  374. # endif
  375. # ifndef YYMALLOC
  376. # define YYMALLOC malloc
  377. # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  378. || defined __cplusplus || defined _MSC_VER)
  379. void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
  380. # endif
  381. # endif
  382. # ifndef YYFREE
  383. # define YYFREE free
  384. # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
  385. || defined __cplusplus || defined _MSC_VER)
  386. void free (void *); /* INFRINGES ON USER NAME SPACE */
  387. # endif
  388. # endif
  389. # endif
  390. #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
  391. #if (! defined yyoverflow \
  392. && (! defined __cplusplus \
  393. || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  394. /* A type that is properly aligned for any stack member. */
  395. union yyalloc
  396. {
  397. yytype_int16 yyss;
  398. YYSTYPE yyvs;
  399. };
  400. /* The size of the maximum gap between one aligned stack and the next. */
  401. # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
  402. /* The size of an array large to enough to hold all stacks, each with
  403. N elements. */
  404. # define YYSTACK_BYTES(N) \
  405. ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
  406. + YYSTACK_GAP_MAXIMUM)
  407. /* Copy COUNT objects from FROM to TO. The source and destination do
  408. not overlap. */
  409. # ifndef YYCOPY
  410. # if defined __GNUC__ && 1 < __GNUC__
  411. # define YYCOPY(To, From, Count) \
  412. __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
  413. # else
  414. # define YYCOPY(To, From, Count) \
  415. do \
  416. { \
  417. YYSIZE_T yyi; \
  418. for (yyi = 0; yyi < (Count); yyi++) \
  419. (To)[yyi] = (From)[yyi]; \
  420. } \
  421. while (YYID (0))
  422. # endif
  423. # endif
  424. /* Relocate STACK from its old location to the new one. The
  425. local variables YYSIZE and YYSTACKSIZE give the old and new number of
  426. elements in the stack, and YYPTR gives the new location of the
  427. stack. Advance YYPTR to a properly aligned location for the next
  428. stack. */
  429. # define YYSTACK_RELOCATE(Stack) \
  430. do \
  431. { \
  432. YYSIZE_T yynewbytes; \
  433. YYCOPY (&yyptr->Stack, Stack, yysize); \
  434. Stack = &yyptr->Stack; \
  435. yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
  436. yyptr += yynewbytes / sizeof (*yyptr); \
  437. } \
  438. while (YYID (0))
  439. #endif
  440. /* YYFINAL -- State number of the termination state. */
  441. #define YYFINAL 52
  442. /* YYLAST -- Last index in YYTABLE. */
  443. #define YYLAST 876
  444. /* YYNTOKENS -- Number of terminals. */
  445. #define YYNTOKENS 57
  446. /* YYNNTS -- Number of nonterminals. */
  447. #define YYNNTS 10
  448. /* YYNRULES -- Number of rules. */
  449. #define YYNRULES 104
  450. /* YYNRULES -- Number of states. */
  451. #define YYNSTATES 346
  452. /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
  453. #define YYUNDEFTOK 2
  454. #define YYMAXUTOK 298
  455. #define YYTRANSLATE(YYX) \
  456. ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  457. /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
  458. static const yytype_uint8 yytranslate[] =
  459. {
  460. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  461. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  462. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  463. 2, 2, 2, 53, 2, 2, 2, 2, 2, 50,
  464. 55, 56, 46, 44, 51, 45, 2, 47, 2, 2,
  465. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  466. 2, 43, 2, 54, 2, 2, 2, 2, 2, 2,
  467. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  468. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  469. 2, 2, 2, 2, 48, 2, 2, 2, 2, 2,
  470. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  471. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  472. 2, 2, 2, 2, 2, 2, 52, 2, 2, 2,
  473. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  474. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  475. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  476. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  477. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  478. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  479. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  480. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  481. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  482. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  483. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  484. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  485. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  486. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  487. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  488. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  489. 35, 36, 37, 38, 39, 40, 41, 42, 49
  490. };
  491. #if YYDEBUG
  492. /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
  493. YYRHS. */
  494. static const yytype_uint16 yyprhs[] =
  495. {
  496. 0, 0, 3, 5, 8, 10, 15, 18, 24, 30,
  497. 36, 44, 48, 50, 54, 57, 58, 60, 62, 64,
  498. 66, 67, 70, 71, 74, 78, 82, 86, 90, 94,
  499. 98, 103, 108, 113, 118, 123, 128, 133, 138, 143,
  500. 148, 153, 158, 163, 168, 173, 178, 183, 188, 193,
  501. 198, 203, 208, 213, 218, 223, 228, 233, 238, 243,
  502. 248, 255, 264, 267, 269, 273, 277, 281, 285, 289,
  503. 293, 298, 303, 308, 313, 318, 323, 328, 333, 338,
  504. 343, 348, 353, 358, 363, 368, 373, 378, 383, 388,
  505. 393, 398, 403, 408, 413, 418, 423, 428, 433, 438,
  506. 443, 450, 459, 462, 464
  507. };
  508. /* YYRHS -- A `-1'-separated list of the rules' RHS. */
  509. static const yytype_int8 yyrhs[] =
  510. {
  511. 58, 0, -1, 59, -1, 58, 59, -1, 5, -1,
  512. 4, 43, 66, 5, -1, 1, 5, -1, 4, 50,
  513. 43, 66, 5, -1, 40, 60, 63, 64, 5, -1,
  514. 41, 65, 51, 65, 5, -1, 41, 65, 51, 65,
  515. 51, 65, 5, -1, 42, 4, 5, -1, 61, -1,
  516. 60, 51, 61, -1, 4, 62, -1, -1, 50, -1,
  517. 52, -1, 53, -1, 54, -1, -1, 38, 65, -1,
  518. -1, 39, 65, -1, 55, 65, 56, -1, 65, 44,
  519. 65, -1, 65, 45, 65, -1, 65, 46, 65, -1,
  520. 65, 47, 65, -1, 65, 48, 65, -1, 7, 55,
  521. 65, 56, -1, 6, 55, 65, 56, -1, 8, 55,
  522. 65, 56, -1, 9, 55, 65, 56, -1, 10, 55,
  523. 65, 56, -1, 11, 55, 65, 56, -1, 12, 55,
  524. 65, 56, -1, 13, 55, 65, 56, -1, 20, 55,
  525. 65, 56, -1, 21, 55, 65, 56, -1, 22, 55,
  526. 65, 56, -1, 14, 55, 65, 56, -1, 15, 55,
  527. 65, 56, -1, 16, 55, 65, 56, -1, 17, 55,
  528. 65, 56, -1, 18, 55, 65, 56, -1, 19, 55,
  529. 65, 56, -1, 23, 55, 65, 56, -1, 24, 55,
  530. 65, 56, -1, 25, 55, 65, 56, -1, 26, 55,
  531. 65, 56, -1, 27, 55, 65, 56, -1, 28, 55,
  532. 65, 56, -1, 32, 55, 65, 56, -1, 31, 55,
  533. 65, 56, -1, 33, 55, 65, 56, -1, 29, 55,
  534. 65, 56, -1, 30, 55, 65, 56, -1, 34, 55,
  535. 65, 56, -1, 35, 55, 65, 56, -1, 36, 55,
  536. 65, 51, 65, 56, -1, 37, 55, 65, 51, 65,
  537. 51, 65, 56, -1, 45, 65, -1, 3, -1, 55,
  538. 66, 56, -1, 66, 44, 66, -1, 66, 45, 66,
  539. -1, 66, 46, 66, -1, 66, 47, 66, -1, 66,
  540. 48, 66, -1, 7, 55, 66, 56, -1, 6, 55,
  541. 66, 56, -1, 8, 55, 66, 56, -1, 9, 55,
  542. 66, 56, -1, 10, 55, 66, 56, -1, 11, 55,
  543. 66, 56, -1, 12, 55, 66, 56, -1, 13, 55,
  544. 66, 56, -1, 20, 55, 66, 56, -1, 21, 55,
  545. 66, 56, -1, 22, 55, 66, 56, -1, 14, 55,
  546. 66, 56, -1, 15, 55, 66, 56, -1, 16, 55,
  547. 66, 56, -1, 17, 55, 66, 56, -1, 18, 55,
  548. 66, 56, -1, 19, 55, 66, 56, -1, 23, 55,
  549. 66, 56, -1, 24, 55, 66, 56, -1, 25, 55,
  550. 66, 56, -1, 26, 55, 66, 56, -1, 27, 55,
  551. 66, 56, -1, 28, 55, 66, 56, -1, 29, 55,
  552. 66, 56, -1, 30, 55, 66, 56, -1, 32, 55,
  553. 66, 56, -1, 31, 55, 66, 56, -1, 33, 55,
  554. 66, 56, -1, 34, 55, 66, 56, -1, 35, 55,
  555. 66, 56, -1, 36, 55, 66, 51, 66, 56, -1,
  556. 37, 55, 66, 51, 66, 51, 66, 56, -1, 45,
  557. 66, -1, 3, -1, 4, -1
  558. };
  559. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  560. static const yytype_uint16 yyrline[] =
  561. {
  562. 0, 110, 110, 111, 114, 116, 127, 139, 168, 175,
  563. 187, 207, 247, 252, 262, 275, 276, 278, 283, 288,
  564. 296, 297, 306, 307, 315, 319, 323, 327, 331, 335,
  565. 342, 346, 352, 356, 360, 364, 368, 372, 376, 380,
  566. 384, 388, 392, 396, 400, 404, 408, 412, 416, 420,
  567. 424, 428, 432, 436, 440, 444, 448, 452, 456, 460,
  568. 464, 471, 479, 483, 487, 489, 496, 503, 510, 523,
  569. 610, 617, 628, 635, 642, 649, 656, 663, 670, 677,
  570. 684, 691, 698, 705, 712, 719, 726, 733, 740, 747,
  571. 754, 761, 768, 775, 782, 789, 796, 803, 810, 817,
  572. 824, 836, 849, 856, 863
  573. };
  574. #endif
  575. #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
  576. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
  577. First, the terminals, then, starting at YYNTOKENS, nonterminals. */
  578. static const char *const yytname[] =
  579. {
  580. "$end", "error", "$undefined", "NUMBER", "IDENT", "SEP", "ABS", "SQRT",
  581. "EXP", "LOG", "LOG10", "SIN", "COS", "TAN", "ASIN", "ACOS", "ATAN",
  582. "SINH", "COSH", "TANH", "ASINH", "ACOSH", "ATANH", "FLOOR", "CEIL", "J0",
  583. "J1", "Y0", "Y1", "LGAMMA", "GAMMA", "ERF", "ERFC", "INVERF", "NORM",
  584. "INVNORM", "IGAMMA", "IBETA", "EVERY", "FROM", "PRINT", "STEP", "EXAM",
  585. "'='", "'+'", "'-'", "'*'", "'/'", "'^'", "UMINUS", "'''", "','", "'~'",
  586. "'!'", "'?'", "'('", "')'", "$accept", "program", "stat", "prtlist",
  587. "prtitem", "prttag", "optevery", "optfrom", "cexpr", "expr", 0
  588. };
  589. #endif
  590. # ifdef YYPRINT
  591. /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
  592. token YYLEX-NUM. */
  593. static const yytype_uint16 yytoknum[] =
  594. {
  595. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  596. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  597. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  598. 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
  599. 295, 296, 297, 61, 43, 45, 42, 47, 94, 298,
  600. 39, 44, 126, 33, 63, 40, 41
  601. };
  602. # endif
  603. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  604. static const yytype_uint8 yyr1[] =
  605. {
  606. 0, 57, 58, 58, 59, 59, 59, 59, 59, 59,
  607. 59, 59, 60, 60, 61, 62, 62, 62, 62, 62,
  608. 63, 63, 64, 64, 65, 65, 65, 65, 65, 65,
  609. 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
  610. 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
  611. 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
  612. 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
  613. 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
  614. 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
  615. 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
  616. 66, 66, 66, 66, 66
  617. };
  618. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  619. static const yytype_uint8 yyr2[] =
  620. {
  621. 0, 2, 1, 2, 1, 4, 2, 5, 5, 5,
  622. 7, 3, 1, 3, 2, 0, 1, 1, 1, 1,
  623. 0, 2, 0, 2, 3, 3, 3, 3, 3, 3,
  624. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  625. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  626. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  627. 6, 8, 2, 1, 3, 3, 3, 3, 3, 3,
  628. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  629. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  630. 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
  631. 6, 8, 2, 1, 1
  632. };
  633. /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
  634. STATE-NUM when YYTABLE doesn't specify something else to do. Zero
  635. means the default is an error. */
  636. static const yytype_uint8 yydefact[] =
  637. {
  638. 0, 0, 0, 4, 0, 0, 0, 0, 2, 6,
  639. 0, 0, 15, 20, 12, 63, 0, 0, 0, 0,
  640. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  641. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  642. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  643. 0, 0, 1, 3, 103, 104, 0, 0, 0, 0,
  644. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  645. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  646. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  647. 0, 0, 16, 17, 18, 19, 14, 0, 0, 22,
  648. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  649. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  650. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  651. 0, 0, 62, 0, 0, 0, 0, 0, 0, 0,
  652. 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  653. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  654. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  655. 0, 0, 0, 102, 0, 5, 0, 0, 0, 0,
  656. 0, 0, 21, 13, 0, 0, 0, 0, 0, 0,
  657. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  658. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  659. 0, 0, 0, 0, 0, 0, 0, 0, 24, 25,
  660. 26, 27, 28, 29, 0, 0, 0, 0, 0, 0,
  661. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  662. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  663. 0, 0, 0, 0, 0, 0, 0, 64, 65, 66,
  664. 67, 68, 69, 7, 23, 8, 31, 30, 32, 33,
  665. 34, 35, 36, 37, 41, 42, 43, 44, 45, 46,
  666. 38, 39, 40, 47, 48, 49, 50, 51, 52, 56,
  667. 57, 54, 53, 55, 58, 59, 0, 0, 9, 0,
  668. 71, 70, 72, 73, 74, 75, 76, 77, 81, 82,
  669. 83, 84, 85, 86, 78, 79, 80, 87, 88, 89,
  670. 90, 91, 92, 93, 94, 96, 95, 97, 98, 99,
  671. 0, 0, 0, 0, 0, 0, 0, 60, 0, 10,
  672. 100, 0, 0, 0, 61, 101
  673. };
  674. /* YYDEFGOTO[NTERM-NUM]. */
  675. static const yytype_int16 yydefgoto[] =
  676. {
  677. -1, 7, 8, 13, 14, 96, 99, 185, 50, 90
  678. };
  679. /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  680. STATE-NUM. */
  681. #define YYPACT_NINF -50
  682. static const yytype_int16 yypact[] =
  683. {
  684. 233, -2, -22, -50, 12, 181, 44, 228, -50, -50,
  685. 131, 8, -16, -36, -50, -50, 29, 30, 114, 115,
  686. 122, 123, 124, 126, 128, 130, 170, 172, 176, 180,
  687. 184, 190, 191, 192, 195, 203, 204, 206, 207, 216,
  688. 217, 234, 236, 238, 251, 254, 255, 256, 181, 181,
  689. 209, 177, -50, -50, -50, -50, 269, 272, 273, 274,
  690. 287, 290, 291, 292, 305, 308, 309, 310, 323, 326,
  691. 327, 328, 341, 344, 345, 346, 359, 362, 363, 364,
  692. 377, 380, 381, 382, 395, 398, 399, 400, 131, 131,
  693. 127, 131, -50, -50, -50, -50, -50, 181, 12, 94,
  694. 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
  695. 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
  696. 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
  697. 181, 181, -50, -39, 181, 181, 181, 181, 181, 181,
  698. -50, 131, 131, 131, 131, 131, 131, 131, 131, 131,
  699. 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
  700. 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
  701. 131, 131, 131, -50, -34, -50, 131, 131, 131, 131,
  702. 131, 175, 828, -50, 181, 225, -21, -15, 196, 232,
  703. 239, 252, 257, 270, 275, 288, 293, 306, 311, 324,
  704. 329, 342, 347, 360, 365, 378, 383, 396, 401, 414,
  705. 419, 432, 437, 450, 455, 468, 780, 788, -50, -28,
  706. -28, 246, 246, 246, -1, 473, 486, 491, 504, 509,
  707. 522, 527, 540, 545, 558, 563, 576, 581, 594, 599,
  708. 612, 617, 630, 635, 648, 653, 666, 671, 684, 689,
  709. 702, 707, 720, 725, 738, 796, 804, -50, 78, 78,
  710. 259, 259, 259, -50, 828, -50, -50, -50, -50, -50,
  711. -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
  712. -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
  713. -50, -50, -50, -50, -50, -50, 181, 181, -50, 181,
  714. -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
  715. -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
  716. -50, -50, -50, -50, -50, -50, -50, -50, -50, -50,
  717. 131, 131, 743, 812, 219, 756, 820, -50, 181, -50,
  718. -50, 131, 761, 774, -50, -50
  719. };
  720. /* YYPGOTO[NTERM-NUM]. */
  721. static const yytype_int16 yypgoto[] =
  722. {
  723. -50, -50, 318, -50, 214, -50, -50, -50, -48, -49
  724. };
  725. /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
  726. positive, shift that token. If negative, reduce the rule which
  727. number is the opposite. If zero, do what YYDEFACT says.
  728. If YYTABLE_NINF, syntax error. */
  729. #define YYTABLE_NINF -1
  730. static const yytype_uint16 yytable[] =
  731. {
  732. 132, 133, 97, 9, 298, 134, 135, 136, 137, 138,
  733. 176, 177, 178, 179, 180, 98, 12, 218, 136, 137,
  734. 138, 10, 257, 134, 135, 136, 137, 138, 11, 134,
  735. 135, 136, 137, 138, 92, 266, 93, 94, 95, 173,
  736. 174, 267, 181, 134, 135, 136, 137, 138, 51, 182,
  737. 299, 91, 186, 187, 188, 189, 190, 191, 192, 193,
  738. 194, 195, 196, 197, 198, 199, 200, 201, 202, 203,
  739. 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
  740. 214, 215, 216, 217, 100, 101, 219, 220, 221, 222,
  741. 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
  742. 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
  743. 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
  744. 253, 254, 255, 256, 178, 179, 180, 258, 259, 260,
  745. 261, 262, 175, 184, 54, 55, 264, 56, 57, 58,
  746. 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
  747. 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
  748. 79, 80, 81, 82, 83, 84, 85, 86, 87, 102,
  749. 103, 176, 177, 178, 179, 180, 88, 104, 105, 106,
  750. 263, 107, 140, 108, 15, 109, 89, 16, 17, 18,
  751. 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
  752. 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
  753. 39, 40, 41, 42, 43, 44, 45, 46, 47, 176,
  754. 177, 178, 179, 180, 339, 110, 48, 111, 52, 1,
  755. 265, 112, 2, 3, 1, 113, 49, 2, 3, 114,
  756. 134, 135, 136, 137, 138, 115, 116, 117, 332, 333,
  757. 118, 334, 268, 134, 135, 136, 137, 138, 119, 120,
  758. 139, 121, 122, 134, 135, 136, 137, 138, 4, 5,
  759. 6, 123, 124, 4, 5, 6, 134, 135, 136, 137,
  760. 138, 335, 336, 134, 135, 136, 137, 138, 269, 125,
  761. 342, 126, 343, 127, 138, 270, 134, 135, 136, 137,
  762. 138, 134, 135, 136, 137, 138, 128, 180, 271, 129,
  763. 130, 131, 183, 272, 134, 135, 136, 137, 138, 134,
  764. 135, 136, 137, 138, 141, 53, 273, 142, 143, 144,
  765. 0, 274, 134, 135, 136, 137, 138, 134, 135, 136,
  766. 137, 138, 145, 0, 275, 146, 147, 148, 0, 276,
  767. 134, 135, 136, 137, 138, 134, 135, 136, 137, 138,
  768. 149, 0, 277, 150, 151, 152, 0, 278, 134, 135,
  769. 136, 137, 138, 134, 135, 136, 137, 138, 153, 0,
  770. 279, 154, 155, 156, 0, 280, 134, 135, 136, 137,
  771. 138, 134, 135, 136, 137, 138, 157, 0, 281, 158,
  772. 159, 160, 0, 282, 134, 135, 136, 137, 138, 134,
  773. 135, 136, 137, 138, 161, 0, 283, 162, 163, 164,
  774. 0, 284, 134, 135, 136, 137, 138, 134, 135, 136,
  775. 137, 138, 165, 0, 285, 166, 167, 168, 0, 286,
  776. 134, 135, 136, 137, 138, 134, 135, 136, 137, 138,
  777. 169, 0, 287, 170, 171, 172, 0, 288, 134, 135,
  778. 136, 137, 138, 134, 135, 136, 137, 138, 0, 0,
  779. 289, 0, 0, 0, 0, 290, 134, 135, 136, 137,
  780. 138, 134, 135, 136, 137, 138, 0, 0, 291, 0,
  781. 0, 0, 0, 292, 134, 135, 136, 137, 138, 134,
  782. 135, 136, 137, 138, 0, 0, 293, 0, 0, 0,
  783. 0, 294, 134, 135, 136, 137, 138, 176, 177, 178,
  784. 179, 180, 0, 0, 295, 0, 0, 0, 0, 300,
  785. 176, 177, 178, 179, 180, 176, 177, 178, 179, 180,
  786. 0, 0, 301, 0, 0, 0, 0, 302, 176, 177,
  787. 178, 179, 180, 176, 177, 178, 179, 180, 0, 0,
  788. 303, 0, 0, 0, 0, 304, 176, 177, 178, 179,
  789. 180, 176, 177, 178, 179, 180, 0, 0, 305, 0,
  790. 0, 0, 0, 306, 176, 177, 178, 179, 180, 176,
  791. 177, 178, 179, 180, 0, 0, 307, 0, 0, 0,
  792. 0, 308, 176, 177, 178, 179, 180, 176, 177, 178,
  793. 179, 180, 0, 0, 309, 0, 0, 0, 0, 310,
  794. 176, 177, 178, 179, 180, 176, 177, 178, 179, 180,
  795. 0, 0, 311, 0, 0, 0, 0, 312, 176, 177,
  796. 178, 179, 180, 176, 177, 178, 179, 180, 0, 0,
  797. 313, 0, 0, 0, 0, 314, 176, 177, 178, 179,
  798. 180, 176, 177, 178, 179, 180, 0, 0, 315, 0,
  799. 0, 0, 0, 316, 176, 177, 178, 179, 180, 176,
  800. 177, 178, 179, 180, 0, 0, 317, 0, 0, 0,
  801. 0, 318, 176, 177, 178, 179, 180, 176, 177, 178,
  802. 179, 180, 0, 0, 319, 0, 0, 0, 0, 320,
  803. 176, 177, 178, 179, 180, 176, 177, 178, 179, 180,
  804. 0, 0, 321, 0, 0, 0, 0, 322, 176, 177,
  805. 178, 179, 180, 176, 177, 178, 179, 180, 0, 0,
  806. 323, 0, 0, 0, 0, 324, 176, 177, 178, 179,
  807. 180, 176, 177, 178, 179, 180, 0, 0, 325, 0,
  808. 0, 0, 0, 326, 176, 177, 178, 179, 180, 176,
  809. 177, 178, 179, 180, 0, 0, 327, 0, 0, 0,
  810. 0, 328, 176, 177, 178, 179, 180, 134, 135, 136,
  811. 137, 138, 0, 0, 329, 0, 0, 0, 0, 337,
  812. 176, 177, 178, 179, 180, 134, 135, 136, 137, 138,
  813. 0, 0, 340, 0, 0, 0, 0, 344, 176, 177,
  814. 178, 179, 180, 0, 134, 135, 136, 137, 138, 0,
  815. 345, 296, 134, 135, 136, 137, 138, 0, 0, 297,
  816. 176, 177, 178, 179, 180, 0, 0, 330, 176, 177,
  817. 178, 179, 180, 0, 0, 331, 134, 135, 136, 137,
  818. 138, 0, 0, 338, 176, 177, 178, 179, 180, 0,
  819. 0, 341, 134, 135, 136, 137, 138
  820. };
  821. static const yytype_int16 yycheck[] =
  822. {
  823. 48, 49, 38, 5, 5, 44, 45, 46, 47, 48,
  824. 44, 45, 46, 47, 48, 51, 4, 56, 46, 47,
  825. 48, 43, 56, 44, 45, 46, 47, 48, 50, 44,
  826. 45, 46, 47, 48, 50, 56, 52, 53, 54, 88,
  827. 89, 56, 91, 44, 45, 46, 47, 48, 4, 97,
  828. 51, 43, 100, 101, 102, 103, 104, 105, 106, 107,
  829. 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
  830. 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  831. 128, 129, 130, 131, 55, 55, 134, 135, 136, 137,
  832. 138, 139, 141, 142, 143, 144, 145, 146, 147, 148,
  833. 149, 150, 151, 152, 153, 154, 155, 156, 157, 158,
  834. 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
  835. 169, 170, 171, 172, 46, 47, 48, 176, 177, 178,
  836. 179, 180, 5, 39, 3, 4, 184, 6, 7, 8,
  837. 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
  838. 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
  839. 29, 30, 31, 32, 33, 34, 35, 36, 37, 55,
  840. 55, 44, 45, 46, 47, 48, 45, 55, 55, 55,
  841. 5, 55, 5, 55, 3, 55, 55, 6, 7, 8,
  842. 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
  843. 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
  844. 29, 30, 31, 32, 33, 34, 35, 36, 37, 44,
  845. 45, 46, 47, 48, 5, 55, 45, 55, 0, 1,
  846. 5, 55, 4, 5, 1, 55, 55, 4, 5, 55,
  847. 44, 45, 46, 47, 48, 55, 55, 55, 296, 297,
  848. 55, 299, 56, 44, 45, 46, 47, 48, 55, 55,
  849. 51, 55, 55, 44, 45, 46, 47, 48, 40, 41,
  850. 42, 55, 55, 40, 41, 42, 44, 45, 46, 47,
  851. 48, 330, 331, 44, 45, 46, 47, 48, 56, 55,
  852. 338, 55, 341, 55, 48, 56, 44, 45, 46, 47,
  853. 48, 44, 45, 46, 47, 48, 55, 48, 56, 55,
  854. 55, 55, 98, 56, 44, 45, 46, 47, 48, 44,
  855. 45, 46, 47, 48, 55, 7, 56, 55, 55, 55,
  856. -1, 56, 44, 45, 46, 47, 48, 44, 45, 46,
  857. 47, 48, 55, -1, 56, 55, 55, 55, -1, 56,
  858. 44, 45, 46, 47, 48, 44, 45, 46, 47, 48,
  859. 55, -1, 56, 55, 55, 55, -1, 56, 44, 45,
  860. 46, 47, 48, 44, 45, 46, 47, 48, 55, -1,
  861. 56, 55, 55, 55, -1, 56, 44, 45, 46, 47,
  862. 48, 44, 45, 46, 47, 48, 55, -1, 56, 55,
  863. 55, 55, -1, 56, 44, 45, 46, 47, 48, 44,
  864. 45, 46, 47, 48, 55, -1, 56, 55, 55, 55,
  865. -1, 56, 44, 45, 46, 47, 48, 44, 45, 46,
  866. 47, 48, 55, -1, 56, 55, 55, 55, -1, 56,
  867. 44, 45, 46, 47, 48, 44, 45, 46, 47, 48,
  868. 55, -1, 56, 55, 55, 55, -1, 56, 44, 45,
  869. 46, 47, 48, 44, 45, 46, 47, 48, -1, -1,
  870. 56, -1, -1, -1, -1, 56, 44, 45, 46, 47,
  871. 48, 44, 45, 46, 47, 48, -1, -1, 56, -1,
  872. -1, -1, -1, 56, 44, 45, 46, 47, 48, 44,
  873. 45, 46, 47, 48, -1, -1, 56, -1, -1, -1,
  874. -1, 56, 44, 45, 46, 47, 48, 44, 45, 46,
  875. 47, 48, -1, -1, 56, -1, -1, -1, -1, 56,
  876. 44, 45, 46, 47, 48, 44, 45, 46, 47, 48,
  877. -1, -1, 56, -1, -1, -1, -1, 56, 44, 45,
  878. 46, 47, 48, 44, 45, 46, 47, 48, -1, -1,
  879. 56, -1, -1, -1, -1, 56, 44, 45, 46, 47,
  880. 48, 44, 45, 46, 47, 48, -1, -1, 56, -1,
  881. -1, -1, -1, 56, 44, 45, 46, 47, 48, 44,
  882. 45, 46, 47, 48, -1, -1, 56, -1, -1, -1,
  883. -1, 56, 44, 45, 46, 47, 48, 44, 45, 46,
  884. 47, 48, -1, -1, 56, -1, -1, -1, -1, 56,
  885. 44, 45, 46, 47, 48, 44, 45, 46, 47, 48,
  886. -1, -1, 56, -1, -1, -1, -1, 56, 44, 45,
  887. 46, 47, 48, 44, 45, 46, 47, 48, -1, -1,
  888. 56, -1, -1, -1, -1, 56, 44, 45, 46, 47,
  889. 48, 44, 45, 46, 47, 48, -1, -1, 56, -1,
  890. -1, -1, -1, 56, 44, 45, 46, 47, 48, 44,
  891. 45, 46, 47, 48, -1, -1, 56, -1, -1, -1,
  892. -1, 56, 44, 45, 46, 47, 48, 44, 45, 46,
  893. 47, 48, -1, -1, 56, -1, -1, -1, -1, 56,
  894. 44, 45, 46, 47, 48, 44, 45, 46, 47, 48,
  895. -1, -1, 56, -1, -1, -1, -1, 56, 44, 45,
  896. 46, 47, 48, 44, 45, 46, 47, 48, -1, -1,
  897. 56, -1, -1, -1, -1, 56, 44, 45, 46, 47,
  898. 48, 44, 45, 46, 47, 48, -1, -1, 56, -1,
  899. -1, -1, -1, 56, 44, 45, 46, 47, 48, 44,
  900. 45, 46, 47, 48, -1, -1, 56, -1, -1, -1,
  901. -1, 56, 44, 45, 46, 47, 48, 44, 45, 46,
  902. 47, 48, -1, -1, 56, -1, -1, -1, -1, 56,
  903. 44, 45, 46, 47, 48, 44, 45, 46, 47, 48,
  904. -1, -1, 56, -1, -1, -1, -1, 56, 44, 45,
  905. 46, 47, 48, -1, 44, 45, 46, 47, 48, -1,
  906. 56, 51, 44, 45, 46, 47, 48, -1, -1, 51,
  907. 44, 45, 46, 47, 48, -1, -1, 51, 44, 45,
  908. 46, 47, 48, -1, -1, 51, 44, 45, 46, 47,
  909. 48, -1, -1, 51, 44, 45, 46, 47, 48, -1,
  910. -1, 51, 44, 45, 46, 47, 48
  911. };
  912. /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  913. symbol of state STATE-NUM. */
  914. static const yytype_uint8 yystos[] =
  915. {
  916. 0, 1, 4, 5, 40, 41, 42, 58, 59, 5,
  917. 43, 50, 4, 60, 61, 3, 6, 7, 8, 9,
  918. 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
  919. 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
  920. 30, 31, 32, 33, 34, 35, 36, 37, 45, 55,
  921. 65, 4, 0, 59, 3, 4, 6, 7, 8, 9,
  922. 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
  923. 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
  924. 30, 31, 32, 33, 34, 35, 36, 37, 45, 55,
  925. 66, 43, 50, 52, 53, 54, 62, 38, 51, 63,
  926. 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
  927. 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
  928. 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
  929. 55, 55, 65, 65, 44, 45, 46, 47, 48, 51,
  930. 5, 55, 55, 55, 55, 55, 55, 55, 55, 55,
  931. 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
  932. 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
  933. 55, 55, 55, 66, 66, 5, 44, 45, 46, 47,
  934. 48, 66, 65, 61, 39, 64, 65, 65, 65, 65,
  935. 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
  936. 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
  937. 65, 65, 65, 65, 65, 65, 65, 65, 56, 65,
  938. 65, 65, 65, 65, 65, 66, 66, 66, 66, 66,
  939. 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
  940. 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
  941. 66, 66, 66, 66, 66, 66, 66, 56, 66, 66,
  942. 66, 66, 66, 5, 65, 5, 56, 56, 56, 56,
  943. 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
  944. 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
  945. 56, 56, 56, 56, 56, 56, 51, 51, 5, 51,
  946. 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
  947. 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
  948. 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
  949. 51, 51, 65, 65, 65, 66, 66, 56, 51, 5,
  950. 56, 51, 65, 66, 56, 56
  951. };
  952. #define yyerrok (yyerrstatus = 0)
  953. #define yyclearin (yychar = YYEMPTY)
  954. #define YYEMPTY (-2)
  955. #define YYEOF 0
  956. #define YYACCEPT goto yyacceptlab
  957. #define YYABORT goto yyabortlab
  958. #define YYERROR goto yyerrorlab
  959. /* Like YYERROR except do call yyerror. This remains here temporarily
  960. to ease the transition to the new meaning of YYERROR, for GCC.
  961. Once GCC version 2 has supplanted version 1, this can go. */
  962. #define YYFAIL goto yyerrlab
  963. #define YYRECOVERING() (!!yyerrstatus)
  964. #define YYBACKUP(Token, Value) \
  965. do \
  966. if (yychar == YYEMPTY && yylen == 1) \
  967. { \
  968. yychar = (Token); \
  969. yylval = (Value); \
  970. yytoken = YYTRANSLATE (yychar); \
  971. YYPOPSTACK (1); \
  972. goto yybackup; \
  973. } \
  974. else \
  975. { \
  976. yyerror (YY_("syntax error: cannot back up")); \
  977. YYERROR; \
  978. } \
  979. while (YYID (0))
  980. #define YYTERROR 1
  981. #define YYERRCODE 256
  982. /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
  983. If N is 0, then set CURRENT to the empty location which ends
  984. the previous symbol: RHS[0] (always defined). */
  985. #define YYRHSLOC(Rhs, K) ((Rhs)[K])
  986. #ifndef YYLLOC_DEFAULT
  987. # define YYLLOC_DEFAULT(Current, Rhs, N) \
  988. do \
  989. if (YYID (N)) \
  990. { \
  991. (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
  992. (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
  993. (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
  994. (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
  995. } \
  996. else \
  997. { \
  998. (Current).first_line = (Current).last_line = \
  999. YYRHSLOC (Rhs, 0).last_line; \
  1000. (Current).first_column = (Current).last_column = \
  1001. YYRHSLOC (Rhs, 0).last_column; \
  1002. } \
  1003. while (YYID (0))
  1004. #endif
  1005. /* YY_LOCATION_PRINT -- Print the location on the stream.
  1006. This macro was not mandated originally: define only if we know
  1007. we won't break user code: when these are the locations we know. */
  1008. #ifndef YY_LOCATION_PRINT
  1009. # if YYLTYPE_IS_TRIVIAL
  1010. # define YY_LOCATION_PRINT(File, Loc) \
  1011. fprintf (File, "%d.%d-%d.%d", \
  1012. (Loc).first_line, (Loc).first_column, \
  1013. (Loc).last_line, (Loc).last_column)
  1014. # else
  1015. # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
  1016. # endif
  1017. #endif
  1018. /* YYLEX -- calling `yylex' with the right arguments. */
  1019. #ifdef YYLEX_PARAM
  1020. # define YYLEX yylex (YYLEX_PARAM)
  1021. #else
  1022. # define YYLEX yylex ()
  1023. #endif
  1024. /* Enable debugging if requested. */
  1025. #if YYDEBUG
  1026. # ifndef YYFPRINTF
  1027. # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  1028. # define YYFPRINTF fprintf
  1029. # endif
  1030. # define YYDPRINTF(Args) \
  1031. do { \
  1032. if (yydebug) \
  1033. YYFPRINTF Args; \
  1034. } while (YYID (0))
  1035. # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
  1036. do { \
  1037. if (yydebug) \
  1038. { \
  1039. YYFPRINTF (stderr, "%s ", Title); \
  1040. yy_symbol_print (stderr, \
  1041. Type, Value); \
  1042. YYFPRINTF (stderr, "\n"); \
  1043. } \
  1044. } while (YYID (0))
  1045. /*--------------------------------.
  1046. | Print this symbol on YYOUTPUT. |
  1047. `--------------------------------*/
  1048. /*ARGSUSED*/
  1049. #if (defined __STDC__ || defined __C99__FUNC__ \
  1050. || defined __cplusplus || defined _MSC_VER)
  1051. static void
  1052. yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  1053. #else
  1054. static void
  1055. yy_symbol_value_print (yyoutput, yytype, yyvaluep)
  1056. FILE *yyoutput;
  1057. int yytype;
  1058. YYSTYPE const * const yyvaluep;
  1059. #endif
  1060. {
  1061. if (!yyvaluep)
  1062. return;
  1063. # ifdef YYPRINT
  1064. if (yytype < YYNTOKENS)
  1065. YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
  1066. # else
  1067. YYUSE (yyoutput);
  1068. # endif
  1069. switch (yytype)
  1070. {
  1071. default:
  1072. break;
  1073. }
  1074. }
  1075. /*--------------------------------.
  1076. | Print this symbol on YYOUTPUT. |
  1077. `--------------------------------*/
  1078. #if (defined __STDC__ || defined __C99__FUNC__ \
  1079. || defined __cplusplus || defined _MSC_VER)
  1080. static void
  1081. yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
  1082. #else
  1083. static void
  1084. yy_symbol_print (yyoutput, yytype, yyvaluep)
  1085. FILE *yyoutput;
  1086. int yytype;
  1087. YYSTYPE const * const yyvaluep;
  1088. #endif
  1089. {
  1090. if (yytype < YYNTOKENS)
  1091. YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  1092. else
  1093. YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
  1094. yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  1095. YYFPRINTF (yyoutput, ")");
  1096. }
  1097. /*------------------------------------------------------------------.
  1098. | yy_stack_print -- Print the state stack from its BOTTOM up to its |
  1099. | TOP (included). |
  1100. `------------------------------------------------------------------*/
  1101. #if (defined __STDC__ || defined __C99__FUNC__ \
  1102. || defined __cplusplus || defined _MSC_VER)
  1103. static void
  1104. yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
  1105. #else
  1106. static void
  1107. yy_stack_print (bottom, top)
  1108. yytype_int16 *bottom;
  1109. yytype_int16 *top;
  1110. #endif
  1111. {
  1112. YYFPRINTF (stderr, "Stack now");
  1113. for (; bottom <= top; ++bottom)
  1114. YYFPRINTF (stderr, " %d", *bottom);
  1115. YYFPRINTF (stderr, "\n");
  1116. }
  1117. # define YY_STACK_PRINT(Bottom, Top) \
  1118. do { \
  1119. if (yydebug) \
  1120. yy_stack_print ((Bottom), (Top)); \
  1121. } while (YYID (0))
  1122. /*------------------------------------------------.
  1123. | Report that the YYRULE is going to be reduced. |
  1124. `------------------------------------------------*/
  1125. #if (defined __STDC__ || defined __C99__FUNC__ \
  1126. || defined __cplusplus || defined _MSC_VER)
  1127. static void
  1128. yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
  1129. #else
  1130. static void
  1131. yy_reduce_print (yyvsp, yyrule)
  1132. YYSTYPE *yyvsp;
  1133. int yyrule;
  1134. #endif
  1135. {
  1136. int yynrhs = yyr2[yyrule];
  1137. int yyi;
  1138. unsigned long int yylno = yyrline[yyrule];
  1139. YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
  1140. yyrule - 1, yylno);
  1141. /* The symbols being reduced. */
  1142. for (yyi = 0; yyi < yynrhs; yyi++)
  1143. {
  1144. fprintf (stderr, " $%d = ", yyi + 1);
  1145. yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
  1146. &(yyvsp[(yyi + 1) - (yynrhs)])
  1147. );
  1148. fprintf (stderr, "\n");
  1149. }
  1150. }
  1151. # define YY_REDUCE_PRINT(Rule) \
  1152. do { \
  1153. if (yydebug) \
  1154. yy_reduce_print (yyvsp, Rule); \
  1155. } while (YYID (0))
  1156. /* Nonzero means print parse trace. It is left uninitialized so that
  1157. multiple parsers can coexist. */
  1158. int yydebug;
  1159. #else /* !YYDEBUG */
  1160. # define YYDPRINTF(Args)
  1161. # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
  1162. # define YY_STACK_PRINT(Bottom, Top)
  1163. # define YY_REDUCE_PRINT(Rule)
  1164. #endif /* !YYDEBUG */
  1165. /* YYINITDEPTH -- initial size of the parser's stacks. */
  1166. #ifndef YYINITDEPTH
  1167. # define YYINITDEPTH 200
  1168. #endif
  1169. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  1170. if the built-in stack extension method is used).
  1171. Do not make this value too large; the results are undefined if
  1172. YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
  1173. evaluated with infinite-precision integer arithmetic. */
  1174. #ifndef YYMAXDEPTH
  1175. # define YYMAXDEPTH 10000
  1176. #endif
  1177. #if YYERROR_VERBOSE
  1178. # ifndef yystrlen
  1179. # if defined __GLIBC__ && defined _STRING_H
  1180. # define yystrlen strlen
  1181. # else
  1182. /* Return the length of YYSTR. */
  1183. #if (defined __STDC__ || defined __C99__FUNC__ \
  1184. || defined __cplusplus || defined _MSC_VER)
  1185. static YYSIZE_T
  1186. yystrlen (const char *yystr)
  1187. #else
  1188. static YYSIZE_T
  1189. yystrlen (yystr)
  1190. const char *yystr;
  1191. #endif
  1192. {
  1193. YYSIZE_T yylen;
  1194. for (yylen = 0; yystr[yylen]; yylen++)
  1195. continue;
  1196. return yylen;
  1197. }
  1198. # endif
  1199. # endif
  1200. # ifndef yystpcpy
  1201. # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  1202. # define yystpcpy stpcpy
  1203. # else
  1204. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  1205. YYDEST. */
  1206. #if (defined __STDC__ || defined __C99__FUNC__ \
  1207. || defined __cplusplus || defined _MSC_VER)
  1208. static char *
  1209. yystpcpy (char *yydest, const char *yysrc)
  1210. #else
  1211. static char *
  1212. yystpcpy (yydest, yysrc)
  1213. char *yydest;
  1214. const char *yysrc;
  1215. #endif
  1216. {
  1217. char *yyd = yydest;
  1218. const char *yys = yysrc;
  1219. while ((*yyd++ = *yys++) != '\0')
  1220. continue;
  1221. return yyd - 1;
  1222. }
  1223. # endif
  1224. # endif
  1225. # ifndef yytnamerr
  1226. /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
  1227. quotes and backslashes, so that it's suitable for yyerror. The
  1228. heuristic is that double-quoting is unnecessary unless the string
  1229. contains an apostrophe, a comma, or backslash (other than
  1230. backslash-backslash). YYSTR is taken from yytname. If YYRES is
  1231. null, do not copy; instead, return the length of what the result
  1232. would have been. */
  1233. static YYSIZE_T
  1234. yytnamerr (char *yyres, const char *yystr)
  1235. {
  1236. if (*yystr == '"')
  1237. {
  1238. YYSIZE_T yyn = 0;
  1239. char const *yyp = yystr;
  1240. for (;;)
  1241. switch (*++yyp)
  1242. {
  1243. case '\'':
  1244. case ',':
  1245. goto do_not_strip_quotes;
  1246. case '\\':
  1247. if (*++yyp != '\\')
  1248. goto do_not_strip_quotes;
  1249. /* Fall through. */
  1250. default:
  1251. if (yyres)
  1252. yyres[yyn] = *yyp;
  1253. yyn++;
  1254. break;
  1255. case '"':
  1256. if (yyres)
  1257. yyres[yyn] = '\0';
  1258. return yyn;
  1259. }
  1260. do_not_strip_quotes: ;
  1261. }
  1262. if (! yyres)
  1263. return yystrlen (yystr);
  1264. return yystpcpy (yyres, yystr) - yyres;
  1265. }
  1266. # endif
  1267. /* Copy into YYRESULT an error message about the unexpected token
  1268. YYCHAR while in state YYSTATE. Return the number of bytes copied,
  1269. including the terminating null byte. If YYRESULT is null, do not
  1270. copy anything; just return the number of bytes that would be
  1271. copied. As a special case, return 0 if an ordinary "syntax error"
  1272. message will do. Return YYSIZE_MAXIMUM if overflow occurs during
  1273. size calculation. */
  1274. static YYSIZE_T
  1275. yysyntax_error (char *yyresult, int yystate, int yychar)
  1276. {
  1277. int yyn = yypact[yystate];
  1278. if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
  1279. return 0;
  1280. else
  1281. {
  1282. int yytype = YYTRANSLATE (yychar);
  1283. YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
  1284. YYSIZE_T yysize = yysize0;
  1285. YYSIZE_T yysize1;
  1286. int yysize_overflow = 0;
  1287. enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  1288. char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  1289. int yyx;
  1290. # if 0
  1291. /* This is so xgettext sees the translatable formats that are
  1292. constructed on the fly. */
  1293. YY_("syntax error, unexpected %s");
  1294. YY_("syntax error, unexpected %s, expecting %s");
  1295. YY_("syntax error, unexpected %s, expecting %s or %s");
  1296. YY_("syntax error, unexpected %s, expecting %s or %s or %s");
  1297. YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
  1298. # endif
  1299. char *yyfmt;
  1300. char const *yyf;
  1301. static char const yyunexpected[] = "syntax error, unexpected %s";
  1302. static char const yyexpecting[] = ", expecting %s";
  1303. static char const yyor[] = " or %s";
  1304. char yyformat[sizeof yyunexpected
  1305. + sizeof yyexpecting - 1
  1306. + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
  1307. * (sizeof yyor - 1))];
  1308. char const *yyprefix = yyexpecting;
  1309. /* Start YYX at -YYN if negative to avoid negative indexes in
  1310. YYCHECK. */
  1311. int yyxbegin = yyn < 0 ? -yyn : 0;
  1312. /* Stay within bounds of both yycheck and yytname. */
  1313. int yychecklim = YYLAST - yyn + 1;
  1314. int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
  1315. int yycount = 1;
  1316. yyarg[0] = yytname[yytype];
  1317. yyfmt = yystpcpy (yyformat, yyunexpected);
  1318. for (yyx = yyxbegin; yyx < yyxend; ++yyx)
  1319. if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
  1320. {
  1321. if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
  1322. {
  1323. yycount = 1;
  1324. yysize = yysize0;
  1325. yyformat[sizeof yyunexpected - 1] = '\0';
  1326. break;
  1327. }
  1328. yyarg[yycount++] = yytname[yyx];
  1329. yysize1 = yysize + yytnamerr (0, yytname[yyx]);
  1330. yysize_overflow |= (yysize1 < yysize);
  1331. yysize = yysize1;
  1332. yyfmt = yystpcpy (yyfmt, yyprefix);
  1333. yyprefix = yyor;
  1334. }
  1335. yyf = YY_(yyformat);
  1336. yysize1 = yysize + yystrlen (yyf);
  1337. yysize_overflow |= (yysize1 < yysize);
  1338. yysize = yysize1;
  1339. if (yysize_overflow)
  1340. return YYSIZE_MAXIMUM;
  1341. if (yyresult)
  1342. {
  1343. /* Avoid sprintf, as that infringes on the user's name space.
  1344. Don't have undefined behavior even if the translation
  1345. produced a string with the wrong number of "%s"s. */
  1346. char *yyp = yyresult;
  1347. int yyi = 0;
  1348. while ((*yyp = *yyf) != '\0')
  1349. {
  1350. if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
  1351. {
  1352. yyp += yytnamerr (yyp, yyarg[yyi++]);
  1353. yyf += 2;
  1354. }
  1355. else
  1356. {
  1357. yyp++;
  1358. yyf++;
  1359. }
  1360. }
  1361. }
  1362. return yysize;
  1363. }
  1364. }
  1365. #endif /* YYERROR_VERBOSE */
  1366. /*-----------------------------------------------.
  1367. | Release the memory associated to this symbol. |
  1368. `-----------------------------------------------*/
  1369. /*ARGSUSED*/
  1370. #if (defined __STDC__ || defined __C99__FUNC__ \
  1371. || defined __cplusplus || defined _MSC_VER)
  1372. static void
  1373. yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
  1374. #else
  1375. static void
  1376. yydestruct (yymsg, yytype, yyvaluep)
  1377. const char *yymsg;
  1378. int yytype;
  1379. YYSTYPE *yyvaluep;
  1380. #endif
  1381. {
  1382. YYUSE (yyvaluep);
  1383. if (!yymsg)
  1384. yymsg = "Deleting";
  1385. YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
  1386. switch (yytype)
  1387. {
  1388. default:
  1389. break;
  1390. }
  1391. }
  1392. /* Prevent warnings from -Wmissing-prototypes. */
  1393. #ifdef YYPARSE_PARAM
  1394. #if defined __STDC__ || defined __cplusplus
  1395. int yyparse (void *YYPARSE_PARAM);
  1396. #else
  1397. int yyparse ();
  1398. #endif
  1399. #else /* ! YYPARSE_PARAM */
  1400. #if defined __STDC__ || defined __cplusplus
  1401. int yyparse (void);
  1402. #else
  1403. int yyparse ();
  1404. #endif
  1405. #endif /* ! YYPARSE_PARAM */
  1406. /* The look-ahead symbol. */
  1407. int yychar;
  1408. /* The semantic value of the look-ahead symbol. */
  1409. YYSTYPE yylval;
  1410. /* Number of syntax errors so far. */
  1411. int yynerrs;
  1412. /*----------.
  1413. | yyparse. |
  1414. `----------*/
  1415. #ifdef YYPARSE_PARAM
  1416. #if (defined __STDC__ || defined __C99__FUNC__ \
  1417. || defined __cplusplus || defined _MSC_VER)
  1418. int
  1419. yyparse (void *YYPARSE_PARAM)
  1420. #else
  1421. int
  1422. yyparse (YYPARSE_PARAM)
  1423. void *YYPARSE_PARAM;
  1424. #endif
  1425. #else /* ! YYPARSE_PARAM */
  1426. #if (defined __STDC__ || defined __C99__FUNC__ \
  1427. || defined __cplusplus || defined _MSC_VER)
  1428. int
  1429. yyparse (void)
  1430. #else
  1431. int
  1432. yyparse ()
  1433. #endif
  1434. #endif
  1435. {
  1436. int yystate;
  1437. int yyn;
  1438. int yyresult;
  1439. /* Number of tokens to shift before error messages enabled. */
  1440. int yyerrstatus;
  1441. /* Look-ahead token as an internal (translated) token number. */
  1442. int yytoken = 0;
  1443. #if YYERROR_VERBOSE
  1444. /* Buffer for error messages, and its allocated size. */
  1445. char yymsgbuf[128];
  1446. char *yymsg = yymsgbuf;
  1447. YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1448. #endif
  1449. /* Three stacks and their tools:
  1450. `yyss': related to states,
  1451. `yyvs': related to semantic values,
  1452. `yyls': related to locations.
  1453. Refer to the stacks thru separate pointers, to allow yyoverflow
  1454. to reallocate them elsewhere. */
  1455. /* The state stack. */
  1456. yytype_int16 yyssa[YYINITDEPTH];
  1457. yytype_int16 *yyss = yyssa;
  1458. yytype_int16 *yyssp;
  1459. /* The semantic value stack. */
  1460. YYSTYPE yyvsa[YYINITDEPTH];
  1461. YYSTYPE *yyvs = yyvsa;
  1462. YYSTYPE *yyvsp;
  1463. #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
  1464. YYSIZE_T yystacksize = YYINITDEPTH;
  1465. /* The variables used to return semantic value and location from the
  1466. action routines. */
  1467. YYSTYPE yyval;
  1468. /* The number of symbols on the RHS of the reduced rule.
  1469. Keep to zero when no symbol should be popped. */
  1470. int yylen = 0;
  1471. YYDPRINTF ((stderr, "Starting parse\n"));
  1472. yystate = 0;
  1473. yyerrstatus = 0;
  1474. yynerrs = 0;
  1475. yychar = YYEMPTY; /* Cause a token to be read. */
  1476. /* Initialize stack pointers.
  1477. Waste one element of value and location stack
  1478. so that they stay on the same level as the state stack.
  1479. The wasted elements are never initialized. */
  1480. yyssp = yyss;
  1481. yyvsp = yyvs;
  1482. goto yysetstate;
  1483. /*------------------------------------------------------------.
  1484. | yynewstate -- Push a new state, which is found in yystate. |
  1485. `------------------------------------------------------------*/
  1486. yynewstate:
  1487. /* In all cases, when you get here, the value and location stacks
  1488. have just been pushed. So pushing a state here evens the stacks. */
  1489. yyssp++;
  1490. yysetstate:
  1491. *yyssp = yystate;
  1492. if (yyss + yystacksize - 1 <= yyssp)
  1493. {
  1494. /* Get the current used size of the three stacks, in elements. */
  1495. YYSIZE_T yysize = yyssp - yyss + 1;
  1496. #ifdef yyoverflow
  1497. {
  1498. /* Give user a chance to reallocate the stack. Use copies of
  1499. these so that the &'s don't force the real ones into
  1500. memory. */
  1501. YYSTYPE *yyvs1 = yyvs;
  1502. yytype_int16 *yyss1 = yyss;
  1503. /* Each stack pointer address is followed by the size of the
  1504. data in use in that stack, in bytes. This used to be a
  1505. conditional around just the two extra args, but that might
  1506. be undefined if yyoverflow is a macro. */
  1507. yyoverflow (YY_("memory exhausted"),
  1508. &yyss1, yysize * sizeof (*yyssp),
  1509. &yyvs1, yysize * sizeof (*yyvsp),
  1510. &yystacksize);
  1511. yyss = yyss1;
  1512. yyvs = yyvs1;
  1513. }
  1514. #else /* no yyoverflow */
  1515. # ifndef YYSTACK_RELOCATE
  1516. goto yyexhaustedlab;
  1517. # else
  1518. /* Extend the stack our own way. */
  1519. if (YYMAXDEPTH <= yystacksize)
  1520. goto yyexhaustedlab;
  1521. yystacksize *= 2;
  1522. if (YYMAXDEPTH < yystacksize)
  1523. yystacksize = YYMAXDEPTH;
  1524. {
  1525. yytype_int16 *yyss1 = yyss;
  1526. union yyalloc *yyptr =
  1527. (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1528. if (! yyptr)
  1529. goto yyexhaustedlab;
  1530. YYSTACK_RELOCATE (yyss);
  1531. YYSTACK_RELOCATE (yyvs);
  1532. # undef YYSTACK_RELOCATE
  1533. if (yyss1 != yyssa)
  1534. YYSTACK_FREE (yyss1);
  1535. }
  1536. # endif
  1537. #endif /* no yyoverflow */
  1538. yyssp = yyss + yysize - 1;
  1539. yyvsp = yyvs + yysize - 1;
  1540. YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1541. (unsigned long int) yystacksize));
  1542. if (yyss + yystacksize - 1 <= yyssp)
  1543. YYABORT;
  1544. }
  1545. YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1546. goto yybackup;
  1547. /*-----------.
  1548. | yybackup. |
  1549. `-----------*/
  1550. yybackup:
  1551. /* Do appropriate processing given the current state. Read a
  1552. look-ahead token if we need one and don't already have one. */
  1553. /* First try to decide what to do without reference to look-ahead token. */
  1554. yyn = yypact[yystate];
  1555. if (yyn == YYPACT_NINF)
  1556. goto yydefault;
  1557. /* Not known => get a look-ahead token if don't already have one. */
  1558. /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
  1559. if (yychar == YYEMPTY)
  1560. {
  1561. YYDPRINTF ((stderr, "Reading a token: "));
  1562. yychar = YYLEX;
  1563. }
  1564. if (yychar <= YYEOF)
  1565. {
  1566. yychar = yytoken = YYEOF;
  1567. YYDPRINTF ((stderr, "Now at end of input.\n"));
  1568. }
  1569. else
  1570. {
  1571. yytoken = YYTRANSLATE (yychar);
  1572. YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1573. }
  1574. /* If the proper action on seeing token YYTOKEN is to reduce or to
  1575. detect an error, take that action. */
  1576. yyn += yytoken;
  1577. if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1578. goto yydefault;
  1579. yyn = yytable[yyn];
  1580. if (yyn <= 0)
  1581. {
  1582. if (yyn == 0 || yyn == YYTABLE_NINF)
  1583. goto yyerrlab;
  1584. yyn = -yyn;
  1585. goto yyreduce;
  1586. }
  1587. if (yyn == YYFINAL)
  1588. YYACCEPT;
  1589. /* Count tokens shifted since error; after three, turn off error
  1590. status. */
  1591. if (yyerrstatus)
  1592. yyerrstatus--;
  1593. /* Shift the look-ahead token. */
  1594. YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1595. /* Discard the shifted token unless it is eof. */
  1596. if (yychar != YYEOF)
  1597. yychar = YYEMPTY;
  1598. yystate = yyn;
  1599. *++yyvsp = yylval;
  1600. goto yynewstate;
  1601. /*-----------------------------------------------------------.
  1602. | yydefault -- do the default action for the current state. |
  1603. `-----------------------------------------------------------*/
  1604. yydefault:
  1605. yyn = yydefact[yystate];
  1606. if (yyn == 0)
  1607. goto yyerrlab;
  1608. goto yyreduce;
  1609. /*-----------------------------.
  1610. | yyreduce -- Do a reduction. |
  1611. `-----------------------------*/
  1612. yyreduce:
  1613. /* yyn is the number of a rule to reduce with. */
  1614. yylen = yyr2[yyn];
  1615. /* If YYLEN is nonzero, implement the default value of the action:
  1616. `$$ = $1'.
  1617. Otherwise, the following line sets YYVAL to garbage.
  1618. This behavior is undocumented and Bison
  1619. users should not rely upon it. Assigning to YYVAL
  1620. unconditionally makes the parser a bit smaller, and it avoids a
  1621. GCC warning that YYVAL may be used uninitialized. */
  1622. yyval = yyvsp[1-yylen];
  1623. YY_REDUCE_PRINT (yyn);
  1624. switch (yyn)
  1625. {
  1626. case 4:
  1627. #line 115 "gram.y"
  1628. { lfree((yyvsp[(1) - (1)].lexptr)); }
  1629. break;
  1630. case 5:
  1631. #line 117 "gram.y"
  1632. {
  1633. struct sym *sp;
  1634. sp = lookup((yyvsp[(1) - (4)].lexptr)->lx_u.lxu_name);
  1635. sp->sy_value = eval((yyvsp[(3) - (4)].exprptr));
  1636. sp->sy_flags |= SF_INIT;
  1637. lfree((yyvsp[(1) - (4)].lexptr));
  1638. efree((yyvsp[(3) - (4)].exprptr));
  1639. lfree((yyvsp[(4) - (4)].lexptr));
  1640. }
  1641. break;
  1642. case 6:
  1643. #line 128 "gram.y"
  1644. {
  1645. if (errmess == NULL)
  1646. errmess = "syntax error";
  1647. fprintf (stderr, "%s:%s:%d: %s\n",
  1648. progname, filename,
  1649. ((yyvsp[(2) - (2)].lexptr)->lx_lino), errmess);
  1650. errmess = NULL;
  1651. lfree((yyvsp[(2) - (2)].lexptr));
  1652. yyerrok;
  1653. yyclearin;
  1654. }
  1655. break;
  1656. case 7:
  1657. #line 140 "gram.y"
  1658. {
  1659. struct sym *sp;
  1660. struct prt *pp, *qp;
  1661. sp = lookup((yyvsp[(1) - (5)].lexptr)->lx_u.lxu_name);
  1662. efree(sp->sy_expr);
  1663. sp->sy_expr = (yyvsp[(4) - (5)].exprptr);
  1664. sp->sy_flags |= SF_ISEQN;
  1665. if (!sawprint)
  1666. {
  1667. for (pp=pqueue; pp!=NULL; pp=pp->pr_link)
  1668. if (pp->pr_sym == sp)
  1669. goto found;
  1670. pp = palloc();
  1671. pp->pr_sym = sp;
  1672. if (pqueue == NULL)
  1673. pqueue = pp;
  1674. else
  1675. {
  1676. for (qp=pqueue; qp->pr_link!=NULL; )
  1677. qp = qp->pr_link;
  1678. qp->pr_link = pp;
  1679. }
  1680. }
  1681. found:
  1682. lfree((yyvsp[(1) - (5)].lexptr));
  1683. lfree((yyvsp[(5) - (5)].lexptr));
  1684. }
  1685. break;
  1686. case 8:
  1687. #line 169 "gram.y"
  1688. {
  1689. sawprint = true;
  1690. prerr = erritem;
  1691. erritem = false;
  1692. lfree((yyvsp[(5) - (5)].lexptr));
  1693. }
  1694. break;
  1695. case 9:
  1696. #line 176 "gram.y"
  1697. {
  1698. lfree((yyvsp[(5) - (5)].lexptr));
  1699. tstart = (yyvsp[(2) - (5)].lexptr)->lx_u.lxu_value;
  1700. lfree((yyvsp[(2) - (5)].lexptr));
  1701. tstop = (yyvsp[(4) - (5)].lexptr)->lx_u.lxu_value;
  1702. lfree((yyvsp[(4) - (5)].lexptr));
  1703. if (!conflag)
  1704. startstep();
  1705. solve();
  1706. sawstep = true;
  1707. }
  1708. break;
  1709. case 10:
  1710. #line 188 "gram.y"
  1711. {
  1712. double savstep;
  1713. bool savconflag;
  1714. lfree((yyvsp[(7) - (7)].lexptr));
  1715. tstart = (yyvsp[(2) - (7)].lexptr)->lx_u.lxu_value;
  1716. lfree((yyvsp[(2) - (7)].lexptr));
  1717. tstop = (yyvsp[(4) - (7)].lexptr)->lx_u.lxu_value;
  1718. lfree((yyvsp[(4) - (7)].lexptr));
  1719. savstep = tstep;
  1720. tstep = (yyvsp[(6) - (7)].lexptr)->lx_u.lxu_value;
  1721. lfree((yyvsp[(6) - (7)].lexptr));
  1722. savconflag = conflag;
  1723. conflag = true;
  1724. solve();
  1725. tstep = savstep;
  1726. conflag = savconflag;
  1727. sawstep = true;
  1728. }
  1729. break;
  1730. case 11:
  1731. #line 208 "gram.y"
  1732. {
  1733. struct sym *sp;
  1734. lfree((yyvsp[(3) - (3)].lexptr));
  1735. sp = lookup((yyvsp[(2) - (3)].lexptr)->lx_u.lxu_name);
  1736. lfree((yyvsp[(2) - (3)].lexptr));
  1737. printf ("\"%.*s\" is ",NAMMAX,sp->sy_name);
  1738. switch (sp->sy_flags & SF_DEPV)
  1739. {
  1740. case SF_DEPV:
  1741. case SF_ISEQN:
  1742. printf ("a dynamic variable\n");
  1743. break;
  1744. case SF_INIT:
  1745. printf ("an initialized constant\n");
  1746. break;
  1747. case 0:
  1748. printf ("an uninitialized constant\n");
  1749. break;
  1750. default:
  1751. panicn ("impossible (%d) in EXAM action",
  1752. sp->sy_flags);
  1753. }
  1754. printf ("value:");
  1755. prval (sp->sy_value);
  1756. printf ("\nprime:");
  1757. prval (sp->sy_prime);
  1758. printf ("\nsserr:");
  1759. prval (sp->sy_sserr);
  1760. printf ("\naberr:");
  1761. prval (sp->sy_aberr);
  1762. printf ("\nacerr:");
  1763. prval (sp->sy_acerr);
  1764. putchar ('\n');
  1765. prexq(sp->sy_expr);
  1766. fflush(stdout);
  1767. }
  1768. break;
  1769. case 12:
  1770. #line 248 "gram.y"
  1771. {
  1772. pfree(pqueue);
  1773. pqueue = (yyvsp[(1) - (1)].prtptr);
  1774. }
  1775. break;
  1776. case 13:
  1777. #line 253 "gram.y"
  1778. {
  1779. struct prt *pp;
  1780. for (pp=pqueue; pp->pr_link!=NULL; pp=pp->pr_link)
  1781. ;
  1782. pp->pr_link = (yyvsp[(3) - (3)].prtptr);
  1783. }
  1784. break;
  1785. case 14:
  1786. #line 263 "gram.y"
  1787. {
  1788. struct prt *pp;
  1789. pp = palloc();
  1790. pp->pr_sym = lookup((yyvsp[(1) - (2)].lexptr)->lx_u.lxu_name);
  1791. pp->pr_which = (ent_cell)((yyvsp[(2) - (2)].simple));
  1792. lfree((yyvsp[(1) - (2)].lexptr));
  1793. (yyval.prtptr) = pp;
  1794. }
  1795. break;
  1796. case 15:
  1797. #line 275 "gram.y"
  1798. { (yyval.simple) = P_VALUE; }
  1799. break;
  1800. case 16:
  1801. #line 277 "gram.y"
  1802. { (yyval.simple) = P_PRIME; }
  1803. break;
  1804. case 17:
  1805. #line 279 "gram.y"
  1806. {
  1807. (yyval.simple) = P_ACERR;
  1808. erritem = true;
  1809. }
  1810. break;
  1811. case 18:
  1812. #line 284 "gram.y"
  1813. {
  1814. (yyval.simple) = P_ABERR;
  1815. erritem = true;
  1816. }
  1817. break;
  1818. case 19:
  1819. #line 289 "gram.y"
  1820. {
  1821. (yyval.simple) = P_SSERR;
  1822. erritem = true;
  1823. }
  1824. break;
  1825. case 20:
  1826. #line 296 "gram.y"
  1827. { sawevery = false; }
  1828. break;
  1829. case 21:
  1830. #line 298 "gram.y"
  1831. {
  1832. sawevery = true;
  1833. tevery = IROUND((yyvsp[(2) - (2)].lexptr)->lx_u.lxu_value);
  1834. lfree((yyvsp[(2) - (2)].lexptr));
  1835. }
  1836. break;
  1837. case 22:
  1838. #line 306 "gram.y"
  1839. { sawfrom = false; }
  1840. break;
  1841. case 23:
  1842. #line 308 "gram.y"
  1843. {
  1844. sawfrom = true;
  1845. tfrom = (yyvsp[(2) - (2)].lexptr)->lx_u.lxu_value;
  1846. lfree((yyvsp[(2) - (2)].lexptr));
  1847. }
  1848. break;
  1849. case 24:
  1850. #line 316 "gram.y"
  1851. {
  1852. (yyval.lexptr) = (yyvsp[(2) - (3)].lexptr);
  1853. }
  1854. break;
  1855. case 25:
  1856. #line 320 "gram.y"
  1857. {
  1858. CEXOP((yyvsp[(1) - (3)].lexptr),(yyvsp[(3) - (3)].lexptr),(yyval.lexptr),+=)
  1859. }
  1860. break;
  1861. case 26:
  1862. #line 324 "gram.y"
  1863. {
  1864. CEXOP((yyvsp[(1) - (3)].lexptr),(yyvsp[(3) - (3)].lexptr),(yyval.lexptr),-=)
  1865. }
  1866. break;
  1867. case 27:
  1868. #line 328 "gram.y"
  1869. {
  1870. CEXOP((yyvsp[(1) - (3)].lexptr),(yyvsp[(3) - (3)].lexptr),(yyval.lexptr),*=)
  1871. }
  1872. break;
  1873. case 28:
  1874. #line 332 "gram.y"
  1875. {
  1876. CEXOP((yyvsp[(1) - (3)].lexptr),(yyvsp[(3) - (3)].lexptr),(yyval.lexptr),/=)
  1877. }
  1878. break;
  1879. case 29:
  1880. #line 336 "gram.y"
  1881. {
  1882. (yyvsp[(1) - (3)].lexptr)->lx_u.lxu_value =
  1883. pow((yyvsp[(1) - (3)].lexptr)->lx_u.lxu_value,(yyvsp[(3) - (3)].lexptr)->lx_u.lxu_value);
  1884. lfree((yyvsp[(3) - (3)].lexptr));
  1885. (yyval.lexptr) = (yyvsp[(1) - (3)].lexptr);
  1886. }
  1887. break;
  1888. case 30:
  1889. #line 343 "gram.y"
  1890. {
  1891. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),sqrt)
  1892. }
  1893. break;
  1894. case 31:
  1895. #line 347 "gram.y"
  1896. {
  1897. if ((yyvsp[(3) - (4)].lexptr)->lx_u.lxu_value < 0)
  1898. (yyvsp[(3) - (4)].lexptr)->lx_u.lxu_value = -((yyvsp[(3) - (4)].lexptr)->lx_u.lxu_value);
  1899. (yyval.lexptr) = (yyvsp[(3) - (4)].lexptr);
  1900. }
  1901. break;
  1902. case 32:
  1903. #line 353 "gram.y"
  1904. {
  1905. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),exp)
  1906. }
  1907. break;
  1908. case 33:
  1909. #line 357 "gram.y"
  1910. {
  1911. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),log)
  1912. }
  1913. break;
  1914. case 34:
  1915. #line 361 "gram.y"
  1916. {
  1917. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),log10)
  1918. }
  1919. break;
  1920. case 35:
  1921. #line 365 "gram.y"
  1922. {
  1923. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),sin)
  1924. }
  1925. break;
  1926. case 36:
  1927. #line 369 "gram.y"
  1928. {
  1929. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),cos)
  1930. }
  1931. break;
  1932. case 37:
  1933. #line 373 "gram.y"
  1934. {
  1935. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),tan)
  1936. }
  1937. break;
  1938. case 38:
  1939. #line 377 "gram.y"
  1940. {
  1941. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),asinh)
  1942. }
  1943. break;
  1944. case 39:
  1945. #line 381 "gram.y"
  1946. {
  1947. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),acosh)
  1948. }
  1949. break;
  1950. case 40:
  1951. #line 385 "gram.y"
  1952. {
  1953. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),atanh)
  1954. }
  1955. break;
  1956. case 41:
  1957. #line 389 "gram.y"
  1958. {
  1959. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),asin)
  1960. }
  1961. break;
  1962. case 42:
  1963. #line 393 "gram.y"
  1964. {
  1965. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),acos)
  1966. }
  1967. break;
  1968. case 43:
  1969. #line 397 "gram.y"
  1970. {
  1971. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),atan)
  1972. }
  1973. break;
  1974. case 44:
  1975. #line 401 "gram.y"
  1976. {
  1977. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),sinh)
  1978. }
  1979. break;
  1980. case 45:
  1981. #line 405 "gram.y"
  1982. {
  1983. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),cosh)
  1984. }
  1985. break;
  1986. case 46:
  1987. #line 409 "gram.y"
  1988. {
  1989. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),tanh)
  1990. }
  1991. break;
  1992. case 47:
  1993. #line 413 "gram.y"
  1994. {
  1995. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),floor)
  1996. }
  1997. break;
  1998. case 48:
  1999. #line 417 "gram.y"
  2000. {
  2001. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),ceil)
  2002. }
  2003. break;
  2004. case 49:
  2005. #line 421 "gram.y"
  2006. {
  2007. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),j0)
  2008. }
  2009. break;
  2010. case 50:
  2011. #line 425 "gram.y"
  2012. {
  2013. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),j1)
  2014. }
  2015. break;
  2016. case 51:
  2017. #line 429 "gram.y"
  2018. {
  2019. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),y0)
  2020. }
  2021. break;
  2022. case 52:
  2023. #line 433 "gram.y"
  2024. {
  2025. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),y1)
  2026. }
  2027. break;
  2028. case 53:
  2029. #line 437 "gram.y"
  2030. {
  2031. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),erfc)
  2032. }
  2033. break;
  2034. case 54:
  2035. #line 441 "gram.y"
  2036. {
  2037. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),erf)
  2038. }
  2039. break;
  2040. case 55:
  2041. #line 445 "gram.y"
  2042. {
  2043. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),inverf)
  2044. }
  2045. break;
  2046. case 56:
  2047. #line 449 "gram.y"
  2048. {
  2049. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),F_LGAMMA)
  2050. }
  2051. break;
  2052. case 57:
  2053. #line 453 "gram.y"
  2054. {
  2055. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),f_gamma)
  2056. }
  2057. break;
  2058. case 58:
  2059. #line 457 "gram.y"
  2060. {
  2061. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),norm)
  2062. }
  2063. break;
  2064. case 59:
  2065. #line 461 "gram.y"
  2066. {
  2067. CEXFUNC((yyvsp[(3) - (4)].lexptr),(yyval.lexptr),invnorm)
  2068. }
  2069. break;
  2070. case 60:
  2071. #line 465 "gram.y"
  2072. {
  2073. (yyvsp[(3) - (6)].lexptr)->lx_u.lxu_value =
  2074. igamma((yyvsp[(3) - (6)].lexptr)->lx_u.lxu_value,(yyvsp[(5) - (6)].lexptr)->lx_u.lxu_value);
  2075. lfree((yyvsp[(5) - (6)].lexptr));
  2076. (yyval.lexptr) = (yyvsp[(3) - (6)].lexptr);
  2077. }
  2078. break;
  2079. case 61:
  2080. #line 472 "gram.y"
  2081. {
  2082. (yyvsp[(3) - (8)].lexptr)->lx_u.lxu_value =
  2083. ibeta((yyvsp[(3) - (8)].lexptr)->lx_u.lxu_value,(yyvsp[(5) - (8)].lexptr)->lx_u.lxu_value,(yyvsp[(7) - (8)].lexptr)->lx_u.lxu_value);
  2084. lfree((yyvsp[(5) - (8)].lexptr));
  2085. lfree((yyvsp[(7) - (8)].lexptr));
  2086. (yyval.lexptr) = (yyvsp[(3) - (8)].lexptr);
  2087. }
  2088. break;
  2089. case 62:
  2090. #line 480 "gram.y"
  2091. {
  2092. CEXFUNC((yyvsp[(2) - (2)].lexptr),(yyval.lexptr),-)
  2093. }
  2094. break;
  2095. case 63:
  2096. #line 484 "gram.y"
  2097. { (yyval.lexptr) = (yyvsp[(1) - (1)].lexptr); }
  2098. break;
  2099. case 64:
  2100. #line 488 "gram.y"
  2101. { (yyval.exprptr) = (yyvsp[(2) - (3)].exprptr); }
  2102. break;
  2103. case 65:
  2104. #line 490 "gram.y"
  2105. {
  2106. if (TWOCON((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr)))
  2107. COMBINE((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),+=)
  2108. else
  2109. BINARY((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),O_PLUS);
  2110. }
  2111. break;
  2112. case 66:
  2113. #line 497 "gram.y"
  2114. {
  2115. if (TWOCON((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr)))
  2116. COMBINE((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),-=)
  2117. else
  2118. BINARY((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),O_MINUS);
  2119. }
  2120. break;
  2121. case 67:
  2122. #line 504 "gram.y"
  2123. {
  2124. if (TWOCON((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr)))
  2125. COMBINE((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),*=)
  2126. else
  2127. BINARY((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),O_MULT);
  2128. }
  2129. break;
  2130. case 68:
  2131. #line 511 "gram.y"
  2132. {
  2133. if (TWOCON((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr)))
  2134. COMBINE((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),/=)
  2135. else if (ONECON((yyvsp[(3) - (3)].exprptr)) && (yyvsp[(3) - (3)].exprptr)->ex_value!=0.)
  2136. {
  2137. /* division by constant */
  2138. (yyvsp[(3) - (3)].exprptr)->ex_value = 1./(yyvsp[(3) - (3)].exprptr)->ex_value;
  2139. BINARY((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),O_MULT);
  2140. }
  2141. else
  2142. BINARY((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),O_DIV);
  2143. }
  2144. break;
  2145. case 69:
  2146. #line 524 "gram.y"
  2147. {
  2148. double f;
  2149. bool invert = false;
  2150. if (TWOCON((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr)))
  2151. {
  2152. /* case const ^ const */
  2153. (yyvsp[(1) - (3)].exprptr)->ex_value = pow((yyvsp[(1) - (3)].exprptr)->ex_value,(yyvsp[(3) - (3)].exprptr)->ex_value);
  2154. efree((yyvsp[(3) - (3)].exprptr));
  2155. }
  2156. else if (ONECON((yyvsp[(1) - (3)].exprptr)))
  2157. {
  2158. if ((yyvsp[(1) - (3)].exprptr)->ex_value == 1.)
  2159. {
  2160. /* case 1 ^ x */
  2161. efree((yyvsp[(3) - (3)].exprptr));
  2162. (yyval.exprptr) = (yyvsp[(1) - (3)].exprptr);
  2163. }
  2164. else
  2165. goto other;
  2166. }
  2167. else if (!ONECON((yyvsp[(3) - (3)].exprptr)))
  2168. goto other;
  2169. else
  2170. {
  2171. f = (yyvsp[(3) - (3)].exprptr)->ex_value;
  2172. if (f < 0.)
  2173. {
  2174. /*
  2175. * negative exponent means
  2176. * to append an invert cmd
  2177. */
  2178. f = -f;
  2179. invert = true;
  2180. }
  2181. if (f == 2.)
  2182. {
  2183. /* case x ^ 2 */
  2184. (yyvsp[(3) - (3)].exprptr)->ex_oper = O_SQAR;
  2185. concat((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr));
  2186. (yyval.exprptr) = (yyvsp[(1) - (3)].exprptr);
  2187. }
  2188. else if (f == 3.)
  2189. {
  2190. /* case x ^ 3 */
  2191. (yyvsp[(3) - (3)].exprptr)->ex_oper = O_CUBE;
  2192. concat((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr));
  2193. (yyval.exprptr) = (yyvsp[(1) - (3)].exprptr);
  2194. }
  2195. else if (f == 0.5)
  2196. {
  2197. /* case x ^ .5 */
  2198. (yyvsp[(3) - (3)].exprptr)->ex_oper = O_SQRT;
  2199. concat((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr));
  2200. (yyval.exprptr) = (yyvsp[(1) - (3)].exprptr);
  2201. }
  2202. else if (f == 1.5)
  2203. {
  2204. /* case x ^ 1.5 */
  2205. (yyvsp[(3) - (3)].exprptr)->ex_oper = O_CUBE;
  2206. BINARY((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),O_SQRT);
  2207. }
  2208. else if (f == 1.)
  2209. {
  2210. /* case x ^ 1 */
  2211. efree((yyvsp[(3) - (3)].exprptr));
  2212. (yyval.exprptr) = (yyvsp[(1) - (3)].exprptr);
  2213. }
  2214. else if (f == 0.)
  2215. {
  2216. /* case x ^ 0 */
  2217. efree((yyvsp[(1) - (3)].exprptr));
  2218. (yyvsp[(3) - (3)].exprptr)->ex_value = 1.;
  2219. (yyval.exprptr) = (yyvsp[(3) - (3)].exprptr);
  2220. }
  2221. else
  2222. {
  2223. other:
  2224. /* default */
  2225. invert = false;
  2226. BINARY((yyvsp[(1) - (3)].exprptr),(yyvsp[(3) - (3)].exprptr),(yyval.exprptr),O_POWER);
  2227. }
  2228. if (invert)
  2229. UNARY((yyval.exprptr),(yyval.exprptr),O_INV)
  2230. }
  2231. }
  2232. break;
  2233. case 70:
  2234. #line 611 "gram.y"
  2235. {
  2236. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2237. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),sqrt)
  2238. else
  2239. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_SQRT);
  2240. }
  2241. break;
  2242. case 71:
  2243. #line 618 "gram.y"
  2244. {
  2245. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2246. {
  2247. if ((yyvsp[(3) - (4)].exprptr)->ex_value < 0)
  2248. (yyvsp[(3) - (4)].exprptr)->ex_value = -((yyvsp[(3) - (4)].exprptr)->ex_value);
  2249. (yyval.exprptr) = (yyvsp[(3) - (4)].exprptr);
  2250. }
  2251. else
  2252. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ABS);
  2253. }
  2254. break;
  2255. case 72:
  2256. #line 629 "gram.y"
  2257. {
  2258. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2259. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),exp)
  2260. else
  2261. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_EXP);
  2262. }
  2263. break;
  2264. case 73:
  2265. #line 636 "gram.y"
  2266. {
  2267. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2268. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),log)
  2269. else
  2270. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_LOG);
  2271. }
  2272. break;
  2273. case 74:
  2274. #line 643 "gram.y"
  2275. {
  2276. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2277. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),log10)
  2278. else
  2279. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_LOG10);
  2280. }
  2281. break;
  2282. case 75:
  2283. #line 650 "gram.y"
  2284. {
  2285. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2286. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),sin)
  2287. else
  2288. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_SIN);
  2289. }
  2290. break;
  2291. case 76:
  2292. #line 657 "gram.y"
  2293. {
  2294. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2295. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),cos)
  2296. else
  2297. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_COS);
  2298. }
  2299. break;
  2300. case 77:
  2301. #line 664 "gram.y"
  2302. {
  2303. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2304. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),tan)
  2305. else
  2306. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_TAN);
  2307. }
  2308. break;
  2309. case 78:
  2310. #line 671 "gram.y"
  2311. {
  2312. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2313. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),asinh)
  2314. else
  2315. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ASINH);
  2316. }
  2317. break;
  2318. case 79:
  2319. #line 678 "gram.y"
  2320. {
  2321. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2322. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),acosh)
  2323. else
  2324. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ACOSH);
  2325. }
  2326. break;
  2327. case 80:
  2328. #line 685 "gram.y"
  2329. {
  2330. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2331. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),atanh)
  2332. else
  2333. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ATANH);
  2334. }
  2335. break;
  2336. case 81:
  2337. #line 692 "gram.y"
  2338. {
  2339. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2340. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),asin)
  2341. else
  2342. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ASIN);
  2343. }
  2344. break;
  2345. case 82:
  2346. #line 699 "gram.y"
  2347. {
  2348. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2349. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),acos)
  2350. else
  2351. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ACOS);
  2352. }
  2353. break;
  2354. case 83:
  2355. #line 706 "gram.y"
  2356. {
  2357. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2358. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),atan)
  2359. else
  2360. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ATAN);
  2361. }
  2362. break;
  2363. case 84:
  2364. #line 713 "gram.y"
  2365. {
  2366. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2367. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),sinh)
  2368. else
  2369. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_SINH);
  2370. }
  2371. break;
  2372. case 85:
  2373. #line 720 "gram.y"
  2374. {
  2375. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2376. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),cosh)
  2377. else
  2378. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_COSH);
  2379. }
  2380. break;
  2381. case 86:
  2382. #line 727 "gram.y"
  2383. {
  2384. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2385. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),tanh)
  2386. else
  2387. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_TANH);
  2388. }
  2389. break;
  2390. case 87:
  2391. #line 734 "gram.y"
  2392. {
  2393. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2394. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),floor)
  2395. else
  2396. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_FLOOR);
  2397. }
  2398. break;
  2399. case 88:
  2400. #line 741 "gram.y"
  2401. {
  2402. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2403. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),ceil)
  2404. else
  2405. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_CEIL);
  2406. }
  2407. break;
  2408. case 89:
  2409. #line 748 "gram.y"
  2410. {
  2411. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2412. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),j0)
  2413. else
  2414. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_J0);
  2415. }
  2416. break;
  2417. case 90:
  2418. #line 755 "gram.y"
  2419. {
  2420. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2421. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),j1)
  2422. else
  2423. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_J1);
  2424. }
  2425. break;
  2426. case 91:
  2427. #line 762 "gram.y"
  2428. {
  2429. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2430. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),y0)
  2431. else
  2432. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_Y0);
  2433. }
  2434. break;
  2435. case 92:
  2436. #line 769 "gram.y"
  2437. {
  2438. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2439. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),y1)
  2440. else
  2441. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_Y1);
  2442. }
  2443. break;
  2444. case 93:
  2445. #line 776 "gram.y"
  2446. {
  2447. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2448. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),F_LGAMMA)
  2449. else
  2450. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_LGAMMA);
  2451. }
  2452. break;
  2453. case 94:
  2454. #line 783 "gram.y"
  2455. {
  2456. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2457. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),f_gamma)
  2458. else
  2459. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_GAMMA);
  2460. }
  2461. break;
  2462. case 95:
  2463. #line 790 "gram.y"
  2464. {
  2465. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2466. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),erfc)
  2467. else
  2468. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ERFC);
  2469. }
  2470. break;
  2471. case 96:
  2472. #line 797 "gram.y"
  2473. {
  2474. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2475. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),erf)
  2476. else
  2477. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_ERF);
  2478. }
  2479. break;
  2480. case 97:
  2481. #line 804 "gram.y"
  2482. {
  2483. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2484. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),inverf)
  2485. else
  2486. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_INVERF);
  2487. }
  2488. break;
  2489. case 98:
  2490. #line 811 "gram.y"
  2491. {
  2492. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2493. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),norm)
  2494. else
  2495. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_NORM);
  2496. }
  2497. break;
  2498. case 99:
  2499. #line 818 "gram.y"
  2500. {
  2501. if (ONECON((yyvsp[(3) - (4)].exprptr)))
  2502. CONFUNC((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),invnorm)
  2503. else
  2504. UNARY((yyvsp[(3) - (4)].exprptr),(yyval.exprptr),O_INVNORM);
  2505. }
  2506. break;
  2507. case 100:
  2508. #line 825 "gram.y"
  2509. {
  2510. if (TWOCON((yyvsp[(3) - (6)].exprptr),(yyvsp[(5) - (6)].exprptr)))
  2511. {
  2512. (yyvsp[(3) - (6)].exprptr)->ex_value =
  2513. igamma((yyvsp[(3) - (6)].exprptr)->ex_value,(yyvsp[(5) - (6)].exprptr)->ex_value);
  2514. efree((yyvsp[(5) - (6)].exprptr));
  2515. (yyval.exprptr) = (yyvsp[(3) - (6)].exprptr);
  2516. }
  2517. else
  2518. BINARY((yyvsp[(3) - (6)].exprptr),(yyvsp[(5) - (6)].exprptr),(yyval.exprptr),O_IGAMMA);
  2519. }
  2520. break;
  2521. case 101:
  2522. #line 837 "gram.y"
  2523. {
  2524. if (THREECON((yyvsp[(3) - (8)].exprptr),(yyvsp[(5) - (8)].exprptr),(yyvsp[(7) - (8)].exprptr)))
  2525. {
  2526. (yyvsp[(3) - (8)].exprptr)->ex_value =
  2527. ibeta((yyvsp[(3) - (8)].exprptr)->ex_value,(yyvsp[(5) - (8)].exprptr)->ex_value,(yyvsp[(7) - (8)].exprptr)->ex_value);
  2528. efree((yyvsp[(5) - (8)].exprptr));
  2529. efree((yyvsp[(7) - (8)].exprptr));
  2530. (yyval.exprptr) = (yyvsp[(3) - (8)].exprptr);
  2531. }
  2532. else
  2533. TERNARY((yyvsp[(3) - (8)].exprptr),(yyvsp[(5) - (8)].exprptr),(yyvsp[(7) - (8)].exprptr),(yyval.exprptr),O_IBETA);
  2534. }
  2535. break;
  2536. case 102:
  2537. #line 850 "gram.y"
  2538. {
  2539. if (ONECON((yyvsp[(2) - (2)].exprptr)))
  2540. CONFUNC((yyvsp[(2) - (2)].exprptr),(yyval.exprptr),-)
  2541. else
  2542. UNARY((yyvsp[(2) - (2)].exprptr),(yyval.exprptr),O_NEG);
  2543. }
  2544. break;
  2545. case 103:
  2546. #line 857 "gram.y"
  2547. {
  2548. (yyval.exprptr) = ealloc();
  2549. (yyval.exprptr)->ex_oper = O_CONST;
  2550. (yyval.exprptr)->ex_value = (yyvsp[(1) - (1)].lexptr)->lx_u.lxu_value;
  2551. lfree((yyvsp[(1) - (1)].lexptr));
  2552. }
  2553. break;
  2554. case 104:
  2555. #line 864 "gram.y"
  2556. {
  2557. (yyval.exprptr) = ealloc();
  2558. (yyval.exprptr)->ex_oper = O_IDENT;
  2559. (yyval.exprptr)->ex_sym = lookup((yyvsp[(1) - (1)].lexptr)->lx_u.lxu_name);
  2560. lfree((yyvsp[(1) - (1)].lexptr));
  2561. }
  2562. break;
  2563. /* Line 1267 of yacc.c. */
  2564. #line 2888 "gram.c"
  2565. default: break;
  2566. }
  2567. YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  2568. YYPOPSTACK (yylen);
  2569. yylen = 0;
  2570. YY_STACK_PRINT (yyss, yyssp);
  2571. *++yyvsp = yyval;
  2572. /* Now `shift' the result of the reduction. Determine what state
  2573. that goes to, based on the state we popped back to and the rule
  2574. number reduced by. */
  2575. yyn = yyr1[yyn];
  2576. yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  2577. if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  2578. yystate = yytable[yystate];
  2579. else
  2580. yystate = yydefgoto[yyn - YYNTOKENS];
  2581. goto yynewstate;
  2582. /*------------------------------------.
  2583. | yyerrlab -- here on detecting error |
  2584. `------------------------------------*/
  2585. yyerrlab:
  2586. /* If not already recovering from an error, report this error. */
  2587. if (!yyerrstatus)
  2588. {
  2589. ++yynerrs;
  2590. #if ! YYERROR_VERBOSE
  2591. yyerror (YY_("syntax error"));
  2592. #else
  2593. {
  2594. YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
  2595. if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
  2596. {
  2597. YYSIZE_T yyalloc = 2 * yysize;
  2598. if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
  2599. yyalloc = YYSTACK_ALLOC_MAXIMUM;
  2600. if (yymsg != yymsgbuf)
  2601. YYSTACK_FREE (yymsg);
  2602. yymsg = (char *) YYSTACK_ALLOC (yyalloc);
  2603. if (yymsg)
  2604. yymsg_alloc = yyalloc;
  2605. else
  2606. {
  2607. yymsg = yymsgbuf;
  2608. yymsg_alloc = sizeof yymsgbuf;
  2609. }
  2610. }
  2611. if (0 < yysize && yysize <= yymsg_alloc)
  2612. {
  2613. (void) yysyntax_error (yymsg, yystate, yychar);
  2614. yyerror (yymsg);
  2615. }
  2616. else
  2617. {
  2618. yyerror (YY_("syntax error"));
  2619. if (yysize != 0)
  2620. goto yyexhaustedlab;
  2621. }
  2622. }
  2623. #endif
  2624. }
  2625. if (yyerrstatus == 3)
  2626. {
  2627. /* If just tried and failed to reuse look-ahead token after an
  2628. error, discard it. */
  2629. if (yychar <= YYEOF)
  2630. {
  2631. /* Return failure if at end of input. */
  2632. if (yychar == YYEOF)
  2633. YYABORT;
  2634. }
  2635. else
  2636. {
  2637. yydestruct ("Error: discarding",
  2638. yytoken, &yylval);
  2639. yychar = YYEMPTY;
  2640. }
  2641. }
  2642. /* Else will try to reuse look-ahead token after shifting the error
  2643. token. */
  2644. goto yyerrlab1;
  2645. /*---------------------------------------------------.
  2646. | yyerrorlab -- error raised explicitly by YYERROR. |
  2647. `---------------------------------------------------*/
  2648. yyerrorlab:
  2649. /* Pacify compilers like GCC when the user code never invokes
  2650. YYERROR and the label yyerrorlab therefore never appears in user
  2651. code. */
  2652. if (/*CONSTCOND*/ 0)
  2653. goto yyerrorlab;
  2654. /* Do not reclaim the symbols of the rule which action triggered
  2655. this YYERROR. */
  2656. YYPOPSTACK (yylen);
  2657. yylen = 0;
  2658. YY_STACK_PRINT (yyss, yyssp);
  2659. yystate = *yyssp;
  2660. goto yyerrlab1;
  2661. /*-------------------------------------------------------------.
  2662. | yyerrlab1 -- common code for both syntax error and YYERROR. |
  2663. `-------------------------------------------------------------*/
  2664. yyerrlab1:
  2665. yyerrstatus = 3; /* Each real token shifted decrements this. */
  2666. for (;;)
  2667. {
  2668. yyn = yypact[yystate];
  2669. if (yyn != YYPACT_NINF)
  2670. {
  2671. yyn += YYTERROR;
  2672. if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  2673. {
  2674. yyn = yytable[yyn];
  2675. if (0 < yyn)
  2676. break;
  2677. }
  2678. }
  2679. /* Pop the current state because it cannot handle the error token. */
  2680. if (yyssp == yyss)
  2681. YYABORT;
  2682. yydestruct ("Error: popping",
  2683. yystos[yystate], yyvsp);
  2684. YYPOPSTACK (1);
  2685. yystate = *yyssp;
  2686. YY_STACK_PRINT (yyss, yyssp);
  2687. }
  2688. if (yyn == YYFINAL)
  2689. YYACCEPT;
  2690. *++yyvsp = yylval;
  2691. /* Shift the error token. */
  2692. YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  2693. yystate = yyn;
  2694. goto yynewstate;
  2695. /*-------------------------------------.
  2696. | yyacceptlab -- YYACCEPT comes here. |
  2697. `-------------------------------------*/
  2698. yyacceptlab:
  2699. yyresult = 0;
  2700. goto yyreturn;
  2701. /*-----------------------------------.
  2702. | yyabortlab -- YYABORT comes here. |
  2703. `-----------------------------------*/
  2704. yyabortlab:
  2705. yyresult = 1;
  2706. goto yyreturn;
  2707. #ifndef yyoverflow
  2708. /*-------------------------------------------------.
  2709. | yyexhaustedlab -- memory exhaustion comes here. |
  2710. `-------------------------------------------------*/
  2711. yyexhaustedlab:
  2712. yyerror (YY_("memory exhausted"));
  2713. yyresult = 2;
  2714. /* Fall through. */
  2715. #endif
  2716. yyreturn:
  2717. if (yychar != YYEOF && yychar != YYEMPTY)
  2718. yydestruct ("Cleanup: discarding lookahead",
  2719. yytoken, &yylval);
  2720. /* Do not reclaim the symbols of the rule which action triggered
  2721. this YYABORT or YYACCEPT. */
  2722. YYPOPSTACK (yylen);
  2723. YY_STACK_PRINT (yyss, yyssp);
  2724. while (yyssp != yyss)
  2725. {
  2726. yydestruct ("Cleanup: popping",
  2727. yystos[*yyssp], yyvsp);
  2728. YYPOPSTACK (1);
  2729. }
  2730. #ifndef yyoverflow
  2731. if (yyss != yyssa)
  2732. YYSTACK_FREE (yyss);
  2733. #endif
  2734. #if YYERROR_VERBOSE
  2735. if (yymsg != yymsgbuf)
  2736. YYSTACK_FREE (yymsg);
  2737. #endif
  2738. /* Make sure YYID is used. */
  2739. return YYID (yyresult);
  2740. }
  2741. #line 871 "gram.y"
  2742. int
  2743. yyerror (const char *s)
  2744. {
  2745. return 0;
  2746. }
  2747. /*
  2748. * tack two queues of stack code together
  2749. * e1 is connected on the tail of e0
  2750. * There is no good way to test for circular
  2751. * lists, hence the silly count.
  2752. */
  2753. void
  2754. concat (struct expr *e0, struct expr *e1)
  2755. {
  2756. int count;
  2757. if (e0 == NULL || e1 == NULL)
  2758. panic ("NULL expression queue");
  2759. for (count = 0; e0->ex_next != NULL; e0 = e0->ex_next)
  2760. if (++count > 10000)
  2761. panic ("circular expression queue");
  2762. e0->ex_next = e1;
  2763. }
  2764. /*
  2765. * print an expression queue
  2766. * called when EXAMINE is invoked on a variable (see above)
  2767. */
  2768. void
  2769. prexq (const struct expr *ep)
  2770. {
  2771. const char *s;
  2772. printf (" code:");
  2773. if (ep == NULL)
  2774. putchar ('\n');
  2775. for (; ep != NULL; ep = ep->ex_next)
  2776. {
  2777. switch (ep->ex_oper)
  2778. {
  2779. case O_PLUS: s = "add"; break;
  2780. case O_MINUS: s = "subtract"; break;
  2781. case O_MULT: s = "multiply"; break;
  2782. case O_DIV: s = "divide"; break;
  2783. case O_POWER: s = "power"; break;
  2784. case O_SQRT: s = "sqrt"; break;
  2785. case O_EXP: s = "exp"; break;
  2786. case O_LOG: s = "log"; break;
  2787. case O_LOG10: s = "log10"; break;
  2788. case O_SIN: s = "sin"; break;
  2789. case O_COS: s = "cos"; break;
  2790. case O_TAN: s = "cos"; break;
  2791. case O_ASIN: s = "sin"; break;
  2792. case O_ACOS: s = "cos"; break;
  2793. case O_ATAN: s = "cos"; break;
  2794. case O_NEG: s = "negate"; break;
  2795. case O_ABS: s = "abs"; break;
  2796. case O_SINH: s = "sinh"; break;
  2797. case O_COSH: s = "cosh"; break;
  2798. case O_TANH: s = "tanh"; break;
  2799. case O_ASINH: s = "asinh"; break;
  2800. case O_ACOSH: s = "acosh"; break;
  2801. case O_ATANH: s = "atanh"; break;
  2802. case O_SQAR: s = "square"; break;
  2803. case O_CUBE: s = "cube"; break;
  2804. case O_INV: s = "invert"; break;
  2805. case O_FLOOR: s = "floor"; break;
  2806. case O_CEIL: s = "ceil"; break;
  2807. case O_J0: s = "besj0"; break;
  2808. case O_J1: s = "besj1"; break;
  2809. case O_Y0: s = "besy0"; break;
  2810. case O_Y1: s = "besy1"; break;
  2811. case O_ERF: s = "erf"; break;
  2812. case O_ERFC: s = "erfc"; break;
  2813. case O_INVERF: s = "inverf"; break;
  2814. case O_LGAMMA: s = "lgamma"; break;
  2815. case O_GAMMA: s = "gamma"; break;
  2816. case O_NORM: s = "norm"; break;
  2817. case O_INVNORM: s = "invnorm"; break;
  2818. case O_IGAMMA: s = "igamma"; break;
  2819. case O_IBETA: s = "ibeta"; break;
  2820. case O_CONST:
  2821. printf ("\tpush ");
  2822. prval (ep->ex_value);
  2823. putchar ('\n');
  2824. s = NULL;
  2825. break;
  2826. case O_IDENT:
  2827. printf ("\tpush \"%.*s\"\n",
  2828. NAMMAX, ep->ex_sym->sy_name);
  2829. s = NULL;
  2830. break;
  2831. default: s = "unknown!";
  2832. }
  2833. if (s != NULL)
  2834. printf ("\t%s\n",s);
  2835. }
  2836. }