Hi Eric,

> Le 14 févr. 2019 à 05:42, Eric S. Raymond <[email protected]> a écrit :
> 
> Akim Demaille <[email protected]>:
>>>> 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?
>> 
>> I don't know, but I could improve examples/c/lexcalc to show that.
> 
> I think that would be very useful, and not just for me.

I have pushed a WIP there: https://github.com/akimd/bison/pull/6.
I started it inside the lexcalc example, which I meant to be simple,
but making it reentrant no longer qualifies as simple.  So I'll make
it an additional example, say reentrant-calc :)

To demonstrate reentrancy, this calculator invokes another parser
on parens (whose content is kept a string).  So (((1)+(2))*((3)+(4)))
uses 8 parsers, with a depth of 4.

Here are the files (easier than the diff).  Comments most welcome.
Please let me know if it addresses all your concerns.


Attachment: Makefile
Description: Binary data

Attachment: parse.y
Description: Binary data

Attachment: scan.l
Description: Binary data

Reply via email to