bison-patches
[Top][All Lists]
Advanced

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

Re: My plans for Bison: reentrant and pure


From: Akim Demaille
Subject: Re: My plans for Bison: reentrant and pure
Date: Sat, 16 Feb 2019 11:53:39 +0100

Hi Eric,

> Le 14 févr. 2019 à 05:42, Eric S. Raymond <address@hidden> a écrit :
> 
> Akim Demaille <address@hidden>:
>>>> 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

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