automake
[Top][All Lists]
Advanced

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

Re: yacc/lex name conflicts


From: Christian Csar
Subject: Re: yacc/lex name conflicts
Date: Fri, 11 Jul 2008 21:45:07 -0400
User-agent: Thunderbird 2.0.0.14 (X11/20080505)

It is flex and bison renaming the generated symbols, mainly I was
wondering about how if one has foo.y and foo.l in the same directory for
sources, one will end up with foo.c which will contain only one of the
generated files, and this occurs without a printed message. However,
thank you for your assistance.

Incidentally according to man 1posix yacc it seems that in posix 2003
there are command line options for changing file prefix or symbol prefix.

Christian Csar

Erik de Castro Lopo wrote:
> Christian Csar wrote:
> 
>> Is there anyway to control the behavior of ylwrap? The project I am
>> converting has its parsers use files like foo.l and foo.y for the lex
>> and yacc files as they go together, and automake then converts both of
>> these to foo.c, overwriting the first seemingly silently. Admittedly I
>> solved this by changing foo.l to foo-lex.l, but it seems rather
>> inelegant. If there is a to notice the existence of foo.l and foo.y in
>> the same directory, it might be worth printing out a message as it is
>> not an immediately obvious problem (except for refusing to build).
> 
> Is these old school lex/yacc or are you actually using flex/bison?
> 
> The reason I ask is that flex/bison allow renaming all the generated
> symbols and I'm not sure if lex/yacc support this.
> 
> For flex, you add something like this at the top of the file:
> 
>     %option prefix = "my_"
> 
> and for bison you add this:
> 
>     %name-prefix = "my_"
> 
> after the first '%{' .... '%}' block.
> 
> HTH,
> Erik





reply via email to

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