chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Mutual recursion w/ comparse


From: Moritz Heidkamp
Subject: Re: [Chicken-users] Mutual recursion w/ comparse
Date: Fri, 29 May 2015 11:00:37 +0200

Hi Matt,

On 29 May 2015 02:24 CEST, Matt Gushee wrote:

> Actually, this is just a copy of the 'vac' macro from json-abnf; I changed
> the name because I had no idea what 'vac' means - whereas 'mrp' stands for
> 'mutually recursive parser'.

just a nit-pick: You also need this kind of thing for self recursive
definitions, not just mutually recursive ones.


> I also saw that comparse provides a similar macro called
> 'recursive-parser', but for some reason that didn't work when I tried it.
> Maybe I was using it wrong.

That's right -- it's slightly more efficient than your version as it
memoizes the wrapped parser so that it only needs to be constructed the
first time it is used.

If you are on Comparse 0.2.2 you would define your parser just like
before, wrapped in `recursive-parser', i.e. the interface should be
identical to your `mrp'. The interface used to be different before
Comparse 0.2.2. Note that this is still an experimental API which is why
it isn't in the documentation, yet. I think the current version will
make it, though. Let me know if it works!

Cheers
Moritz

Attachment: signature.asc
Description: PGP signature


reply via email to

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