[Top][All Lists]

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

Re: How to use flex and bison with the C++ interface ?

From: Timothy Madden
Subject: Re: How to use flex and bison with the C++ interface ?
Date: Mon, 18 Jun 2012 13:23:59 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.5) Gecko/20120607 Thunderbird/10.0.5

On 06/16/2012 12:40 PM, Stefano Lattarini wrote:
On 06/15/2012 03:19 PM, Timothy Madden wrote:

Can automake use flex and bison to generate .cc files from lexer.ll and 
parser.yy files ?

You should use something like this instead:

     bin_PROGRAMS = code-formatter
     code_formatter_SOURCES = lexer.ll parser.yy

In case this suggestion doesn't solve your problem, please answer the
following questions (the details you've given would be too few for us
to attempt a proper diagnosis otherwise):

   - Which automake version are you using?
   - Which ylwrap version exactly?
   - On which system you are on?
   - What flex version are you using?
   - How do the relevant parts of the generated appear?
     (You can find this with "grep -C4 ylwrap").

Thank you,
Sorry for the missing version and all. I am using GNU automake 1.11.1 on CentOS release 6.2 64-bit. It generates ylwrap 2009-04-28.21 for me in my project, which wraps and invokes flex 2.5.35 and 2.4.1

The Makefile looks ok, here's the `grep -C4 ylwrap` result on it:
subdir = .
DIST_COMMON = $(am__configure_deps) $(srcdir)/ \
        $(srcdir)/ $(top_srcdir)/configure \ \
        code-formatter-parser.h depcomp install-sh missing ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        -o $@
YLWRAP = $(top_srcdir)/ylwrap
CCLD = $(CC)

I really did not expect code-formatter.ll and code-formatter.yy to produce a file name conflict in the build process, since flex and bison themselves take care to output different files in this case, so I would have expected automake to do the same.

But the real problem seemed to be that flex will output when using the C++ interface, instead of lex.yy.c which automake expects. I have seen a similar problem with bison, too.

Changing the file name to lexer.ll does not by itself solve this, as flex will still output, while automake expects lexer.yy.c May I dare say I think automake should be updated to expect the correct file name in this case ? Or better yet, is there a macro similar to AM_PROG_LEX that will look for and find flex++ ?

Happily both flex and bison can be instructed to use different file names as output. Is there a way to let automake know that my lex file will result in, and my yacc file will result in ?

Thank you,
Timothy Madden

reply via email to

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