Re: [PATCH v2 5/5] peg: Add fall-back parsing.

Ekaitz Zarraga <[email protected]>
Newsgroups gmane.lisp.guile.devel
Message-ID <[email protected]>
On 2024-10-14 09:36, Janneke Nieuwenhuizen wrote:
> Janneke Nieuwenhuizen writes:
> 
>> From: Rutger van Beusekom <[email protected]>
>>
>> This allows production of incomplete parse trees, without errors, e.g.,
>> for code completion.
>>
>> * module/ice-9/peg/codegen.scm (%peg:fall-back?): New exported
>> parameter.
>> (%enable-expect, %continuation, %final-continuation): New parameter.
>> (final-continuation): New function.
>> (cg-or-rest): New function.
>> (cg-and-int): Recover from expectation failures, fall-back by skipping
>> forward or escalating upward.
>> (cg-*): Prepare fall-back %continuation.
>> * test-suite/tests/peg.test ("Fall-back parser"): Test it.
>> * doc/ref/api-peg.texi (PEG Internals): Document it.
>>
>> Co-authored-by: Janneke Nieuwenhuizen <[email protected]>
>>
>> fall-back
>>
>> fall-back
>>
>> fallback
> 
> Oops, find cleaned-up version attached.
> 
> 
> 

Hi all,

I think this change is not compatible with the PEG syntax. In PEG # is a 
line comment:

https://bford.info/pub/lang/peg.pdf

I think we should take a look to what PEG/LEG does to see if they 
implement the same idea and copy the syntax they use. If they do.

https://github.com/gpakosz/peg/blob/upstream/src/peg.1

I'll take a deeper look to it, the rest of the commits seem good, but 
I'll also review in detail and propose something compatible with what 
I'm trying to push for in #73188.

Thanks for sharing all these commits, they are very interesting and helpful.

Ekaitz
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.