>
> {snip}
>
> .... like it may be in a stack frame identified as "yyparse()" which
> gdb says is in the yacc input source.  I've been unable to find that
> function anywhere, and I'm hoping someone on this list might be able to
> help me.  Anyone able to give me a lifeline, please?
>
> THANKS!
>
> --Bruce McCulley

hello,

first off let me say that flex and bison are a great pair of tools ... quirky
yes, but once you get the hang of it you will wonder why you ever bothered to
write/debug your own parser.  also, let me point you to the online bison docs,
as they are actually quite useful ...

 http://www.gnu.org/manual/bison/index.html

 ... that said let me explain (or try to anyway) yyparse().  yyparse is _the_
function that does all of the parsing work; all of the rule/action pairs get put
together to form yyparse().  the how's and why's of the actual function
generation are quite complicated, but a quick and easy way to understand it is
by realizing the rules as states and parsing as simply moving from one state to
another (think finite state machine), yyparse is simply a big loop that keeps
going as long as there is new input in the form of a token.  yyparse takes the
token, matches it to the correct state and then continues.  this explanation
doesn't do it justice, but you get the idea hopefully ...

now you are probably wondering ... "oh shit, how the hell am i going to debug
this?!" well thankfully for us the nice gnu folk built some trace facilities
into bison which can be activated by doing the following ...

* place this in your bison code as part of your c source ...

 #ifdef YYDEBUG
   static const int yydebug=1;
 #endif

* and then when you want to debug simply compile the parser with YYDEBUG defined
(the bison manual has more on this)

 ... this will give you information whenever the parser changes state.  it has
been a while but i think it tells you which token it read, the current state,
and the contents of the parse stack.  you can also run bison with the "-v" flag
to have it dump an "output" file which lists all of the state transitions
possible.  very overwhelming at first to look at, but very handy for catching
parsing bugs.

hope this helps,

.... [EMAIL PROTECTED] .... www.alumni.engin.umich.edu/~pcmoore ....


**********************************************************
To unsubscribe from this list, send mail to
[EMAIL PROTECTED] with the following text in the
*body* (*not* the subject line) of the letter:
unsubscribe gnhlug
**********************************************************

Reply via email to