[comp.lang.perl] Building perl with bison

twl@cs.brown.edu (Ted "Theodore" (W) Leung) (03/03/90)

I'm having trouble building perl using bison.  If I run Configure and
specify bison as the parser generator, then Make uses the wrong set of
filenames to generate a parser.  I added a -y flag to the Yacc command
when $(YACC) = bison, so that it uses the yacc format names.  But then
I get an error when trying to compiler the scanner....  There must be
another bison incompatibility, because when I switched back to yacc.
I got everything to build. 

Does any one know what's going on?  I thought this was supposed to
work out of the box...  Below is a list of the errors I
get trying to compile the scanner

Expect 25 shift/reduce errors...
bison -dy perl.y
perl.y contains 25 shift/reduce conflicts.
mv y.tab.c perl.c
mv y.tab.h perly.h
gcc -c -fpcc-struct-return -I/usr/include/sun -O  perl.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O  cons.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O  perly.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O  str.c
gcc -c -fpcc-struct-return -I/usr/include/sun -O  toke.c
toke.c: In function yylex:
toke.c:196: `yylval' undeclared (first use this function)
toke.c:196: (Each undeclared identifier is reported only once
toke.c:196: for each function it appears in.)
toke.c: In function scanpat:
toke.c:1360: `yylval' undeclared (first use this function)
toke.c: In function scansubst:
toke.c:1468: `yylval' undeclared (first use this function)
toke.c: In function scantrans:
toke.c:1648: `yylval' undeclared (first use this function)
toke.c: In function scanstr:
toke.c:1696: `yylval' undeclared (first use this function)
make: *** [toke.o] Error 1


Ted
--------------------------------------------------------------------
Internet/CSnet: twl@cs.brown.edu 	| Ted "Theodore" Leung
BITNET: twl@BROWNCS.BITNET		| Box 1910, Brown University
UUCP: uunet!brunix!twl			| Providence, RI 02912

jbw@bucsf.bu.edu (Joe Wells) (03/05/90)

In article <31299@brunix.UUCP> twl@cs.brown.edu (Ted "Theodore" (W) Leung) writes:

   [problems using "bison -y" instead of "yacc" when building perl]

This is indeed a minor incompatibility between bison and yacc.  yacc puts
a line of this form in "y.tab.h" which bison does not:

    extern YYSTYPE yylval;

The most portable solution to this that I can see is to add this
declaration to each of the files which include the ".h" file generated by
yacc:

    cons.c perly.c str.c toke.c

-- 
Joe Wells <jbw@bu.edu>
jbw%bucsf.bu.edu@cs.bu.edu
...!harvard!bu-cs!bucsf!jbw