help-bison
[Top][All Lists]
Advanced

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

Re: Any Method of reading the token values off the stack


From: Hans Aberg
Subject: Re: Any Method of reading the token values off the stack
Date: Wed, 5 May 2004 19:22:08 +0200

At 23:23 -0400 2004/05/04, Tim Zimmerlin wrote:
>In my error recovery processing, I want to read the token values in
>FIFO order off the stack, in yyerror(), before flushing it as part of
>the default "error" rule processing
>
>Does bison provide direct stack access functions/macros? I would like
>to know how many tokens are on the stack. I would like to read them in
>FIFO rather than LIFO order to save them as originally read.

Bison produces an LALR(1) parser, which on its stack only contains
arbitrarily numbered LALR(1) states, represented by integral values. These
state numbers are described in the .output file that Bison writes when
invoking the --verbose option. They represent something more complicated
than just token values: so called sets of items, where an item is
essentially a parser rule with a dot indicating how far the parsing has
proceeded.

So the parser stack never contains any tokens. If you need to use such
info, you must put it there yourself.

  Hans Aberg






reply via email to

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