automake
[Top][All Lists]
Advanced

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

Re: Problems with linking multiple lex/yacc parsers into one executable


From: Philip Herron
Subject: Re: Problems with linking multiple lex/yacc parsers into one executable
Date: Sun, 17 May 2009 11:49:32 +0100
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey

I solved this problem a while back!

http://lists.gnu.org/archive/html/automake/2009-04/msg00095.html

The trick is in each of your lexers(flex .l) add this:
%option prefix="prefix" outfile="lex.yy.c"

Dont change the outfile ylwrap needs it to be lex.yy.c!


Then for your parsers you need to specify different prefixs too:
AM_YFLAGS = -d -p prefix

I only had 2 lexers and only 1 with one parser. So you need to specify
2 differnent prefixes to each of the parsers i am not sure if you can do:

AM_YFLAGS = -d

FOO_Y_YFLAGS = -p prefix_a
FOO_2_Y_YFLAGS = -p prefix_a

If you cant you could do a small lib out of one of them...:

bin_PROGRAMS= myprogram

myprogram_CFLAGS= -I$(top_srcdir)/include
myprogram_SOURCES= foo.c foo2.c
myprogram_LDADD = libparser_a.a libparser_b.a

noinst_LIBRARIES = libparser_a.a libparser_b.a

libparser_a_a_YFLAGS = -d -p prefix_a
libparser_a_a_SOURCES = foo_parser.y foo_lexer.l
libparser_a_a_CFLAGS = -I$(top_srcdir)/include

libparser_b_a_YFLAGS = -d -p prefix_b
libparser_b_a_SOURCES = foo_parser_b.y foo_lexer_b.l
libparser_b_a_CFLAGS = -I$(top_srcdir)/include


Something like that could work anyways its actualy much easier than
you think it just took me forevor to find that flex option:

%option prefix="prefix" outfile="lex.yy.c"

- --Phil

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkoP67wACgkQAhcOgIaQQ2HzAACeL2VORoZapywyWrXvRR3AHyZ3
1C8AnRc5Yz8kSbOUB+4COPxGkgxcGLwE
=bDqO
-----END PGP SIGNATURE-----





reply via email to

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