help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to replace YACC global variables !


From: Mondal, Debashis E \(GE Energy\)
Subject: RE: How to replace YACC global variables !
Date: Mon, 8 Mar 2004 09:45:42 +0530

Hans, 
I am very sorry to write you personal mail. Please excuse me for this 
inconvenience.


I am not suppose to write a header file for this case, because when I will 
compile the test.y by yacc ( in Solaris System ), it generates these global 
variables ( yyv, yys, yyerrflag, yytmp, yystate, yyps, yypv etc ) and uses it. 
But if I compile the same test.y in bison ( In Linux System ), it doesn't 
generate these global variables and never uses it.

But my other c files uses these variables ( yyv, yys, yyerrflag, yytmp, 
yystate, yyps, yypv etc ). So if I compile in Sun Solaris system, it generates 
executable. But If I compile in Linux System, it says undefined variables ( 
yyv, yys, yyerrflag, yytmp, yystate, yyps, yypv etc ).

For examples :
test.y
....
%%
......
%%


a.c file
main()
{
int temp;
......
temp == yyv;
.....
....
}


Now if I compile in Solaris, it works fine and generates executable. But in 
case of Linux system, it says undefined variable yyv. So if I write a header 
file for this, then yyv will be available and will generate executable. But 
what will be the value of yyv?

If the problem is not clear then I will try to explain you in next mail. 



Thanks
Debashis



-----Original Message-----
From: Hans Aberg [mailto:address@hidden
Sent: Monday, March 08, 2004 12:12 AM
To: Mondal, Debashis E (GE Energy)
Cc: address@hidden
Subject: Re: How to replace YACC global variables !


At 11:33 +0530 2004/03/04, Mondal, Debashis E (GE Energy) wrote:
>I have a yacc ( test.y ) file along with some c files to generate a
>executable. Now other c files uses yacc generated global variables ( yyv,
>yys, yyerrflag, yytmp, yystate, yyps, yypv etc ). The problem comes when I
>compile yacc file by bison ( bison -d test.y ) and try to generate
>executable by compiling other c files along with the bison generated c
>file, the c compiler says that undefined symbol : yyv, yys, yyerrflag,
>yytmp, yystate, yyps, yyv etc. How do I resolve this problem? Can anyone
>help me?

It depends on how your program reads the .c parser file: In one style, the
lexer is inserted into the parser file.

The style you have chosen suggests that you instead want the names in a
special header file. You should make sure that your compiler sees that
header file, either by some compiler command, or by making sure other
C-source files #includes it.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]