[Xorp-hackers] About make yacc?

Pavlin Radoslavov pavlin at ICSI.Berkeley.EDU
Fri Sep 19 18:21:25 PDT 2008


杨小帅 <eshe168 at gmail.com> wrote:

> Hi,
>      When I use make yacc, I found something wrong. And, The new
> y.tplt_tab.cc is different with the old. I want to get reason. I do
> not change template.yy. My OS is Debian.

Sometimes using different version/different OS of yacc generates
different result.
We use the default yacc that comes with FreeBSD-7.0, which is based
on the original Berkeley Yacc.
The yacc one from Ubuntu for example is a very different
implementation: it is based on GNU Bison.

I just did a quick experiment on Ubuntu by using "gmake yacc" in the
rtrmgr directory to regenerate the rtrmgr Yacc-generated files, and
I observed the following:

* The result generated files are very different from the
  original files (because of GNU Bison).
* The result generated files don't compile with the rest of the
  rtrmgr files:

g++ -DHAVE_CONFIG_H -I. -I.. -I/home/pavlin/xorp/rtrmgr -I/home/pavlin/xorp    -g -Werror -W -Wall -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align -Woverloaded-virtual -ftemplate-depth-25 -pipe -MT lex.boot.o -MD -MP -MF .deps/lex.boot.Tpo -c -o lex.boot.o /home/pavlin/xorp/rtrmgr/lex.boot.cc
boot.ll:20: error: conflicting declaration 'char* bootlval'
/home/pavlin/xorp/rtrmgr/y.boot_tab.h:104: error: 'bootlval' has a previous declaration as 'YYSTYPE bootlval'
boot.ll: In function 'int bootlex()':
boot.ll:264: error: invalid conversion from 'char*' to 'YYSTYPE'
boot.ll:269: error: invalid conversion from 'char*' to 'YYSTYPE'
boot.ll:274: error: invalid conversion from 'char*' to 'YYSTYPE'
boot.ll:279: error: invalid conversion from 'char*' to 'YYSTYPE'

...


Just curious, why do you need to run "gmake yacc"? Are you modifying
some of the original rtrmgr/*.ll or rtrmgr/*.yy files or are you
trying to make some fundamental changes to the rtrmgr parsing
mechanism?
If no, then you don't need to run "gmake yacc".
If yes, the Yacc-generation is known to work only on FreeBSD, and I
don't have a good answer how to do it on other OS-es. You can try to
get it working with GNU Bison, but I don't know how difficult this
would be.

Pavlin

>      Looking forward your answer!
>      Here is error information:
> yxs at Lenny621:~/xorp-cli/xorp-demo/rtrmgr$ make yacc
> ( cd .;						\
> 	yacc -d -p tplt -o y.tplt_tab.c template.yy;		\
> 	mv y.tplt_tab.c y.tplt_tab.cc;				\
> 	bash ../utils/rcsid2ident.sh y.tplt_tab.cc;	\
> 	yacc -d -p boot -o y.boot_tab.c boot.yy;		\
> 	mv y.boot_tab.c y.boot_tab.cc;				\
> 	bash ../utils/rcsid2ident.sh y.boot_tab.cc;	\
> 	yacc -d -p opcmd -o y.opcmd_tab.c op_commands.yy;	\
> 	mv y.opcmd_tab.c y.opcmd_tab.cc;			\
> 	bash ../utils/rcsid2ident.sh y.opcmd_tab.cc;	\
> 	touch .yacc_generated_files )
> 61685
>       static char const yyunexpected[] = "syntax error, unexpected %s";
> ?
> 56089
>       static char const yyunexpected[] = "syntax error, unexpected %s";
> ?
> 56419
>       static char const yyunexpected[] = "syntax error, unexpected %s";
> ?
> 
> B.R.
> Xiaoshuai Yang
> 
> _______________________________________________
> Xorp-hackers mailing list
> Xorp-hackers at icir.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers



More information about the Xorp-hackers mailing list