void parse :: yyerror (char* msg) {
printf ("%s", msg);
}
int parse :: yylex () {
int c = 0;
while ((c = getchar ()) == ' ' || c == '\t');
if (c == '.' || isdigit (c)) {
ungetc (c, stdin);
scanf ("%lf", yylval);
return NUM;
}
if (c == EOF) {
return c;
}
return c;
}
int main (int argc, char** argv) {
parse* parser = new parse ();
parser->yylex ();
delete parser;
parser = 0;
return 0;
}
bison++ problems (R6003)
I apologise for cross posting this thread in the Scripting forum too, but my question has been in there for a while now, with no replies and only 21 views. I'm desperate to try to get something working, at least.
I downloaded the bison++ files from a website, and created a small postifx calculator with a grammar similar to the one supplied in the examples in the documentation. After a bit of messing with the #defines, I finally got it to compile correctly in MSVC 6.0, after adding the following code:
This, again, is based on the documentation code. However, when I execute my program, and enter "4 5 +", expecting "9", I get a runtime error from bison - R6003 "floating point not initialised". Has anyone experienced this before? How do you stop this from occurring? I've searched Google and newsgroups, yet nothing seems to be mentioned about this there, or in the documenation either.
Can anyone help me, please?
Thanks in advance.
I'm from the north of England. We live in huts.
[edited by - MDI on May 13, 2003 8:13:23 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement