[Top][All Lists]

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

Re: yacc/lex name conflicts

From: Erik de Castro Lopo
Subject: Re: yacc/lex name conflicts
Date: Sat, 12 Jul 2008 07:55:24 +1000

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.

Erik de Castro Lopo
Question #70427: Sitting beside women on public transport because
one is forced to

reply via email to

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