Advertisement

bison++ problems

Started by May 12, 2003 01:34 PM
0 comments, last by MDI 21 years, 6 months ago
This is the code that I added to the first example (a postfix calculator) provided with the documentation for bison++ and flex++.
  
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;
}

  
The code compiles fine, with a few tweaks, like defining that alloc should not be used. However, on execution, when I enter the line 4 5 +, expecting 9, I instead get a runtime error: R6002 - runtime error, floating point not loaded. What is this, and how can I prevent it from occuring? I''m very new to both compiler compilers, and especially bison, having messed around a bit in SableCC. Any help is much appreciated. I''m from the north of England. We live in huts.
Well done for mis-posting the error message in the other forum

Look here and post again if you can''t fix it. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/r6002.asp

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

This topic is closed to new replies.

Advertisement