[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems with linking multiple lex/yacc parsers into one executable
From: |
Hans Nieser |
Subject: |
Re: Problems with linking multiple lex/yacc parsers into one executable |
Date: |
Sun, 17 May 2009 13:15:14 +0200 |
On Sun, 2009-05-17 at 11:49 +0100, Philip Herron wrote:
> -----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-----
>
Ahh interesting, I did stumble upon your mail before but I missed the
bit about the "outfile" option, so I got stuck with that. I guess this
option is flex-specific but at this point I just want it to work,
portability is less important since only I need to generate the yacc/lex
output.
I was also a bit confused on how to deal with the header produced by
yacc but the documentation ( at
http://www.gnu.org/software/automake/manual/html_node/Yacc-and-Lex.html )
explains how that is dealt with.
Thanks for clueing me in!
- Problems with linking multiple lex/yacc parsers into one executable, Hans Nieser, 2009/05/16
- Re: Problems with linking multiple lex/yacc parsers into one executable, Hans Nieser, 2009/05/16
- Re: Problems with linking multiple lex/yacc parsers into one executable, Lorenzo Bettini, 2009/05/17
- Re: Problems with linking multiple lex/yacc parsers into one executable, Ralf Wildenhues, 2009/05/17
- Re: Problems with linking multiple lex/yacc parsers into one executable, Philip Herron, 2009/05/17
- Re: Problems with linking multiple lex/yacc parsers into one executable, Ralf Wildenhues, 2009/05/17
- Re: Problems with linking multiple lex/yacc parsers into one executable, Philip Herron, 2009/05/17
- Re: Problems with linking multiple lex/yacc parsers into one executable, Hans Nieser, 2009/05/17
- Re: Problems with linking multiple lex/yacc parsers into one executable, Philip Herron, 2009/05/17
- Re: Problems with linking multiple lex/yacc parsers into one executable, Philip Herron, 2009/05/17