[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [labplot] src/backend/gsl: Added parser for mathematical expressions using GSL functions and
From:       Alexander Semke <alexander.semke () web ! de>
Date:       2014-02-08 22:24:03
Message-ID: E1WCGJf-0004MA-8b () scm ! kde ! org
[Download RAW message or body]

Git commit e5984ad4928af2c3a8927e687993200a249de35a by Alexander Semke.
Committed on 08/02/2014 at 22:22.
Pushed by asemke into branch 'master'.

Added parser for mathematical expressions using GSL functions and
constants.

A  +151  -0    src/backend/gsl/constants.h     [License: UNKNOWN]  *
A  +568  -0    src/backend/gsl/functions.h     [License: UNKNOWN]  *
A  +43   -0    src/backend/gsl/parser.h     [License: UNKNOWN]  *
A  +1936 -0    src/backend/gsl/parser.tab.c     [License: GPL (v3+)]
A  +1    -0    src/backend/gsl/parser.y     [License: Trivial file]
A  +271  -0    src/backend/gsl/parser.y.linux
A  +245  -0    src/backend/gsl/parser.y.solaris
A  +11   -0    src/backend/gsl/parser_extern.h     [License: UNKNOWN]  *
A  +18   -0    src/backend/gsl/parser_struct.h     [License: UNKNOWN]  *

The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.


http://commits.kde.org/labplot/e5984ad4928af2c3a8927e687993200a249de35a

diff --git a/src/backend/gsl/constants.h b/src/backend/gsl/constants.h
new file mode 100644
index 0000000..7666644
--- /dev/null
+++ b/src/backend/gsl/constants.h
@@ -0,0 +1,151 @@
+#ifndef GSL_CONSTANTS_H
+#define GSL_CONSTANTS_H
+
+#include <gsl/gsl_math.h>
+#include <gsl/gsl_const_mksa.h>
+// #include <gsl/gsl_const_mks.h>
+// #include <gsl/gsl_const_cgsm.h>
+#include <gsl/gsl_const_num.h>
+
+struct con constants[] = {
+	//Mathematical constants
+	{"e",M_E},
+	{"pi",M_PI},
+
+	//Physical constants: \
http://www.gnu.org/software/gsl/manual/html_node/Physical-Constants.html +
+	//Physical constants in MKSA system
+
+	//Fundamental Constants
+	{"c",GSL_CONST_MKSA_SPEED_OF_LIGHT},
+	{"mu0",GSL_CONST_MKSA_VACUUM_PERMEABILITY},
+	{"e0",GSL_CONST_MKSA_VACUUM_PERMITTIVITY},
+	{"h",GSL_CONST_MKSA_PLANCKS_CONSTANT_H}
+	{"hbar",GSL_CONST_MKSA_PLANCKS_CONSTANT_HBAR}
+	{"na",GSL_CONST_NUM_AVOGADRO},
+	{"f",GSL_CONST_MKSA_FARADAY},
+	{"k",GSL_CONST_MKSA_BOLTZMANN},
+	{"r0",GSL_CONST_MKSA_MOLAR_GAS},
+	{"v0",GSL_CONST_MKSA_STANDARD_GAS_VOLUME},
+	{"sigma",GSL_CONST_MKSA_STEFAN_BOLTZMANN_CONSTANT},
+	{"gauss",GSL_CONST_MKSA_GAUSS},
+
+	//Astronomy and Astrophysics
+	{"au",GSL_CONST_MKSA_ASTRONOMICAL_UNIT},
+	{"G",GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT},
+	{"ly",GSL_CONST_MKSA_LIGHT_YEAR},
+	{"pc",GSL_CONST_MKSA_PARSEC},
+	{"gg",GSL_CONST_MKSA_GRAV_ACCEL},
+	{"ms",GSL_CONST_MKSA_SOLAR_MASS},
+
+	//Atomic and Nuclear Physics
+	{"e",GSL_CONST_MKSA_ELECTRON_CHARGE},
+	{"ev",GSL_CONST_MKSA_ELECTRON_VOLT},
+	{"amu",GSL_CONST_MKSA_UNIFIED_ATOMIC_MASS},
+	{"me",GSL_CONST_MKSA_MASS_ELECTRON},
+	{"mmu",GSL_CONST_MKSA_MASS_MUON},
+	{"mp",GSL_CONST_MKSA_MASS_PROTON},
+	{"mn",GSL_CONST_MKSA_MASS_NEUTRON},
+	{"alpha",GSL_CONST_NUM_FINE_STRUCTURE},
+	{"ry",GSL_CONST_MKSA_RYDBERG},
+	{"a0",GSL_CONST_MKSA_BOHR_RADIUS},
+	{"a",GSL_CONST_MKSA_ANGSTROM},
+	{"barn",GSL_CONST_MKSA_BARN},
+	{"muB",GSL_CONST_MKSA_BOHR_MAGNETON},
+	{"mun",GSL_CONST_MKSA_NUCLEAR_MAGNETON},
+	{"mue",GSL_CONST_MKSA_ELECTRON_MAGNETIC_MOMENT},
+	{"mup",GSL_CONST_MKSA_PROTON_MAGNETIC_MOMENT},
+	{"sigmaT",GSL_CONST_MKSA_THOMSON_CROSS_SECTION},
+	{"pD",GSL_CONST_MKSA_DEBYE},
+
+	//Measurement of Time
+	{"min",GSL_CONST_MKSA_MINUTE},
+	{"h",GSL_CONST_MKSA_HOUR},
+	{"d",GSL_CONST_MKSA_DAY},
+	{"week",GSL_CONST_MKSA_WEEK},
+
+	//Imperial Units
+	{"in",GSL_CONST_MKSA_INCH},
+	{"ft",GSL_CONST_MKSA_FOOT},
+	{"yard",GSL_CONST_MKSA_YARD},
+	{"mile",GSL_CONST_MKSA_MILE},
+	{"mil",GSL_CONST_MKSA_MIL},
+
+	//Speed and Nautical Units
+	{"v_km_per_h",GSL_CONST_MKSA_KILOMETERS_PER_HOUR},
+	{"v_mile_per_h",GSL_CONST_MKSA_MILES_PER_HOUR},
+	{"nmile",GSL_CONST_MKSA_NAUTICAL_MILE},
+	{"fathom",GSL_CONST_MKSA_FATHOM},
+	{"knot",GSL_CONST_MKSA_KNOT},
+
+	//Printers Units
+	{"pt",GSL_CONST_MKSA_POINT},
+	{"texpt",GSL_CONST_MKSA_TEXPOINT},
+
+	//Volume, Area and Length
+	{"micron",GSL_CONST_MKSA_MICRON},
+	{"hectare",GSL_CONST_MKSA_HECTARE}
+	{"acre",GSL_CONST_MKSA_ACRE},
+	{"liter",GSL_CONST_MKSA_LITER},
+	{"us_gallon",GSL_CONST_MKSA_US_GALLON},
+	{"can_gallon",GSL_CONST_MKSA_CANADIAN_GALLON},
+	{"uk_gallon",GSL_CONST_MKSA_UK_GALLON},
+	{"quart",GSL_CONST_MKSA_QUART},
+	{"pint",GSL_CONST_MKSA_PINT},
+
+	//Mass and Weight
+	{"pound",GSL_CONST_MKSA_POUND_MASS},
+	{"ounce",GSL_CONST_MKSA_OUNCE_MASS},
+	{"ton",GSL_CONST_MKSA_TON},
+	{"mton",GSL_CONST_MKSA_METRIC_TON},
+	{"uk_ton",GSL_CONST_MKSA_UK_TON},
+	{"troy_ounce",GSL_CONST_MKSA_TROY_OUNCE},
+	{"carat",GSL_CONST_MKSA_CARAT},
+	{"gram_force",GSL_CONST_MKSA_GRAM_FORCE},
+	{"pound_force",GSL_CONST_MKSA_POUND_FORCE},
+	{"kilepound_force",GSL_CONST_MKSA_KILOPOUND_FORCE},
+	{"poundal",GSL_CONST_MKSA_POUNDAL},
+
+	//Thermal Energy and Power
+	{"cal",GSL_CONST_MKSA_CALORIE},
+	{"btu",GSL_CONST_MKSA_BTU},
+	{"therm",GSL_CONST_MKSA_THERM},
+	{"hp",GSL_CONST_MKSA_HORSEPOWER},
+
+	//Pressure
+	{"bar",GSL_CONST_MKSA_BAR},
+	{"atm",GSL_CONST_MKSA_STD_ATMOSPHERE},
+	{"torr",GSL_CONST_MKSA_TORR},
+	{"mhg",GSL_CONST_MKSA_METER_OF_MERCURY},
+	{"inhg",GSL_CONST_MKSA_INCH_OF_MERCURY},
+	{"inh2o",GSL_CONST_MKSA_INCH_OF_WATER},
+	{"psi",GSL_CONST_MKSA_PSI},
+
+	//Viscosity
+	{"poise",GSL_CONST_MKSA_POISE},
+	{"stokes",GSL_CONST_MKSA_STOKES},
+
+	//Light and Illumination
+	{"stilb",GSL_CONST_MKSA_STILB},
+	{"lumen",GSL_CONST_MKSA_LUMEN},
+	{"lux",GSL_CONST_MKSA_LUX},
+	{"phot",GSL_CONST_MKSA_PHOT},
+	{"ftcandle",GSL_CONST_MKSA_FOOTCANDLE},
+	{"lambert",GSL_CONST_MKSA_LAMBERT},
+	{"ftlambert",GSL_CONST_MKSA_FOOTLAMBERT},
+
+	//Radioactivity
+	{"curie",GSL_CONST_MKSA_CURIE},
+	{"roentgen",GSL_CONST_MKSA_ROENTGEN},
+	{"rad",GSL_CONST_MKSA_RAD},
+
+	//Force and Energy
+	{"N",GSL_CONST_MKSA_NEWTON},
+	{"dyne",GSL_CONST_MKSA_DYNE},
+	{"J",GSL_CONST_MKSA_JOULE},
+	{"erg",GSL_CONST_MKSA_ERG},
+
+	{0,0}
+};
+
+#endif /* CONSTANTS_H */
diff --git a/src/backend/gsl/functions.h b/src/backend/gsl/functions.h
new file mode 100644
index 0000000..cf24357
--- /dev/null
+++ b/src/backend/gsl/functions.h
@@ -0,0 +1,568 @@
+#ifndef FUNCTIONS_H
+#define FUNCTIONS_H
+
+#include <gsl/gsl_math.h>
+#include <gsl/gsl_sf.h>
+#include <gsl/gsl_randist.h>
+
+
+/* redefine functions to use double parameter*/
+double drand() { return random()/(double)RAND_MAX; }
+double my_rand() { return rand(); }
+double my_random() { return random(); }
+double my_fac(double i) { return fac((int)i); }
+double my_fdtr(double df1, double df2, double x) { return fdtr((int)df1, (int)df2, \
x); } +double my_fdtrc(double df1, double df2, double x) { return fdtrc((int)df1, \
(int)df2, x); } +double my_fdtri(double df1, double df2, double p) { return \
fdtri((int)df1, (int)df2, p); } +double my_jn(double n, double x) { return \
jn((int)n,x); } +double my_kn(double n, double x) { return kn((int)n,x); }
+double my_ldexp(double x, double expo) { return ldexp(x,(int)expo); }
+double my_pdtr(double k, double m) { return pdtr((int)k,m); }
+double my_pdtrc(double k, double m) { return pdtrc((int)k,m); }
+double my_pdtri(double k, double y) { return pdtr((int)k,y); }
+double my_stdtr(double k, double t) { return stdtr((short)k, t); }
+double my_stdtri(double k, double p) { return stdtri((short)k,p); }
+double my_yn(double n,double x) { return yn((int)n,x); }
+
+/* wrapper for GSL functions with integer parameters*/
+#ifdef HAVE_GSL
+#define MODE GSL_PREC_DOUBLE
+/* airy functions*/
+double airy_Ai(double x) { return gsl_sf_airy_Ai(x,MODE); }
+double airy_Bi(double x) { return gsl_sf_airy_Bi(x,MODE); }
+double airy_Ais(double x) { return gsl_sf_airy_Ai_scaled(x,MODE); }
+double airy_Bis(double x) { return gsl_sf_airy_Bi_scaled(x,MODE); }
+double airy_Aid(double x) { return gsl_sf_airy_Ai_deriv(x,MODE); }
+double airy_Bid(double x) { return gsl_sf_airy_Bi_deriv(x,MODE); }
+double airy_Aids(double x) { return gsl_sf_airy_Ai_deriv_scaled(x,MODE); }
+double airy_Bids(double x) { return gsl_sf_airy_Bi_deriv_scaled(x,MODE); }
+double airy_0_Ai(double s) { return gsl_sf_airy_zero_Ai((unsigned int)s); }
+double airy_0_Bi(double s) { return gsl_sf_airy_zero_Bi((unsigned int)s); }
+double airy_0_Aid(double s) { return gsl_sf_airy_zero_Ai_deriv((unsigned int)s); }
+double airy_0_Bid(double s) { return gsl_sf_airy_zero_Bi_deriv((unsigned int)s); }
+/* bessel functions */
+double bessel_Jn(double n,double x) { return gsl_sf_bessel_Jn((int)n,x); }
+double bessel_Yn(double n,double x) { return gsl_sf_bessel_Yn((int)n,x); }
+double bessel_In(double n,double x) { return gsl_sf_bessel_In((int)n,x); }
+double bessel_Ins(double n,double x) { return gsl_sf_bessel_In_scaled((int)n,x); }
+double bessel_Kn(double n,double x) { return gsl_sf_bessel_Kn((int)n,x); }
+double bessel_Kns(double n,double x) { return gsl_sf_bessel_Kn_scaled((int)n,x); }
+double bessel_jl(double l,double x) { return gsl_sf_bessel_jl((int)l,x); }
+double bessel_yl(double l,double x) { return gsl_sf_bessel_yl((int)l,x); }
+double bessel_ils(double l,double x) { return gsl_sf_bessel_il_scaled((int)l,x); }
+double bessel_kls(double l,double x) { return gsl_sf_bessel_kl_scaled((int)l,x); }
+double bessel_0_J0(double s) { return gsl_sf_bessel_zero_J0((unsigned int)s); }
+double bessel_0_J1(double s) { return gsl_sf_bessel_zero_J1((unsigned int)s); }
+double bessel_0_Jnu(double nu,double s) { return gsl_sf_bessel_zero_Jnu(nu,(unsigned \
int)s); } +
+double hydrogenicR(double n, double l, double z, double r) { return \
gsl_sf_hydrogenicR((int)n,(int)l,z,r); } +/* elliptic integrals */
+double ellint_Kc(double x) { return gsl_sf_ellint_Kcomp(x,MODE); }
+double ellint_Ec(double x) { return gsl_sf_ellint_Ecomp(x,MODE); }
+double ellint_F(double phi,double k) { return gsl_sf_ellint_F(phi,k,MODE); }
+double ellint_E(double phi,double k) { return gsl_sf_ellint_E(phi,k,MODE); }
+double ellint_P(double phi,double k,double n) { return \
gsl_sf_ellint_P(phi,k,n,MODE); } +double ellint_D(double phi,double k,double n) { \
return gsl_sf_ellint_D(phi,k,n,MODE); } +double ellint_RC(double x,double y) { return \
gsl_sf_ellint_RC(x,y,MODE); } +double ellint_RD(double x,double y,double z) { return \
gsl_sf_ellint_RD(x,y,z,MODE); } +double ellint_RF(double x,double y,double z) { \
return gsl_sf_ellint_RF(x,y,z,MODE); } +double ellint_RJ(double x,double y,double z, \
double p) { return gsl_sf_ellint_RJ(x,y,z,p,MODE); } +
+double exprel_n(double n,double x) { return gsl_sf_exprel_n((int)n,x); }
+double fermi_dirac_int(double j,double x) { return gsl_sf_fermi_dirac_int((int)j,x); \
} +/* gamma*/
+double taylorcoeff(double n,double x) { return gsl_sf_taylorcoeff((int)n,x); }
+double fact(double n) { return gsl_sf_fact((unsigned int)n); }
+double doublefact(double n) { return gsl_sf_doublefact((unsigned int)n); }
+double lnfact(double n) { return gsl_sf_lnfact((unsigned int)n); }
+double lndoublefact(double n) { return gsl_sf_lndoublefact((unsigned int)n); }
+double choose(double n,double m) { return gsl_sf_choose((unsigned int)n,(unsigned \
int)m); } +double lnchoose(double n,double m) { return gsl_sf_lnchoose((unsigned \
int)n,(unsigned int)m); } +
+double gegenpoly_n(double n,double l,double x) { return \
gsl_sf_gegenpoly_n((int)n,l,x); } +double hyperg_1F1i(double m,double n,double x) { \
return gsl_sf_hyperg_1F1_int((int)m,(int)n,x); } +double hyperg_Ui(double m,double \
n,double x) { return gsl_sf_hyperg_U_int((int)m,(int)n,x); } +double \
laguerre_n(double n,double a,double x) { return gsl_sf_laguerre_n((int)n,a,x); } +
+double legendre_Pl(double l,double x) { return gsl_sf_legendre_Pl((int)l,x); }
+double legendre_Ql(double l,double x) { return gsl_sf_legendre_Ql((int)l,x); }
+double legendre_Plm(double l,double m,double x) { return \
gsl_sf_legendre_Plm((int)l,(int)m,x); } +double legendre_sphPlm(double l,double \
m,double x) { return gsl_sf_legendre_sphPlm((int)l,(int)m,x); } +double \
conicalP_sphreg(double l,double L,double x) { return \
gsl_sf_conicalP_sph_reg((int)l,L,x); } +double conicalP_cylreg(double m,double \
l,double x) { return gsl_sf_conicalP_sph_reg((int)m,l,x); } +double \
legendre_H3d(double l, double L,double e) { return gsl_sf_legendre_H3d((int)l,L,e); } \
+ +double gsl_pow(double x, double n) { return gsl_sf_pow_int(x,(int)n); }
+double psii(double n) { return gsl_sf_psi_int((int)n); }
+double psi1i(double n) { return gsl_sf_psi_1_int((int)n); }
+double psi_n(double m, double x) { return gsl_sf_psi_n((int)m,x); }
+
+double zetai(double n) { return gsl_sf_zeta_int((int)n); }
+double etai(double n) { return gsl_sf_eta_int((int)n); }
+
+/* random number distributions */
+double poisson(double k, double m) { return gsl_ran_poisson_pdf((unsigned int)k,m); \
} +double bernoulli(double k, double p) { return gsl_ran_bernoulli_pdf((unsigned \
int)k,p); } +double binomial(double k, double p,double n) { return \
gsl_ran_binomial_pdf((unsigned int)k,p,(unsigned int)n); } +double \
negative_binomial(double k, double p,double n) { return \
gsl_ran_negative_binomial_pdf((unsigned int)k,p,n); } +double pascal(double k, double \
p,double n) { return gsl_ran_pascal_pdf((unsigned int)k,p,(unsigned int)n); } +double \
geometric(double k, double p) { return gsl_ran_geometric_pdf((unsigned int)k,p); } \
+double hypergeometric(double k, double n1,double n2,double t) { +	return \
gsl_ran_hypergeometric_pdf((unsigned int)k,(unsigned int)n1,(unsigned \
int)n2,(unsigned int)t); +}
+double logarithmic(double k, double p) { return gsl_ran_logarithmic_pdf((unsigned \
int)k,p); } +
+#endif
+
+struct init arith_fncts[] = {
+#ifndef HAVE_SOLARIS
+  {"atan",atan},
+  {"atan2",atan2},
+  {"beta",beta},
+  {"chbevl",chbevl},
+  {"ceil",ceil},
+  {"chdtrc",chdtrc},
+  {"chdtr",chdtr},
+  {"chdtri",chdtri},
+  {"ellie",ellie},
+  {"ellik",ellik},
+  {"expn",expn},
+  {"fac",my_fac},
+  {"fdtrc",my_fdtrc},
+  {"fdtr",my_fdtr},
+  {"fdtri",my_fdtri},
+  {"gdtr",gdtr},
+  {"gdtrc",gdtrc},
+  {"hyp2f1",hyp2f1},
+  {"hyperg",hyperg},
+  {"igamc",igamc},
+  {"igam",igam},
+  {"igami",igami},
+  {"incbet",incbet},
+  {"incbi",incbi},
+  {"iv",iv},
+  {"jn",my_jn},
+  {"jv",jv},
+  {"kn",my_kn},
+  {"lbeta",lbeta},
+  {"ldexp",my_ldexp},
+  {"pdtrc",my_pdtrc},
+  {"pdtr",my_pdtr},
+  {"pdtri",my_pdtri},
+  {"pow",pow},
+  {"stdtr",my_stdtr},
+  {"stdtri",my_stdtri},
+  {"struve",struve},
+  {"yn",my_yn},
+  {"yv",yv},
+  {"zeta",zeta},
+#endif
+  {"acos",acos},
+  {"acosh",acosh},
+  {"asin",asin},
+  {"asinh",asinh},
+  {"atanh",atanh},
+  {"cbrt",cbrt},
+  {"cos", cos},
+  {"cosh",cosh},
+  {"cosm1",cosm1},
+  {"dawsn",dawsn},
+  {"ellpe",ellpe},
+  {"ellpk",ellpk},
+  {"erf",erf},
+  {"erfc",erfc},
+  {"exp", exp},
+  {"expm1",expm1},
+  {"fabs",fabs},
+/*  {"fresnl",fresnl},*/
+  {"i0",i0},
+  {"i0e",i0e},
+  {"i1",i1},
+  {"i1e",i1e},
+/*  {"ilogb",ilogb},*/
+  {"j0",j0},
+  {"j1",j1},
+  {"k0",k0},
+  {"k0e",k0e},
+  {"k1",k1},
+  {"k1e",k1e},
+  {"ln", log},
+  {"log",log10},
+  {"logb",logb},
+  {"log1p",log1p},
+/*  {"mtherr",mtherr},*/
+  {"ndtr",ndtr},
+  {"ndtri",ndtri},
+  {"psi",psi},
+#ifndef HAVE_SOLARIS
+  {"rand",my_rand},
+  {"random",my_random},
+  {"drand",drand},
+#endif
+/*  {"revers",revers},*/
+  {"rgamma",rgamma},
+  {"rint",rint},
+/*  {"round",round},*/
+/*  {"shichi",shichi},*/
+/*  {"sici",sici},*/
+  {"sin", sin},
+  {"sinh",sinh},
+  {"spence",spence},
+  {"sqrt", sqrt},
+  {"tan",tan},
+  {"tanh",tanh},
+  {"true_gamma",true_gamma},
+/*  {"trunc",trunc},*/
+  {"y0",y0},
+  {"y1",y1},
+  {"zetac",zetac},
+#ifdef HAVE_GSL
+  {"gsl_log1p",gsl_log1p},
+  {"gsl_expm1",gsl_expm1},
+  {"gsl_hypot",gsl_hypot},
+  {"gsl_acosh",gsl_acosh},
+  {"gsl_asinh",gsl_asinh},
+  {"gsl_atanh",gsl_atanh},
+  {"airy_ai",airy_Ai},
+  {"airy_bi",airy_Bi},
+  {"airy_ais",airy_Ais},
+  {"airy_bis",airy_Bis},
+  {"airy_aid",airy_Aid},
+  {"airy_bid",airy_Bid},
+  {"airy_aids",airy_Aids},
+  {"airy_bids",airy_Bids},
+  {"airy_0_ai",airy_0_Ai},
+  {"airy_0_bi",airy_0_Bi},
+  {"airy_0_aid",airy_0_Aid},
+  {"airy_0_bid",airy_0_Bid},
+  {"bessel_jj0",gsl_sf_bessel_J0},
+  {"bessel_jj1",gsl_sf_bessel_J1},
+  {"bessel_jn",bessel_Jn},
+  {"bessel_yy0",gsl_sf_bessel_Y0},
+  {"bessel_yy1",gsl_sf_bessel_Y1},
+  {"bessel_yn",bessel_Yn},
+  {"bessel_i0",gsl_sf_bessel_I0},
+  {"bessel_i1",gsl_sf_bessel_I1},
+  {"bessel_in",bessel_In},
+  {"bessel_ii0s",gsl_sf_bessel_I0_scaled},
+  {"bessel_ii1s",gsl_sf_bessel_I1_scaled},
+  {"bessel_ins",bessel_Ins},
+  {"bessel_k0",gsl_sf_bessel_K0},
+  {"bessel_k1",gsl_sf_bessel_K1},
+  {"bessel_kn",bessel_Kn},
+  {"bessel_kk0s",gsl_sf_bessel_K0_scaled},
+  {"bessel_kk1s",gsl_sf_bessel_K1_scaled},
+  {"bessel_kns",bessel_Kns},
+  {"bessel_j0",gsl_sf_bessel_j0},
+  {"bessel_j1",gsl_sf_bessel_j1},
+  {"bessel_j2",gsl_sf_bessel_j2},
+  {"bessel_jl",bessel_jl},
+  {"bessel_y0",gsl_sf_bessel_y0},
+  {"bessel_y1",gsl_sf_bessel_y1},
+  {"bessel_y2",gsl_sf_bessel_y2},
+  {"bessel_yl",bessel_yl},
+  {"bessel_i0s",gsl_sf_bessel_i0_scaled},
+  {"bessel_i1s",gsl_sf_bessel_i1_scaled},
+  {"bessel_i2s",gsl_sf_bessel_i2_scaled},
+  {"bessel_ils",bessel_ils},
+  {"bessel_k0s",gsl_sf_bessel_k0_scaled},
+  {"bessel_k1s",gsl_sf_bessel_k1_scaled},
+  {"bessel_k2s",gsl_sf_bessel_k2_scaled},
+  {"bessel_kls",bessel_kls},
+  {"bessel_jnu",gsl_sf_bessel_Jnu},
+  {"bessel_ynu",gsl_sf_bessel_Ynu},
+  {"bessel_inu",gsl_sf_bessel_Inu},
+  {"bessel_inus",gsl_sf_bessel_Inu_scaled},
+  {"bessel_knu",gsl_sf_bessel_Knu},
+  {"bessel_inknu",gsl_sf_bessel_lnKnu},
+  {"bessel_knus",gsl_sf_bessel_Knu_scaled},
+  {"bessel_0_J0",bessel_0_J0},
+  {"bessel_0_J1",bessel_0_J1},
+  {"bessel_0_Jnu",bessel_0_Jnu},
+  {"clausen",gsl_sf_clausen},
+  {"hydrogenicr_1",gsl_sf_hydrogenicR_1},
+  {"hydrogenicr",hydrogenicR},
+  {"dawson",gsl_sf_dawson},
+  {"debye_1",gsl_sf_debye_1},
+  {"debye_2",gsl_sf_debye_2},
+  {"debye_3",gsl_sf_debye_3},
+  {"debye_4",gsl_sf_debye_4},
+#ifdef HAVE_GSL18
+  {"debye_5",gsl_sf_debye_5},
+  {"debye_6",gsl_sf_debye_6},
+#endif
+  {"dilog",gsl_sf_dilog},
+  {"ellint_kc",ellint_Kc},
+  {"ellint_ec",ellint_Ec},
+  {"ellint_f",ellint_F},
+  {"ellint_e",ellint_E},
+  {"ellint_p",ellint_P},
+  {"ellint_d",ellint_D},
+  {"ellint_rc",ellint_RC},
+  {"ellint_rd",ellint_RD},
+  {"ellint_rf",ellint_RF},
+  {"ellint_rj",ellint_RJ},
+  {"gsl_erf",gsl_sf_erf},
+  {"gsl_erfc",gsl_sf_erfc},
+  {"log_erfc",gsl_sf_log_erfc},
+  {"erf_z",gsl_sf_erf_Z},
+  {"erf_q",gsl_sf_erf_Q},
+  {"gsl_exp",gsl_sf_exp},
+  {"exprel",gsl_sf_exprel},
+  {"exprel_2",gsl_sf_exprel_2},
+  {"exprel_n",exprel_n},
+  {"expint_e1",gsl_sf_expint_E1},
+  {"expint_e2",gsl_sf_expint_E2},
+  {"expint_ei",gsl_sf_expint_Ei},
+  {"shi",gsl_sf_Shi},
+  {"chi",gsl_sf_Chi},
+  {"expint_3",gsl_sf_expint_3},
+  {"si",gsl_sf_Si},
+  {"ci",gsl_sf_Ci},
+  {"atanint",gsl_sf_atanint},
+  {"fermi_dirac_m1",gsl_sf_fermi_dirac_m1},
+  {"fermi_dirac_0",gsl_sf_fermi_dirac_0},
+  {"fermi_dirac_1",gsl_sf_fermi_dirac_1},
+  {"fermi_dirac_2",gsl_sf_fermi_dirac_2},
+  {"fermi_dirac_int",fermi_dirac_int},
+  {"fermi_dirac_mhalf",gsl_sf_fermi_dirac_mhalf},
+  {"fermi_dirac_half",gsl_sf_fermi_dirac_half},
+  {"fermi_dirac_3half",gsl_sf_fermi_dirac_3half},
+  {"fermi_dirac_inc_0",gsl_sf_fermi_dirac_inc_0},
+  {"gamma",gsl_sf_gamma},
+  {"lngamma",gsl_sf_lngamma},
+  {"gammastar",gsl_sf_gammastar},
+  {"gammainv",gsl_sf_gammainv},
+  {"taylorcoeff",taylorcoeff},
+  {"fact",fact},
+  {"doublefact",doublefact},
+  {"lnfact",lnfact},
+  {"lndoublefact",lndoublefact},
+  {"choose",choose},
+  {"lnchoose",lnchoose},
+  {"poch",gsl_sf_poch},
+  {"lnpoch",gsl_sf_lnpoch},
+  {"pochrel",gsl_sf_pochrel},
+  {"gamma_inc_q",gsl_sf_gamma_inc_Q},
+  {"gamma_inc_p",gsl_sf_gamma_inc_P},
+  {"gsl_beta",gsl_sf_beta},
+  {"lnbeta",gsl_sf_lnbeta},
+  {"beta_inc",gsl_sf_beta_inc},
+  {"gegenpoly_1",gsl_sf_gegenpoly_1},
+  {"gegenpoly_2",gsl_sf_gegenpoly_2},
+  {"gegenpoly_3",gsl_sf_gegenpoly_3},
+  {"gegenpoly_n",gegenpoly_n},
+  {"hyperg_0f1",gsl_sf_hyperg_0F1},
+  {"hyperg_1f1i",hyperg_1F1i},
+  {"hyperg_1f1",gsl_sf_hyperg_1F1},
+  {"hyperg_ui",hyperg_Ui},
+  {"hyperg_u",gsl_sf_hyperg_U},
+  {"hyperg_2f1",gsl_sf_hyperg_2F1},
+  {"hyperg_2f1c",gsl_sf_hyperg_2F1_conj},
+  {"hyperg_2f1r",gsl_sf_hyperg_2F1_renorm},
+  {"hyperg_2f1cr",gsl_sf_hyperg_2F1_conj_renorm},
+  {"hyperg_2f0",gsl_sf_hyperg_2F0},
+  {"laguerre_1",gsl_sf_laguerre_1},
+  {"laguerre_2",gsl_sf_laguerre_2},
+  {"laguerre_3",gsl_sf_laguerre_3},
+  {"lambert_w0",gsl_sf_lambert_W0},
+  {"lambert_wm1",gsl_sf_lambert_Wm1},
+  {"legendre_p1",gsl_sf_legendre_P1},
+  {"legendre_p2",gsl_sf_legendre_P2},
+  {"legendre_p3",gsl_sf_legendre_P3},
+  {"legendre_pl",legendre_Pl},
+  {"legendre_q0",gsl_sf_legendre_Q0},
+  {"legendre_q1",gsl_sf_legendre_Q1},
+  {"legendre_ql",legendre_Ql},
+  {"legendre_plm",legendre_Plm},
+  {"legendre_sphplm",legendre_sphPlm},
+  {"conicalp_half",gsl_sf_conicalP_half},
+  {"conicalp_mhalf",gsl_sf_conicalP_mhalf},
+  {"conicalp_0",gsl_sf_conicalP_0},
+  {"conicalp_1",gsl_sf_conicalP_1},
+  {"conicalp_sphreg",conicalP_sphreg},
+  {"conicalp_cylreg",conicalP_cylreg},
+  {"legendre_h3d_0",gsl_sf_legendre_H3d_0},
+  {"legendre_h3d_1",gsl_sf_legendre_H3d_1},
+  {"legendre_h3d",legendre_H3d},
+  {"gsl_log",gsl_sf_log},
+  {"loga",gsl_sf_log_abs},
+  {"logp",gsl_sf_log_1plusx},
+  {"logm",gsl_sf_log_1plusx_mx},
+  {"gsl_pow",gsl_pow},
+  {"psii",psii},
+  {"psi",gsl_sf_psi},
+  {"psiy",gsl_sf_psi_1piy},
+  {"psi1i",psi1i},
+  {"psi_n",psi_n},
+  {"synchrotron_1",gsl_sf_synchrotron_1},
+  {"synchrotron_2",gsl_sf_synchrotron_2},
+  {"transport_2",gsl_sf_transport_2},
+  {"transport_3",gsl_sf_transport_3},
+  {"transport_4",gsl_sf_transport_4},
+  {"transport_5",gsl_sf_transport_5},
+  {"hypot",gsl_sf_hypot},
+  {"sinc",gsl_sf_sinc},
+  {"lnsinh",gsl_sf_lnsinh},
+  {"lncosh",gsl_sf_lncosh},
+  {"zetai",zetai},
+  {"gsl_zeta",gsl_sf_zeta},
+  {"hzeta",gsl_sf_hzeta},
+  {"etai",etai},
+  {"eta",gsl_sf_eta},
+/* from gsl_randist.h */
+  {"gaussian",gsl_ran_gaussian_pdf},
+  {"ugaussian",gsl_ran_ugaussian_pdf},
+  {"gaussian_tail",gsl_ran_gaussian_tail_pdf},
+  {"ugaussian_tail",gsl_ran_ugaussian_tail_pdf},
+  {"bivariate_gaussian",gsl_ran_bivariate_gaussian_pdf},
+  {"exponential",gsl_ran_exponential_pdf},
+  {"laplace",gsl_ran_laplace_pdf},
+  {"exppow",gsl_ran_exppow_pdf},
+  {"cauchy",gsl_ran_cauchy_pdf},
+  {"rayleigh",gsl_ran_rayleigh_pdf},
+  {"rayleigh_tail",gsl_ran_rayleigh_tail_pdf},
+  {"landau",gsl_ran_landau_pdf},
+  {"gamma_pdf",gsl_ran_gamma_pdf},
+  {"flat",gsl_ran_flat_pdf},
+  {"lognormal",gsl_ran_lognormal_pdf},
+  {"chisq",gsl_ran_chisq_pdf},
+  {"fdist",gsl_ran_fdist_pdf},
+  {"tdist",gsl_ran_tdist_pdf},
+  {"beta_pdf",gsl_ran_beta_pdf},
+  {"logistic",gsl_ran_logistic_pdf},
+  {"pareto",gsl_ran_pareto_pdf},
+  {"weibull",gsl_ran_weibull_pdf},
+  {"gumbel1",gsl_ran_gumbel1_pdf},
+  {"gumbel2",gsl_ran_gumbel2_pdf},
+  {"poisson",poisson},
+  {"bernoulli",bernoulli},
+  {"binomial",binomial},
+  {"negative_binomial",negative_binomial},
+  {"pascal",pascal},
+  {"geometric",geometric},
+  {"hypergeometric",hypergeometric},
+  {"logarithmic",logarithmic},
+#endif
+#ifdef HAVE_R
+  {"gammafn",gammafn},
+  {"lgammafn",lgammafn},
+  {"digamma",digamma},
+  {"trigamma",trigamma},
+  {"tetragamma",tetragamma},
+  {"pentagamma",pentagamma},
+  {"psigamma",psigamma},
+  {"R_beta",beta},
+  {"R_lbeta",lbeta},
+  {"choose",choose},
+  {"lchoose",lchoose},
+  {"bessel_i",bessel_i},
+  {"bessel_j",bessel_j},
+  {"bessel_k",bessel_k},
+  {"bessel_y",bessel_y},
+  {"R_pow",R_pow},
+  {"pythag",pythag},
+  {"log1p",log1p},
+  {"log1pmx",log1pmx},
+  {"lgamma1p",lgamma1p},
+  {"logspace_add",logspace_add},
+  {"logspace_sub",logspace_sub},
+  {"fmin2",fmin2},
+  {"fmax2",fmax2},
+  {"sign",sign},
+  {"fsign",fsign},
+  {"fprec",fprec},
+  {"fround",fround},
+  {"ftrunc",ftrunc},
+/* random number distributions*/
+  {"dbeta",dbeta},
+  {"pbeta",pbeta},
+  {"qbeta",qbeta},
+  {"rbeta",rbeta},
+  {"dnbeta",dnbeta},
+  {"pnbeta",pnbeta},
+  {"dbinom",dbinom},
+  {"pbinom",pbinom},
+  {"qbinom",qbinom},
+  {"rbinom",rbinom},
+  {"dcauchy",dcauchy},
+  {"pcauchy",pcauchy},
+  {"qcauchy",qcauchy},
+  {"rcauchy",rcauchy},
+  {"dchisq",dchisq},
+  {"pchisq",pchisq},
+  {"qchisq",qchisq},
+  {"rchisq",rchisq},
+  {"dnchisq",dnchisq},
+  {"pnchisq",pnchisq},
+  {"qnchisq",qnchisq},
+  {"rnchisq",rnchisq},
+  {"dexp",dexp},
+  {"pexp",pexp},
+  {"qexp",qexp},
+  {"rexp",rexp},
+  {"df",df},
+  {"pf",pf},
+  {"qf",qf},
+  {"rf",rf},
+  {"pnf",pnf},
+  {"dgamma",dgamma},
+  {"pgamma",pgamma},
+  {"qgamma",qgamma},
+  {"rgamma",rgamma},
+  {"dgeom",dgeom},
+  {"pgeom",pgeom},
+  {"qgeom",qgeom},
+  {"rgeom",rgeom},
+  {"dhyper",dhyper},
+  {"phyper",phyper},
+  {"qhyper",qhyper},
+  {"rhyper",rhyper},
+  {"dlogis",dlogis},
+  {"plogis",plogis},
+  {"qlogis",qlogis},
+  {"rlogis",rlogis},
+  {"dlnorm",dlnorm},
+  {"plnorm",plnorm},
+  {"qlnorm",qlnorm},
+  {"rlnorm",rlnorm},
+  {"dnbinom",dnbinom},
+  {"pnbinom",pnbinom},
+  {"qnbinom",qnbinom},
+  {"rnbinom",rnbinom},
+  {"dnorm",dnorm},
+  {"pnorm",pnorm},
+  {"qnorm",qnorm},
+  {"rnorm",rnorm},
+  {"dpois",dpois},
+  {"ppois",ppois},
+  {"qpois",qpois},
+  {"rpois",rpois},
+  {"dt",dt},
+  {"pt",pt},
+  {"qt",qt},
+  {"rt",rt},
+  {"pnt",pnt},
+  {"ptukey",ptukey},
+  {"qtukey",qtukey},
+  {"dunif",dunif},
+  {"punif",punif},
+  {"qunif",qunif},
+  {"runif",runif},
+  {"dweibull",dweibull},
+  {"pweibull",pweibull},
+  {"qweibull",qweibull},
+  {"rweibull",rweibull},
+  {"dwilcox",dwilcox},
+  {"pwilcox",pwilcox},
+  {"qwilcox",qwilcox},
+  {"rwilcox",rwilcox},
+  {"dsignrank",dsignrank},
+  {"psignrank",psignrank},
+  {"qsignrank",qsignrank},
+  {"rsignrank",rsignrank},
+#endif
+  {0, 0}
+};
+
+#endif /*FUNCTIONS_H*/
diff --git a/src/backend/gsl/parser.h b/src/backend/gsl/parser.h
new file mode 100644
index 0000000..71e73d8
--- /dev/null
+++ b/src/backend/gsl/parser.h
@@ -0,0 +1,43 @@
+#ifndef PARSER_H
+#define PARSER_H
+
+#include "constants.h"
+#include "functions.h"
+#include "parser_struct.h"
+
+/* Functions type.                                   */
+#ifdef HAVE_SOLARIS
+typedef double (*func_t) (double);
+#else
+typedef double (*func_t) ();
+#endif
+
+/* Data type for links in the chain of symbols.      */
+struct symrec {
+	char *name;  /* name of symbol                     */
+	int type;    /* type of symbol: either VAR or FNCT */
+	union {
+		double var;                  /* value of a VAR   */
+		int intvar;
+		func_t fnctptr;              /* value of a FNCT  */
+	} value;
+	struct symrec *next;    /* link field              */
+};
+
+typedef struct symrec symrec;
+
+double parse(char *str);
+int parse_errors();
+symrec *putsym (const char *, int);
+symrec *getsym (const char *);
+void init_table(void);
+int yyerror (const char*);
+int yylex (void);
+
+#define PARSE_STRING_SIZE       500
+double res;
+int pos;
+char string[PARSE_STRING_SIZE];
+
+
+#endif /*PARSER_H*/
diff --git a/src/backend/gsl/parser.tab.c b/src/backend/gsl/parser.tab.c
new file mode 100644
index 0000000..6ac0ed8
--- /dev/null
+++ b/src/backend/gsl/parser.tab.c
@@ -0,0 +1,1936 @@
+/* A Bison parser, made by GNU Bison 2.7.  */
+
+/* Bison implementation for Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
+   
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* As a special exception, you may create a larger work that contains
+   part or all of the Bison parser skeleton and distribute that work
+   under terms of your choice, so long as that work isn't itself a
+   parser generator using the skeleton or a modified version thereof
+   as a parser skeleton.  Alternatively, if you modify or redistribute
+   the parser skeleton itself, you may (at your option) remove this
+   special exception, which will cause the skeleton and the resulting
+   Bison output files to be licensed under the GNU General Public
+   License without this special exception.
+   
+   This special exception was added by the Free Software Foundation in
+   version 2.2 of Bison.  */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+   simplifying the original so-called "semantic" parser.  */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+   infringing on user name space.  This should be done even for local
+   variables, as they might otherwise be expanded by user macros.
+   There are some unavoidable exceptions within include files to
+   define necessary library symbols; they are noted "INFRINGES ON
+   USER NAME SPACE" below.  */
+
+/* Identify Bison output.  */
+#define YYBISON 1
+
+/* Bison version.  */
+#define YYBISON_VERSION "2.7"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
+
+
+
+/* Copy the first part of user declarations.  */
+/* Line 371 of yacc.c  */
+#line 3 "parser.y"
+
+#include "parser.h"
+
+/* Line 371 of yacc.c  */
+#line 72 "parser.tab.c"
+
+# ifndef YY_NULL
+#  if defined __cplusplus && 201103L <= __cplusplus
+#   define YY_NULL nullptr
+#  else
+#   define YY_NULL 0
+#  endif
+# endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     NUM = 258,
+     VAR = 259,
+     FNCT = 260,
+     NEG = 261
+   };
+#endif
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+{
+/* Line 387 of yacc.c  */
+#line 7 "parser.y"
+
+double dval;  /* For returning numbers.                   */
+symrec *tptr;   /* For returning symbol-table pointers      */
+
+
+/* Line 387 of yacc.c  */
+#line 124 "parser.tab.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+extern YYSTYPE yylval;
+
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* Copy the second part of user declarations.  */
+
+/* Line 390 of yacc.c  */
+#line 152 "parser.tab.c"
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+#  if ENABLE_NLS
+#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+#  endif
+# endif
+# ifndef YY_
+#  define YY_(Msgid) Msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E.  */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(E) ((void) (E))
+#else
+# define YYUSE(E) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions.  */
+#ifndef lint
+# define YYID(N) (N)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int yyi)
+#else
+static int
+YYID (yyi)
+    int yyi;
+#endif
+{
+  return yyi;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols.  */
+
+# ifdef YYSTACK_USE_ALLOCA
+#  if YYSTACK_USE_ALLOCA
+#   ifdef __GNUC__
+#    define YYSTACK_ALLOC __builtin_alloca
+#   elif defined __BUILTIN_VA_ARG_INCR
+#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+#   elif defined _AIX
+#    define YYSTACK_ALLOC __alloca
+#   elif defined _MSC_VER
+#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+#    define alloca _alloca
+#   else
+#    define YYSTACK_ALLOC alloca
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || \
defined __C99__FUNC__ \ +     || defined __cplusplus || defined _MSC_VER)
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's `empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+    /* The OS might guarantee only one guard page at the bottom of the stack,
+       and a page size can be as small as 4096 bytes.  So we cannot safely
+       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
+       to allow for a few compiler-allocated temporary stack slots.  */
+#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+#  endif
+# else
+#  define YYSTACK_ALLOC YYMALLOC
+#  define YYSTACK_FREE YYFREE
+#  ifndef YYSTACK_ALLOC_MAXIMUM
+#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+#  endif
+#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
+       && ! ((defined YYMALLOC || defined malloc) \
+	     && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined \
__C99__FUNC__ \ +     || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined \
__C99__FUNC__ \ +     || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* Relocate STACK from its old location to the new one.  The
+   local variables YYSIZE and YYSTACKSIZE give the old and new number of
+   elements in the stack, and YYPTR gives the new location of the
+   stack.  Advance YYPTR to a properly aligned location for the next
+   stack.  */
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)				\
+    do									\
+      {									\
+	YYSIZE_T yynewbytes;						\
+	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
+	Stack = &yyptr->Stack_alloc;					\
+	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+	yyptr += yynewbytes / sizeof (*yyptr);				\
+      }									\
+    while (YYID (0))
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+#  else
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYSIZE_T yyi;                         \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
+      while (YYID (0))
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  2
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   114
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  17
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  4
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  21
+/* YYNRULES -- Number of states.  */
+#define YYNSTATES  42
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
+#define YYUNDEFTOK  2
+#define YYMAXUTOK   261
+
+#define YYTRANSLATE(YYX)						\
+  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
+static const yytype_uint8 yytranslate[] =
+{
+       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+      13,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+      14,    15,     9,     8,    16,     7,     2,    10,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     6,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,    12,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
+       5,    11
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+   YYRHS.  */
+static const yytype_uint8 yyprhs[] =
+{
+       0,     0,     3,     4,     7,     9,    12,    15,    17,    19,
+      23,    27,    32,    39,    48,    59,    63,    67,    71,    75,
+      78,    82
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
+static const yytype_int8 yyrhs[] =
+{
+      18,     0,    -1,    -1,    18,    19,    -1,    13,    -1,    20,
+      13,    -1,     1,    13,    -1,     3,    -1,     4,    -1,     4,
+       6,    20,    -1,     5,    14,    15,    -1,     5,    14,    20,
+      15,    -1,     5,    14,    20,    16,    20,    15,    -1,     5,
+      14,    20,    16,    20,    16,    20,    15,    -1,     5,    14,
+      20,    16,    20,    16,    20,    16,    20,    15,    -1,    20,
+       8,    20,    -1,    20,     7,    20,    -1,    20,     9,    20,
+      -1,    20,    10,    20,    -1,     7,    20,    -1,    20,    12,
+      20,    -1,    14,    20,    15,    -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
+static const yytype_uint8 yyrline[] =
+{
+       0,    23,    23,    24,    27,    28,    29,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
+      45,    46
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || 0
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "$end", "error", "$undefined", "NUM", "VAR", "FNCT", "'='", "'-'",
+  "'+'", "'*'", "'/'", "NEG", "'^'", "'\\n'", "'('", "')'", "','",
+  "$accept", "input", "line", "expr", YY_NULL
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+   token YYLEX-NUM.  */
+static const yytype_uint16 yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,    61,    45,    43,    42,
+      47,   261,    94,    10,    40,    41,    44
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,    17,    18,    18,    19,    19,    19,    20,    20,    20,
+      20,    20,    20,    20,    20,    20,    20,    20,    20,    20,
+      20,    20
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     0,     2,     1,     2,     2,     1,     1,     3,
+       3,     4,     6,     8,    10,     3,     3,     3,     3,     2,
+       3,     3
+};
+
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE doesn't specify something else to do.  Zero
+   means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       2,     0,     1,     0,     7,     8,     0,     0,     4,     0,
+       3,     0,     6,     0,     0,    19,     0,     0,     0,     0,
+       0,     0,     5,     9,    10,     0,    21,    16,    15,    17,
+      18,    20,    11,     0,     0,    12,     0,     0,    13,     0,
+       0,    14
+};
+
+/* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
+{
+      -1,     1,    10,    11
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+#define YYPACT_NINF -13
+static const yytype_int8 yypact[] =
+{
+     -13,    17,   -13,   -12,   -13,    -3,   -10,    35,   -13,    35,
+     -13,    91,   -13,    35,    30,    -4,    73,    35,    35,    35,
+      35,    35,   -13,    98,   -13,    43,   -13,   102,   102,    -4,
+      -4,    -4,   -13,    35,    53,   -13,    35,    63,   -13,    35,
+      82,   -13
+};
+
+/* YYPGOTO[NTERM-NUM].  */
+static const yytype_int8 yypgoto[] =
+{
+     -13,   -13,   -13,    -7
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule which
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -1
+static const yytype_uint8 yytable[] =
+{
+      15,    12,    16,    13,    14,     0,    23,    25,    21,     0,
+      27,    28,    29,    30,    31,     0,     0,     2,     3,     0,
+       4,     5,     6,     0,     7,     0,    34,     0,     0,    37,
+       8,     9,    40,     4,     5,     6,     0,     7,     4,     5,
+       6,     0,     7,     0,     9,    24,     0,     0,     0,     9,
+      17,    18,    19,    20,     0,    21,     0,     0,    32,    33,
+      17,    18,    19,    20,     0,    21,     0,     0,    35,    36,
+      17,    18,    19,    20,     0,    21,     0,     0,    38,    39,
+      17,    18,    19,    20,     0,    21,     0,     0,    26,    17,
+      18,    19,    20,     0,    21,     0,     0,    41,    17,    18,
+      19,    20,     0,    21,    22,    17,    18,    19,    20,     0,
+      21,    19,    20,     0,    21
+};
+
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-13)))
+
+#define yytable_value_is_error(Yytable_value) \
+  YYID (0)
+
+static const yytype_int8 yycheck[] =
+{
+       7,    13,     9,     6,    14,    -1,    13,    14,    12,    -1,
+      17,    18,    19,    20,    21,    -1,    -1,     0,     1,    -1,
+       3,     4,     5,    -1,     7,    -1,    33,    -1,    -1,    36,
+      13,    14,    39,     3,     4,     5,    -1,     7,     3,     4,
+       5,    -1,     7,    -1,    14,    15,    -1,    -1,    -1,    14,
+       7,     8,     9,    10,    -1,    12,    -1,    -1,    15,    16,
+       7,     8,     9,    10,    -1,    12,    -1,    -1,    15,    16,
+       7,     8,     9,    10,    -1,    12,    -1,    -1,    15,    16,
+       7,     8,     9,    10,    -1,    12,    -1,    -1,    15,     7,
+       8,     9,    10,    -1,    12,    -1,    -1,    15,     7,     8,
+       9,    10,    -1,    12,    13,     7,     8,     9,    10,    -1,
+      12,     9,    10,    -1,    12
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
+static const yytype_uint8 yystos[] =
+{
+       0,    18,     0,     1,     3,     4,     5,     7,    13,    14,
+      19,    20,    13,     6,    14,    20,    20,     7,     8,     9,
+      10,    12,    13,    20,    15,    20,    15,    20,    20,    20,
+      20,    20,    15,    16,    20,    15,    16,    20,    15,    16,
+      20,    15
+};
+
+#define yyerrok		(yyerrstatus = 0)
+#define yyclearin	(yychar = YYEMPTY)
+#define YYEMPTY		(-2)
+#define YYEOF		0
+
+#define YYACCEPT	goto yyacceptlab
+#define YYABORT		goto yyabortlab
+#define YYERROR		goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror.  This remains here temporarily
+   to ease the transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  However,
+   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
+   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+   discussed.  */
+
+#define YYFAIL		goto yyerrlab
+#if defined YYFAIL
+  /* This is here to suppress warnings from the GCC cpp's
+     -Wunused-macros.  Normally we don't worry about that warning, but
+     some users do, and we want to make it easy for users to remove
+     YYFAIL uses, which will produce warnings from Bison 2.5.  */
+#endif
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)                                  \
+do                                                              \
+  if (yychar == YYEMPTY)                                        \
+    {                                                           \
+      yychar = (Token);                                         \
+      yylval = (Value);                                         \
+      YYPOPSTACK (yylen);                                       \
+      yystate = *yyssp;                                         \
+      goto yybackup;                                            \
+    }                                                           \
+  else                                                          \
+    {                                                           \
+      yyerror (YY_("syntax error: cannot back up")); \
+      YYERROR;							\
+    }								\
+while (YYID (0))
+
+/* Error token number */
+#define YYTERROR	1
+#define YYERRCODE	256
+
+
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments.  */
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)			\
+do {						\
+  if (yydebug)					\
+    YYFPRINTF Args;				\
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
+do {									  \
+  if (yydebug)								  \
+    {									  \
+      YYFPRINTF (stderr, "%s ", Title);					  \
+      yy_symbol_print (stderr,						  \
+		  Type, Value); \
+      YYFPRINTF (stderr, "\n");						  \
+    }									  \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+#endif
+{
+  FILE *yyo = yyoutput;
+  YYUSE (yyo);
+  if (!yyvaluep)
+    return;
+# ifdef YYPRINT
+  if (yytype < YYNTOKENS)
+    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+  YYUSE (yyoutput);
+# endif
+  switch (yytype)
+    {
+      default:
+        break;
+    }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+#endif
+{
+  if (yytype < YYNTOKENS)
+    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+  else
+    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+  YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+#else
+static void
+yy_stack_print (yybottom, yytop)
+    yytype_int16 *yybottom;
+    yytype_int16 *yytop;
+#endif
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)				\
+do {								\
+  if (yydebug)							\
+    yy_stack_print ((Bottom), (Top));				\
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+    YYSTYPE *yyvsp;
+    int yyrule;
+#endif
+{
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  unsigned long int yylno = yyrline[yyrule];
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+	     yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+		       &(yyvsp[(yyi + 1) - (yynrhs)])
+		       		       );
+      YYFPRINTF (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)		\
+do {					\
+  if (yydebug)				\
+    yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks.  */
+#ifndef	YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+   if the built-in stack extension method is used).
+
+   Do not make this value too large; the results are undefined if
+   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+   evaluated with infinite-precision integer arithmetic.  */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+#  if defined __GLIBC__ && defined _STRING_H
+#   define yystrlen strlen
+#  else
+/* Return the length of YYSTR.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+    const char *yystr;
+#endif
+{
+  YYSIZE_T yylen;
+  for (yylen = 0; yystr[yylen]; yylen++)
+    continue;
+  return yylen;
+}
+#  endif
+# endif
+
+# ifndef yystpcpy
+#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+#   define yystpcpy stpcpy
+#  else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+   YYDEST.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+    char *yydest;
+    const char *yysrc;
+#endif
+{
+  char *yyd = yydest;
+  const char *yys = yysrc;
+
+  while ((*yyd++ = *yys++) != '\0')
+    continue;
+
+  return yyd - 1;
+}
+#  endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+   quotes and backslashes, so that it's suitable for yyerror.  The
+   heuristic is that double-quoting is unnecessary unless the string
+   contains an apostrophe, a comma, or backslash (other than
+   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
+   null, do not copy; instead, return the length of what the result
+   would have been.  */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+  if (*yystr == '"')
+    {
+      YYSIZE_T yyn = 0;
+      char const *yyp = yystr;
+
+      for (;;)
+	switch (*++yyp)
+	  {
+	  case '\'':
+	  case ',':
+	    goto do_not_strip_quotes;
+
+	  case '\\':
+	    if (*++yyp != '\\')
+	      goto do_not_strip_quotes;
+	    /* Fall through.  */
+	  default:
+	    if (yyres)
+	      yyres[yyn] = *yyp;
+	    yyn++;
+	    break;
+
+	  case '"':
+	    if (yyres)
+	      yyres[yyn] = '\0';
+	    return yyn;
+	  }
+    do_not_strip_quotes: ;
+    }
+
+  if (! yyres)
+    return yystrlen (yystr);
+
+  return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
+   about the unexpected token YYTOKEN for the state stack whose top is
+   YYSSP.
+
+   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
+   not large enough to hold the message.  In that case, also set
+   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
+   required number of bytes is too large to store.  */
+static int
+yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
+                yytype_int16 *yyssp, int yytoken)
+{
+  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+  YYSIZE_T yysize = yysize0;
+  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+  /* Internationalized format string. */
+  const char *yyformat = YY_NULL;
+  /* Arguments of yyformat. */
+  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+  /* Number of reported tokens (one for the "unexpected", one per
+     "expected"). */
+  int yycount = 0;
+
+  /* There are many possibilities here to consider:
+     - Assume YYFAIL is not used.  It's too flawed to consider.  See
+       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+       for details.  YYERROR is fine as it does not invoke this
+       function.
+     - If this state is a consistent state with a default action, then
+       the only way this function was invoked is if the default action
+       is an error action.  In that case, don't check for expected
+       tokens because there are none.
+     - The only way there can be no lookahead present (in yychar) is if
+       this state is a consistent state with a default action.  Thus,
+       detecting the absence of a lookahead is sufficient to determine
+       that there is no unexpected or expected token to report.  In that
+       case, just report a simple "syntax error".
+     - Don't assume there isn't a lookahead just because this state is a
+       consistent state with a default action.  There might have been a
+       previous inconsistent state, consistent state with a non-default
+       action, or user semantic action that manipulated yychar.
+     - Of course, the expected token list depends on states to have
+       correct lookahead information, and it depends on the parser not
+       to perform extra reductions after fetching a lookahead from the
+       scanner and before detecting a syntax error.  Thus, state merging
+       (from LALR or IELR) and default reductions corrupt the expected
+       token list.  However, the list is correct for canonical LR with
+       one exception: it will still contain any token that will not be
+       accepted due to an error action in a later state.
+  */
+  if (yytoken != YYEMPTY)
+    {
+      int yyn = yypact[*yyssp];
+      yyarg[yycount++] = yytname[yytoken];
+      if (!yypact_value_is_default (yyn))
+        {
+          /* Start YYX at -YYN if negative to avoid negative indexes in
+             YYCHECK.  In other words, skip the first -YYN actions for
+             this state because they are default actions.  */
+          int yyxbegin = yyn < 0 ? -yyn : 0;
+          /* Stay within bounds of both yycheck and yytname.  */
+          int yychecklim = YYLAST - yyn + 1;
+          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+          int yyx;
+
+          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+                && !yytable_value_is_error (yytable[yyx + yyn]))
+              {
+                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+                  {
+                    yycount = 1;
+                    yysize = yysize0;
+                    break;
+                  }
+                yyarg[yycount++] = yytname[yyx];
+                {
+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+                  if (! (yysize <= yysize1
+                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                    return 2;
+                  yysize = yysize1;
+                }
+              }
+        }
+    }
+
+  switch (yycount)
+    {
+# define YYCASE_(N, S)                      \
+      case N:                               \
+        yyformat = S;                       \
+      break
+      YYCASE_(0, YY_("syntax error"));
+      YYCASE_(1, YY_("syntax error, unexpected %s"));
+      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or \
%s")); +# undef YYCASE_
+    }
+
+  {
+    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+      return 2;
+    yysize = yysize1;
+  }
+
+  if (*yymsg_alloc < yysize)
+    {
+      *yymsg_alloc = 2 * yysize;
+      if (! (yysize <= *yymsg_alloc
+             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+      return 1;
+    }
+
+  /* Avoid sprintf, as that infringes on the user's name space.
+     Don't have undefined behavior even if the translation
+     produced a string with the wrong number of "%s"s.  */
+  {
+    char *yyp = *yymsg;
+    int yyi = 0;
+    while ((*yyp = *yyformat) != '\0')
+      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+        {
+          yyp += yytnamerr (yyp, yyarg[yyi++]);
+          yyformat += 2;
+        }
+      else
+        {
+          yyp++;
+          yyformat++;
+        }
+  }
+  return 0;
+}
+#endif /* YYERROR_VERBOSE */
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+    const char *yymsg;
+    int yytype;
+    YYSTYPE *yyvaluep;
+#endif
+{
+  YYUSE (yyvaluep);
+
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+  switch (yytype)
+    {
+
+      default:
+        break;
+    }
+}
+
+
+
+
+/* The lookahead symbol.  */
+int yychar;
+
+
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+
+/* Number of syntax errors so far.  */
+int yynerrs;
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+    void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
+
+    /* The stacks and their tools:
+       `yyss': related to states.
+       `yyvs': related to semantic values.
+
+       Refer to the stacks through separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
+
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
+
+    YYSIZE_T yystacksize;
+
+  int yyn;
+  int yyresult;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken = 0;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
+
+  /* The number of symbols on the RHS of the reduced rule.
+     Keep to zero when no symbol should be popped.  */
+  int yylen = 0;
+
+  yyssp = yyss = yyssa;
+  yyvsp = yyvs = yyvsa;
+  yystacksize = YYINITDEPTH;
+
+  YYDPRINTF ((stderr, "Starting parse\n"));
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY; /* Cause a token to be read.  */
+  goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate.  |
+`------------------------------------------------------------*/
+ yynewstate:
+  /* In all cases, when you get here, the value and location stacks
+     have just been pushed.  So pushing a state here evens the stacks.  */
+  yyssp++;
+
+ yysetstate:
+  *yyssp = yystate;
+
+  if (yyss + yystacksize - 1 <= yyssp)
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      {
+	/* Give user a chance to reallocate the stack.  Use copies of
+	   these so that the &'s don't force the real ones into
+	   memory.  */
+	YYSTYPE *yyvs1 = yyvs;
+	yytype_int16 *yyss1 = yyss;
+
+	/* Each stack pointer address is followed by the size of the
+	   data in use in that stack, in bytes.  This used to be a
+	   conditional around just the two extra args, but that might
+	   be undefined if yyoverflow is a macro.  */
+	yyoverflow (YY_("memory exhausted"),
+		    &yyss1, yysize * sizeof (*yyssp),
+		    &yyvs1, yysize * sizeof (*yyvsp),
+		    &yystacksize);
+
+	yyss = yyss1;
+	yyvs = yyvs1;
+      }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+      goto yyexhaustedlab;
+# else
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+	goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+	yystacksize = YYMAXDEPTH;
+
+      {
+	yytype_int16 *yyss1 = yyss;
+	union yyalloc *yyptr =
+	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+	if (! yyptr)
+	  goto yyexhaustedlab;
+	YYSTACK_RELOCATE (yyss_alloc, yyss);
+	YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+#  undef YYSTACK_RELOCATE
+	if (yyss1 != yyssa)
+	  YYSTACK_FREE (yyss1);
+      }
+# endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+		  (unsigned long int) yystacksize));
+
+      if (yyss + yystacksize - 1 <= yyssp)
+	YYABORT;
+    }
+
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
+  goto yybackup;
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+  yyn = yypact[yystate];
+  if (yypact_value_is_default (yyn))
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token: "));
+      yychar = YYLEX;
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = yytoken = YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else
+    {
+      yytoken = YYTRANSLATE (yychar);
+      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+    }
+
+  /* If the proper action on seeing token YYTOKEN is to reduce or to
+     detect an error, take that action.  */
+  yyn += yytoken;
+  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+    goto yydefault;
+  yyn = yytable[yyn];
+  if (yyn <= 0)
+    {
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the lookahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
+
+  yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+  goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
+yydefault:
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction.  |
+`-----------------------------*/
+yyreduce:
+  /* yyn is the number of a rule to reduce with.  */
+  yylen = yyr2[yyn];
+
+  /* If YYLEN is nonzero, implement the default value of the action:
+     `$$ = $1'.
+
+     Otherwise, the following line sets YYVAL to garbage.
+     This behavior is undocumented and Bison
+     users should not rely upon it.  Assigning to YYVAL
+     unconditionally makes the parser a bit smaller, and it avoids a
+     GCC warning that YYVAL may be used uninitialized.  */
+  yyval = yyvsp[1-yylen];
+
+
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
+    {
+        case 5:
+/* Line 1792 of yacc.c  */
+#line 28 "parser.y"
+    { res=(yyvsp[(1) - (2)].dval); }
+    break;
+
+  case 6:
+/* Line 1792 of yacc.c  */
+#line 29 "parser.y"
+    { yyerrok; }
+    break;
+
+  case 7:
+/* Line 1792 of yacc.c  */
+#line 32 "parser.y"
+    { (yyval.dval) = (yyvsp[(1) - (1)].dval);                         }
+    break;
+
+  case 8:
+/* Line 1792 of yacc.c  */
+#line 33 "parser.y"
+    { (yyval.dval) = (yyvsp[(1) - (1)].tptr)->value.var;              }
+    break;
+
+  case 9:
+/* Line 1792 of yacc.c  */
+#line 34 "parser.y"
+    { (yyval.dval) = (yyvsp[(3) - (3)].dval); (yyvsp[(1) - (3)].tptr)->value.var = \
(yyvsp[(3) - (3)].dval);     } +    break;
+
+  case 10:
+/* Line 1792 of yacc.c  */
+#line 35 "parser.y"
+    { (yyval.dval) = (*((yyvsp[(1) - (3)].tptr)->value.fnctptr))();   }
+    break;
+
+  case 11:
+/* Line 1792 of yacc.c  */
+#line 36 "parser.y"
+    { (yyval.dval) = (*((yyvsp[(1) - (4)].tptr)->value.fnctptr))((yyvsp[(3) - \
(4)].dval)); } +    break;
+
+  case 12:
+/* Line 1792 of yacc.c  */
+#line 37 "parser.y"
+    { (yyval.dval) = (*((yyvsp[(1) - (6)].tptr)->value.fnctptr))((yyvsp[(3) - \
(6)].dval),(yyvsp[(5) - (6)].dval)); } +    break;
+
+  case 13:
+/* Line 1792 of yacc.c  */
+#line 38 "parser.y"
+    { (yyval.dval) = (*((yyvsp[(1) - (8)].tptr)->value.fnctptr))((yyvsp[(3) - \
(8)].dval),(yyvsp[(5) - (8)].dval),(yyvsp[(7) - (8)].dval)); } +    break;
+
+  case 14:
+/* Line 1792 of yacc.c  */
+#line 39 "parser.y"
+    { (yyval.dval) = (*((yyvsp[(1) - (10)].tptr)->value.fnctptr))((yyvsp[(3) - \
(10)].dval),(yyvsp[(5) - (10)].dval),(yyvsp[(7) - (10)].dval),(yyvsp[(9) - \
(10)].dval)); } +    break;
+
+  case 15:
+/* Line 1792 of yacc.c  */
+#line 40 "parser.y"
+    { (yyval.dval) = (yyvsp[(1) - (3)].dval) + (yyvsp[(3) - (3)].dval);              \
} +    break;
+
+  case 16:
+/* Line 1792 of yacc.c  */
+#line 41 "parser.y"
+    { (yyval.dval) = (yyvsp[(1) - (3)].dval) - (yyvsp[(3) - (3)].dval);              \
} +    break;
+
+  case 17:
+/* Line 1792 of yacc.c  */
+#line 42 "parser.y"
+    { (yyval.dval) = (yyvsp[(1) - (3)].dval) * (yyvsp[(3) - (3)].dval);              \
} +    break;
+
+  case 18:
+/* Line 1792 of yacc.c  */
+#line 43 "parser.y"
+    { (yyval.dval) = (yyvsp[(1) - (3)].dval) / (yyvsp[(3) - (3)].dval);              \
} +    break;
+
+  case 19:
+/* Line 1792 of yacc.c  */
+#line 44 "parser.y"
+    { (yyval.dval) = -(yyvsp[(2) - (2)].dval);                        }
+    break;
+
+  case 20:
+/* Line 1792 of yacc.c  */
+#line 45 "parser.y"
+    { (yyval.dval) = pow ((yyvsp[(1) - (3)].dval), (yyvsp[(3) - (3)].dval));         \
} +    break;
+
+  case 21:
+/* Line 1792 of yacc.c  */
+#line 46 "parser.y"
+    { (yyval.dval) = (yyvsp[(2) - (3)].dval);                         }
+    break;
+
+
+/* Line 1792 of yacc.c  */
+#line 1482 "parser.tab.c"
+      default: break;
+    }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+
+  *++yyvsp = yyval;
+
+  /* Now `shift' the result of the reduction.  Determine what state
+     that goes to, based on the state we popped back to and the rule
+     number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTOKENS];
+
+  goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+#if ! YYERROR_VERBOSE
+      yyerror (YY_("syntax error"));
+#else
+# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
+                                        yyssp, yytoken)
+      {
+        char const *yymsgp = YY_("syntax error");
+        int yysyntax_error_status;
+        yysyntax_error_status = YYSYNTAX_ERROR;
+        if (yysyntax_error_status == 0)
+          yymsgp = yymsg;
+        else if (yysyntax_error_status == 1)
+          {
+            if (yymsg != yymsgbuf)
+              YYSTACK_FREE (yymsg);
+            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+            if (!yymsg)
+              {
+                yymsg = yymsgbuf;
+                yymsg_alloc = sizeof yymsgbuf;
+                yysyntax_error_status = 2;
+              }
+            else
+              {
+                yysyntax_error_status = YYSYNTAX_ERROR;
+                yymsgp = yymsg;
+              }
+          }
+        yyerror (yymsgp);
+        if (yysyntax_error_status == 2)
+          goto yyexhaustedlab;
+      }
+# undef YYSYNTAX_ERROR
+#endif
+    }
+
+
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead token after an
+	 error, discard it.  */
+
+      if (yychar <= YYEOF)
+	{
+	  /* Return failure if at end of input.  */
+	  if (yychar == YYEOF)
+	    YYABORT;
+	}
+      else
+	{
+	  yydestruct ("Error: discarding",
+		      yytoken, &yylval);
+	  yychar = YYEMPTY;
+	}
+    }
+
+  /* Else will try to reuse lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+
+  /* Pacify compilers like GCC when the user code never invokes
+     YYERROR and the label yyerrorlab therefore never appears in user
+     code.  */
+  if (/*CONSTCOND*/ 0)
+     goto yyerrorlab;
+
+  /* Do not reclaim the symbols of the rule which action triggered
+     this YYERROR.  */
+  YYPOPSTACK (yylen);
+  yylen = 0;
+  YY_STACK_PRINT (yyss, yyssp);
+  yystate = *yyssp;
+  goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR.  |
+`-------------------------------------------------------------*/
+yyerrlab1:
+  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
+
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
+	{
+	  yyn += YYTERROR;
+	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+	    {
+	      yyn = yytable[yyn];
+	      if (0 < yyn)
+		break;
+	    }
+	}
+
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+	YYABORT;
+
+
+      yydestruct ("Error: popping",
+		  yystos[yystate], yyvsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+  yystate = yyn;
+  goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
+yyacceptlab:
+  yyresult = 0;
+  goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
+yyabortlab:
+  yyresult = 1;
+  goto yyreturn;
+
+#if !defined yyoverflow || YYERROR_VERBOSE
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  /* Fall through.  */
+#endif
+
+yyreturn:
+  if (yychar != YYEMPTY)
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
+    }
+  /* Do not reclaim the symbols of the rule which action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+		  yystos[*yyssp], yyvsp);
+      YYPOPSTACK (1);
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+  if (yymsg != yymsgbuf)
+    YYSTACK_FREE (yymsg);
+#endif
+  /* Make sure YYID is used.  */
+  return YYID (yyresult);
+}
+
+
+/* Line 2055 of yacc.c  */
+#line 49 "parser.y"
+
+
+/* The symbol table: a chain of `struct symrec'.  */
+symrec *sym_table = (symrec *) 0;
+
+/* debugging flag */
+/* #define LDEBUG */
+
+double parse(char *str) {
+#ifdef LDEBUG
+	printf("parse(%s)\n",str);
+#endif
+	pos=0;
+
+	/* reset string, because it's global !	*/
+	bzero(string, PARSE_STRING_SIZE);
+
+	/* leave space to terminate string by "\n\0" */
+	strncpy(string, str, PARSE_STRING_SIZE - 2);
+	string[strlen(string)] = '\n';
+
+	/* be sure that the symbol table has been initialized */
+
+	if (!sym_table)
+	   init_table();
+
+#ifdef LDEBUG
+	printf("calling yyparse()\n");
+#endif
+	yyparse();
+#ifdef LDEBUG
+	printf("After calling yyparse()\n");
+#endif
+
+#ifdef LDEBUG
+	printf("parse() DONE\n");
+#endif
+	return res;
+}
+
+int parse_errors() {
+	return yynerrs;
+}
+
+int yyerror (const char *s){
+	printf ("ERROR : %s\n", s);
+	return 0;
+}
+
+/* put arithmetic functions in table. */
+void init_table (void) {
+#ifdef LDEBUG
+	printf("init_table()\n");
+#endif
+	symrec *ptr;
+	int i;
+	/* add functions */
+	for (i = 0; arith_fncts[i].fname != 0; i++) {
+		ptr = putsym (arith_fncts[i].fname, FNCT);
+		ptr->value.fnctptr = arith_fncts[i].fnct;
+	}
+	/* add constants */
+	for (i = 0; constants[i].name != 0; i++) {
+		ptr = putsym (constants[i].name, VAR);
+		ptr->value.var = constants[i].value;
+	}
+#ifdef LDEBUG
+	printf("init_table() DONE\n");
+#endif
+}
+
+void delete_table(void) {
+	while(sym_table) {
+		symrec *tmp = sym_table;
+		sym_table = sym_table->next;
+		free(tmp->name);
+		free(tmp);
+	}
+}
+
+symrec* putsym (const char *sym_name, int sym_type) {
+#ifdef LDEBUG
+	printf("putsym() : sym_name = %s\n",sym_name);
+#endif
+	symrec *ptr;
+	ptr = (symrec *) malloc (sizeof (symrec));
+	ptr->name = (char *) malloc (strlen (sym_name) + 1);
+	strcpy (ptr->name,sym_name);
+	ptr->type = sym_type;
+	ptr->value.var = 0; /* set value to 0 even if fctn.  */
+	ptr->next = (struct symrec *)sym_table;
+	sym_table = ptr;
+#ifdef LDEBUG
+	printf("putsym() DONE\n");
+#endif
+	return ptr;
+}
+
+symrec* getsym (const char *sym_name) {
+#ifdef LDEBUG
+	printf("getsym() : sym_name = %s\n",sym_name);
+#endif
+	symrec *ptr;
+	for (ptr = sym_table; ptr != (symrec *) 0;
+			ptr = (symrec *)ptr->next)
+		if (strcmp (ptr->name,sym_name) == 0)
+			return ptr;
+	return 0;
+}
+
+symrec* assign_variable(const char* symb_name, double value) {
+	symrec* ptr;
+	ptr = getsym(symb_name);
+	if (!ptr)
+	ptr = putsym(symb_name,VAR);
+	ptr->value.var=value;
+	return ptr;
+};
+
+static int getcharstr(void) {
+#ifdef LDEBUG
+	printf("getcharstr()\n");
+#endif
+	if ('\0' == string[pos])
+		return EOF;
+	return (int) string[pos++];
+}
+
+static void ungetcstr(void) {
+    if (pos > 0)
+        pos--;
+}
+
+int yylex (void) {
+#ifdef LDEBUG
+	printf("yylex()\n");
+#endif
+	int c;
+
+	/* skip white space  */
+	while ((c = getcharstr ()) == ' ' || c == '\t');
+
+#ifdef LDEBUG
+	printf("c=%c\n",c);
+#endif
+	/* return end-of-file  */
+	if (c == EOF) {
+		return 0;
+	}
+	/* process numbers   */
+	/* TODO : catch single '.' as error "1+." */
+	if (c == '.' || isdigit (c)) {
+#ifdef LDEBUG
+		printf("is digit or .\n");
+#endif
+		char *tmp, *tmp2;
+                double result;
+                ungetcstr();
+                tmp = &string[pos];
+#ifdef LDEBUG
+		printf("tmp = %s\n",tmp);
+#endif
+                result = strtod(tmp,&tmp2);
+		/* check conversion */
+		if(strlen(tmp) == strlen(tmp2))
+			return 0;
+#ifdef LDEBUG
+		printf("result = %g\n",result);
+#endif
+                sscanf (tmp,"%lf", &(yylval.dval));
+                pos+= strlen(tmp)-strlen(tmp2);
+
+		return NUM;
+	}
+
+	/* Char starts an identifier => read the name. */
+	if (isalpha (c)) {
+#ifdef LDEBUG
+		printf("is alpha\n");
+#endif
+		symrec *s;
+		static char *symbuf = 0;
+		static int length = 0;
+		int i;
+
+		/* Initially make the buffer long enough
+		   for a 20-character symbol name.  */
+		if (length == 0)
+			length = 20, symbuf = (char *)malloc (length + 1);
+
+		i = 0;
+		do {
+			/* If buffer is full, make it bigger.        */
+			if (i == length) {
+				length *= 2;
+				symbuf = (char *)realloc (symbuf, length + 1);
+			}
+			/* Add this character to the buffer.         */
+			symbuf[i++] = c;
+			/* Get another character.                    */
+			c = getcharstr ();
+		}
+		while (c != EOF && (isalnum (c) || c == '_'));
+
+		ungetcstr ();
+		symbuf[i] = '\0';
+
+		s = getsym (symbuf);
+		/* symbol unknown */
+		if(s == 0)
+			return 0;
+		/* old behavior */
+		/* if (s == 0)
+			 s = putsym (symbuf, VAR);
+		*/
+		yylval.tptr = s;
+		return s->type;
+	}
+
+
+	/* return single chars */
+	return c;
+}
diff --git a/src/backend/gsl/parser.y b/src/backend/gsl/parser.y
new file mode 120000
index 0000000..b5d4f2d
--- /dev/null
+++ b/src/backend/gsl/parser.y
@@ -0,0 +1 @@
+parser.y.linux
\ No newline at end of file
diff --git a/src/backend/gsl/parser.y.linux b/src/backend/gsl/parser.y.linux
new file mode 100644
index 0000000..b40a36e
--- /dev/null
+++ b/src/backend/gsl/parser.y.linux
@@ -0,0 +1,271 @@
+/* LabPlot : parser.y	*/
+
+%{
+#include "parser.h"
+%}
+
+%union {
+double dval;  /* For returning numbers.                   */
+symrec *tptr;   /* For returning symbol-table pointers      */
+}
+
+%token <dval>  NUM 	/* Simple double precision number   */
+%token <tptr> VAR FNCT	/* Variable and Function            */
+%type  <dval>  expr
+
+%right '='
+%left '-' '+'
+%left '*' '/'
+%left NEG     /* Negation--unary minus */
+%right '^'    /* Exponential        */
+
+%%
+input:   /* empty */
+	| input line
+;
+
+line:	'\n'
+	| expr '\n'   { res=$1; }
+	| error '\n' { yyerrok; }
+;
+
+expr:      NUM       { $$ = $1;                         }
+| VAR                { $$ = $1->value.var;              }
+| VAR '=' expr       { $$ = $3; $1->value.var = $3;     }
+| FNCT '(' ')'       { $$ = (*($1->value.fnctptr))();   }
+| FNCT '(' expr ')'  { $$ = (*($1->value.fnctptr))($3); }
+| FNCT '(' expr ',' expr ')'  { $$ = (*($1->value.fnctptr))($3,$5); }
+| FNCT '(' expr ',' expr ','expr ')'  { $$ = (*($1->value.fnctptr))($3,$5,$7); }
+| FNCT '(' expr ',' expr ',' expr ','expr ')'  { $$ = \
(*($1->value.fnctptr))($3,$5,$7,$9); } +| expr '+' expr      { $$ = $1 + $3;          \
} +| expr '-' expr      { $$ = $1 - $3;                    }
+| expr '*' expr      { $$ = $1 * $3;                    }
+| expr '/' expr      { $$ = $1 / $3;                    }
+| '-' expr  %prec NEG{ $$ = -$2;                        }
+| expr '^' expr      { $$ = pow ($1, $3);               }
+| '(' expr ')'       { $$ = $2;                         }
+;
+
+%%
+
+/* The symbol table: a chain of `struct symrec'.  */
+symrec *sym_table = (symrec *) 0;
+
+/* debugging flag */
+/* #define LDEBUG */
+
+double parse(char *str) {
+#ifdef LDEBUG
+	printf("parse(%s)\n",str);
+#endif
+	pos=0;
+
+	/* reset string, because it's global !	*/
+	bzero(string, PARSE_STRING_SIZE);
+
+	/* leave space to terminate string by "\n\0" */
+	strncpy(string, str, PARSE_STRING_SIZE - 2);
+	string[strlen(string)] = '\n';
+
+	/* be sure that the symbol table has been initialized */
+
+	if (!sym_table)
+	   init_table();
+
+#ifdef LDEBUG
+	printf("calling yyparse()\n");
+#endif
+	yyparse();
+#ifdef LDEBUG
+	printf("After calling yyparse()\n");
+#endif
+
+#ifdef LDEBUG
+	printf("parse() DONE\n");
+#endif
+	return res;
+}
+
+int parse_errors() {
+	return yynerrs;
+}
+
+int yyerror (const char *s){
+	printf ("ERROR : %s\n", s);
+	return 0;
+}
+
+/* put arithmetic functions in table. */
+void init_table (void) {
+#ifdef LDEBUG
+	printf("init_table()\n");
+#endif
+	symrec *ptr;
+	int i;
+	/* add functions */
+	for (i = 0; arith_fncts[i].fname != 0; i++) {
+		ptr = putsym (arith_fncts[i].fname, FNCT);
+		ptr->value.fnctptr = arith_fncts[i].fnct;
+	}
+	/* add constants */
+	for (i = 0; constants[i].name != 0; i++) {
+		ptr = putsym (constants[i].name, VAR);
+		ptr->value.var = constants[i].value;
+	}
+#ifdef LDEBUG
+	printf("init_table() DONE\n");
+#endif
+}
+
+void delete_table(void) {
+	while(sym_table) {
+		symrec *tmp = sym_table;
+		sym_table = sym_table->next;
+		free(tmp->name);
+		free(tmp);
+	}
+}
+
+symrec* putsym (const char *sym_name, int sym_type) {
+#ifdef LDEBUG
+	printf("putsym() : sym_name = %s\n",sym_name);
+#endif
+	symrec *ptr;
+	ptr = (symrec *) malloc (sizeof (symrec));
+	ptr->name = (char *) malloc (strlen (sym_name) + 1);
+	strcpy (ptr->name,sym_name);
+	ptr->type = sym_type;
+	ptr->value.var = 0; /* set value to 0 even if fctn.  */
+	ptr->next = (struct symrec *)sym_table;
+	sym_table = ptr;
+#ifdef LDEBUG
+	printf("putsym() DONE\n");
+#endif
+	return ptr;
+}
+
+symrec* getsym (const char *sym_name) {
+#ifdef LDEBUG
+	printf("getsym() : sym_name = %s\n",sym_name);
+#endif
+	symrec *ptr;
+	for (ptr = sym_table; ptr != (symrec *) 0;
+			ptr = (symrec *)ptr->next)
+		if (strcmp (ptr->name,sym_name) == 0)
+			return ptr;
+	return 0;
+}
+
+symrec* assign_variable(const char* symb_name, double value) {
+	symrec* ptr;
+	ptr = getsym(symb_name);
+	if (!ptr)
+	ptr = putsym(symb_name,VAR);
+	ptr->value.var=value;
+	return ptr;
+};
+
+static int getcharstr(void) {
+#ifdef LDEBUG
+	printf("getcharstr()\n");
+#endif
+	if ('\0' == string[pos])
+		return EOF;
+	return (int) string[pos++];
+}
+
+static void ungetcstr(void) {
+    if (pos > 0)
+        pos--;
+}
+
+int yylex (void) {
+#ifdef LDEBUG
+	printf("yylex()\n");
+#endif
+	int c;
+
+	/* skip white space  */
+	while ((c = getcharstr ()) == ' ' || c == '\t');
+
+#ifdef LDEBUG
+	printf("c=%c\n",c);
+#endif
+	/* return end-of-file  */
+	if (c == EOF) {
+		return 0;
+	}
+	/* process numbers   */
+	/* TODO : catch single '.' as error "1+." */
+	if (c == '.' || isdigit (c)) {
+#ifdef LDEBUG
+		printf("is digit or .\n");
+#endif
+		char *tmp, *tmp2;
+                double result;
+                ungetcstr();
+                tmp = &string[pos];
+#ifdef LDEBUG
+		printf("tmp = %s\n",tmp);
+#endif
+                result = strtod(tmp,&tmp2);
+		/* check conversion */
+		if(strlen(tmp) == strlen(tmp2))
+			return 0;
+#ifdef LDEBUG
+		printf("result = %g\n",result);
+#endif
+                sscanf (tmp,"%lf", &(yylval.dval));
+                pos+= strlen(tmp)-strlen(tmp2);
+
+		return NUM;
+	}
+
+	/* Char starts an identifier => read the name. */
+	if (isalpha (c)) {
+#ifdef LDEBUG
+		printf("is alpha\n");
+#endif
+		symrec *s;
+		static char *symbuf = 0;
+		static int length = 0;
+		int i;
+
+		/* Initially make the buffer long enough
+		   for a 20-character symbol name.  */
+		if (length == 0)
+			length = 20, symbuf = (char *)malloc (length + 1);
+
+		i = 0;
+		do {
+			/* If buffer is full, make it bigger.        */
+			if (i == length) {
+				length *= 2;
+				symbuf = (char *)realloc (symbuf, length + 1);
+			}
+			/* Add this character to the buffer.         */
+			symbuf[i++] = c;
+			/* Get another character.                    */
+			c = getcharstr ();
+		}
+		while (c != EOF && (isalnum (c) || c == '_'));
+
+		ungetcstr ();
+		symbuf[i] = '\0';
+
+		s = getsym (symbuf);
+		/* symbol unknown */
+		if(s == 0)
+			return 0;
+		/* old behavior */
+		/* if (s == 0)
+			 s = putsym (symbuf, VAR);
+		*/
+		yylval.tptr = s;
+		return s->type;
+	}
+
+
+	/* return single chars */
+	return c;
+}
diff --git a/src/backend/gsl/parser.y.solaris b/src/backend/gsl/parser.y.solaris
new file mode 100644
index 0000000..e259ca8
--- /dev/null
+++ b/src/backend/gsl/parser.y.solaris
@@ -0,0 +1,245 @@
+/* LabPlot : parser.y	*/
+
+%{
+#include "parser.h"
+%}
+
+%union {
+double dval;  /* For returning numbers.                   */
+symrec *tptr;   /* For returning symbol-table pointers      */
+}
+
+%token <dval>  NUM 	/* Simple double precision number   */
+%token <tptr> VAR FNCT	/* Variable and Function            */
+%type  <dval>  expr
+
+%right '='
+%left '-' '+'
+%left '*' '/'
+%left NEG     /* Negation--unary minus */
+%right '^'    /* Exponential        */
+
+%%
+input:   /* empty */
+	| input line
+;
+
+line:	'\n'
+	| expr '\n'   { res=$1; }
+	| error '\n' { yyerrok; }
+;
+
+expr:      NUM       { $$ = $1;                         }
+| VAR                { $$ = $1->value.var;              }
+| VAR '=' expr       { $$ = $3; $1->value.var = $3;     }
+| FNCT '(' expr ')'  { $$ = (*($1->value.fnctptr))($3); }
+| expr '+' expr      { $$ = $1 + $3;                    }
+| expr '-' expr      { $$ = $1 - $3;                    }
+| expr '*' expr      { $$ = $1 * $3;                    }
+| expr '/' expr      { $$ = $1 / $3;                    }
+| '-' expr  %prec NEG{ $$ = -$2;                        }
+| expr '^' expr      { $$ = pow ($1, $3);               }
+| '(' expr ')'       { $$ = $2;                         }
+;
+
+%%
+
+/* The symbol table: a chain of `struct symrec'.  */
+symrec *sym_table = (symrec *) 0;
+
+/* debugging flag */
+/* #define LDEBUG */
+
+double parse(char *str) {
+#ifdef LDEBUG
+	printf("parse(%s)\n",str);
+#endif
+	pos=0;
+
+	/* reset string, because it's global !	*/
+	bzero(string, PARSE_STRING_SIZE);
+
+	/* leave space to terminate string by "\n\0" */
+	strncpy(string, str, PARSE_STRING_SIZE - 2);
+	string[strlen(string)] = '\n';
+
+	/* be sure that the symbol table has been initialized */
+
+	if (!sym_table)
+	   init_table();
+	yyparse();
+
+	return res;
+}
+
+int parse_errors() {
+	return yynerrs;
+}
+
+int yyerror (const char *s){
+	printf ("ERROR : %s\n", s);
+	return 0;
+}
+
+/* put arithmetic functions in table. */
+void init_table (void) {
+#ifdef LDEBUG
+	printf("init_table()\n");
+#endif
+	symrec *ptr;
+	int i;
+	/* add functions */
+	for (i = 0; arith_fncts[i].fname != 0; i++) {
+		ptr = putsym (arith_fncts[i].fname, FNCT);
+		ptr->value.fnctptr = arith_fncts[i].fnct;
+	}
+	/* add constants */
+	for (i = 0; constants[i].name != 0; i++) {
+		ptr = putsym (constants[i].name, VAR);
+		ptr->value.var = constants[i].value;
+	}
+}
+
+void delete_table(void) {
+	while(sym_table) {
+		symrec *tmp = sym_table;
+		sym_table = sym_table->next;
+		free(tmp->name);
+		free(tmp);
+	}
+}
+
+symrec* putsym (const char *sym_name, int sym_type) {
+#ifdef LDEBUG
+	printf("putsym() : sym_name = %s\n",sym_name);
+#endif
+	symrec *ptr;
+	ptr = (symrec *) malloc (sizeof (symrec));
+	ptr->name = (char *) malloc (strlen (sym_name) + 1);
+	strcpy (ptr->name,sym_name);
+	ptr->type = sym_type;
+	ptr->value.var = 0; /* set value to 0 even if fctn.  */
+	ptr->next = (struct symrec *)sym_table;
+	sym_table = ptr;
+	return ptr;
+}
+
+symrec* getsym (const char *sym_name) {
+#ifdef LDEBUG
+	printf("getsym() : sym_name = %s\n",sym_name);
+#endif
+	symrec *ptr;
+	for (ptr = sym_table; ptr != (symrec *) 0;
+			ptr = (symrec *)ptr->next)
+		if (strcmp (ptr->name,sym_name) == 0)
+			return ptr;
+	return 0;
+}
+
+symrec* assign_variable(const char* symb_name, double value) {
+	symrec* ptr;
+	ptr = getsym(symb_name);
+	if (!ptr)
+	ptr = putsym(symb_name,VAR);
+	ptr->value.var=value;
+	return ptr;
+};
+
+static int getcharstr(void) {
+	if ('\0' == string[pos])
+		return EOF;
+	return (int) string[pos++];
+}
+
+static void ungetcstr(void) {
+    if (pos > 0)
+        pos--;
+}
+
+int yylex (void) {
+#ifdef LDEBUG
+	printf("yylex()\n");
+#endif
+	int c;
+
+	/* skip white space  */
+	while ((c = getcharstr ()) == ' ' || c == '\t');
+
+	/* return end-of-file  */
+	if (c == EOF) {
+		return 0;
+	}
+	/* process numbers   */
+	/* TODO : catch single '.' as error "1+." */
+	if (c == '.' || isdigit (c)) {
+#ifdef LDEBUG
+		printf("is digit or .\n");
+#endif
+		char *tmp, *tmp2;
+                double result;
+                ungetcstr();
+                tmp = &string[pos];
+#ifdef LDEBUG
+		printf("tmp = %s\n",tmp);
+#endif
+                result = strtod(tmp,&tmp2);
+		/* check conversion */
+		if(strlen(tmp) == strlen(tmp2))
+			return 0;
+#ifdef LDEBUG
+		printf("result = %g\n",result);
+#endif
+                sscanf (tmp,"%lf", &(yylval.dval));
+                pos+= strlen(tmp)-strlen(tmp2);
+
+		return NUM;
+	}
+
+	/* Char starts an identifier => read the name. */
+	if (isalpha (c)) {
+#ifdef LDEBUG
+		printf("is alpha\n");
+#endif
+		symrec *s;
+		static char *symbuf = 0;
+		static int length = 0;
+		int i;
+
+		/* Initially make the buffer long enough
+		   for a 20-character symbol name.  */
+		if (length == 0)
+			length = 20, symbuf = (char *)malloc (length + 1);
+
+		i = 0;
+		do {
+			/* If buffer is full, make it bigger.        */
+			if (i == length) {
+				length *= 2;
+				symbuf = (char *)realloc (symbuf, length + 1);
+			}
+			/* Add this character to the buffer.         */
+			symbuf[i++] = c;
+			/* Get another character.                    */
+			c = getcharstr ();
+		}
+		while (c != EOF && (isalnum (c) || c == '_'));
+
+		ungetcstr ();
+		symbuf[i] = '\0';
+
+		s = getsym (symbuf);
+		/* symbol unknown */
+		if(s == 0)
+			return 0;
+		/* old behavior */
+		/* if (s == 0)
+			 s = putsym (symbuf, VAR);
+		*/
+		yylval.tptr = s;
+		return s->type;
+	}
+
+
+	/* return single chars */
+	return c;
+}
diff --git a/src/backend/gsl/parser_extern.h b/src/backend/gsl/parser_extern.h
new file mode 100644
index 0000000..2f3a62e
--- /dev/null
+++ b/src/backend/gsl/parser_extern.h
@@ -0,0 +1,11 @@
+#ifndef PARSER_EXTERN_H
+#define PARSER_EXTERN_H
+
+extern "C" double parse(char[]);
+extern "C" double old_parse(char[]);
+extern "C" int parse_errors();
+extern "C" void init_table();
+extern "C" void delete_table();
+extern "C" void* assign_variable(char* variable, double value);
+
+#endif /* PARSER_EXTERN_H */
diff --git a/src/backend/gsl/parser_struct.h b/src/backend/gsl/parser_struct.h
new file mode 100644
index 0000000..5578686
--- /dev/null
+++ b/src/backend/gsl/parser_struct.h
@@ -0,0 +1,18 @@
+#ifndef PARSER_STRUCT_H
+#define PARSER_STRUCT_H
+
+struct con {
+	char const *name;
+	double value;
+};
+
+struct init {
+	char const *fname;
+#ifdef HAVE_SOLARIS
+	double (*fnct)(double);
+#else
+	double (*fnct)();
+#endif
+};
+
+#endif /* PARSER_STRUCT_H */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic