[PLUG] any bison/yacc experts want to check my work?

Larry Brigman larry.brigman at gmail.com
Thu Jul 12 06:42:34 UTC 2007


On 7/11/07, Keith Lofstrom <keithl at kl-ic.com> wrote:
>
> I don't understand yacc and bison;  I don't expect to understand
> without a lot more effort.  I have other tasks to do first.  I
> am porting a program from windows tools to cygwin tools and open
> source, and eventually to linux.  The current build uses MKS
> yacc ($400!!), and I hope to use cygwin bison instead.
>
> When I run a legacy file  foo.y  through yacc on my linux box, it
> makes foo.c properly, but fails with bison .  I believe this is
> because foo.y is written incorrectly and yacc is more permissive
> than bison.  It has lines like:
>
> zz_len:   ZZ_LEN '('       = { force_string = 1;};
>
> >From my limited reading of the yacc and bison docs, the first
> equals sign may be incorrect.  I think it should be:
>
> zz_len:   ZZ_LEN '('         { force_string = 1;};
>
> When I take out all the pesky extra = signs, the yacc.c file
> that yacc builds is the same, except for some small and
> unimportant white space changes.  The new foo.y file also
> works with bison.  So I think this is the right thing.
>
> The .y file is currently semi-confidential - the code I am open
> sourcing hasn't been released yet.  But I'm sure I can get
> permission from the owner to share the file with a knowledgable
> yacc/bison expert without hassle.
>
> So:  Any yacc/bison experts with a few minutes to critique a
> .y file ?
>
> Keith

I think you have your answer.  If both versions of the file produce the
same .c file except for some white space outside of quoted white space,
then you are good.  Now, if that file produces the same .c file from
bison or flex then
you should be in like flint.



More information about the PLUG mailing list