help-bison
[Top][All Lists]
Advanced

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

Re: Can't compile bison/flex output files without cc?


From: Philip Herron
Subject: Re: Can't compile bison/flex output files without cc?
Date: Fri, 01 May 2009 10:46:05 +0100
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

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

Hey

One quick question what do you mean that you cant use CC in anjuta? as
in c-compiler or what?

This is the way your don't want to be working with your parser and
lexer. I mean you want your makefile to be re-generating your parser
and compiling if any changes. This sounds like a problem with your
parser. If input isn't recognized, do you mean your lexer won't pickup
any tokens if it cannot be matched, and then once the lexer has the
tokens it will be passed to your parser generated by bison.

"So I said "ok, now I could just create an Anjuta project with foo.tab.c,
foo.tab.h, lex.yy.c and compile". I followed this way, and it compiles
with
several warnings.
When I run the executable programm, it works fine but when input is not
recognized and the recovery procedure is impossible, it crashes with a
"segmentation fault" error message."


So i would doubt  bison is giving you a seg-fault it could be you have
some code that has a pointer to something that doesn't exist. Try to
run though the program your self a few times.

Only thing i could think of if you parser needs to do actual work on
some of the tokens make sure your lexer does yylval= strdup(yytext)

If you haven't union'ed yylval it could be a good idea. so you could
do yylval.string= strdup(yytext); return B

So as you can do stuff with your tokens in bison like:

#define yystype char * or to the union

fooRule: A B C
             {
                 printf("%s", $2)
             }
             ;

Personally i don't like IDE's like anjuta. You would be much better
off using automake and autoconf to do this, because its more portable
and easier to work with. You should track down your code, and if your
sure its your parser try to dump some code here so as we can help.

One thing try to make sure you don't have any shift/reduce problems in
your parser that could be a potential problem. Anyways there isn't
much i can do unless you track down your problem more specifically.

- -Phil
http://redbrain.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkn6xNEACgkQAhcOgIaQQ2HB+gCbBn7AjZuZ81gUpD7AiBr+D8ld
om0An13ftc4VpzqlL1wQDQZsMfpmTyww
=K/kx
-----END PGP SIGNATURE-----





reply via email to

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