[Top][All Lists]

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

Re: My plans for Bison: reentrant and pure

From: Eric S. Raymond
Subject: Re: My plans for Bison: reentrant and pure
Date: Wed, 13 Feb 2019 11:33:03 -0500
User-agent: Mutt/1.9.4 (2018-02-28)

Akim Demaille <address@hidden>:
> Eric,
> > Le 12 févr. 2019 à 18:34, Eric S. Raymond <address@hidden> a écrit :
> > 
> > 2. There's a declaration-order bug that shows up when building re-entrant
> > parsers; I tripped over it while working on cvs-fast-export. It's described
> > here:
> I guess you refer to this part:
> > There is, however, one gotcha (and yes, I have filed a bug report about 
> > it). Bison should arrange things so that all the %lex-params information is 
> > automatically passed to the generated parser and scanner code via the 
> > header file Bison generates (which is typically included in the C preambles 
> > to your Bison grammar and Lex specification). But it does not. 
> > 
> > You have to work around this, until it’s fixed, by defining a YY_DECL macro 
> > that expands to the correct prototype and is #included by both generated 
> > source code files. When those files are expanded by the C preprocessor, the 
> > payload of YY_DECL will be put in the correct places.
> I don't know what bug report you are referring to.

Sorry, I don't remember the bug number

> I don't use Flex's bison-bridge, and I don't recommend it.  Unfortunately it 
> was designed independently of Bison, and it kind of commits us to things we 
> don't didn't design.

I would by this, except that %lex-params in implemented by *Bison*.  It 
could put the right YYDECL in te generated header. It doesn't - that's the bug.

I've written many reentrant parsers with Bison and Flex without the 
bison-bridge, I don't think it is needed.

I have not found documentation of how to write a reentrant parser without
the bridge.  Does any exist?

> Wrt YY_DECL, well, nothing in Bison is specific about Flex.  We don't require 
> it, we don't rely on it, so we leave to the user the choice of her 
> declaration of yylex.  We could generate YY_DECL, but it was never suggested 
> so far.
> There is an example of a reentrant calculator on top of flex/bison in 
> examples/c/lexcalc.

You later note that this example is pure but not re-entrant.

I still think this is a Bison bug.
                <a href="";>Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute:
Please visit their site and donate: the civilization you save might be your own.

reply via email to

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