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

Ekaitz Zarraga <[email protected]>
Newsgroups gmane.lisp.guile.devel
Message-ID <[email protected]>
Hi

On 2024-10-16 08:44, Rutger van Beusekom wrote:

> *Subject:* Re: [PATCH v2 5/5] peg: Add fall-back parsing.
> Hi Ekaitz,
> 
>  > I think this change is not compatible with the PEG syntax. In PEG # is a
>  > line comment:
> 
> I am not attached to # as the PEG expect operator.  At the same time the
> expect operator is not part of https://bford.info/pub/lang/peg.pdf 
> <https://bford.info/pub/lang/peg.pdf>. I think
> we should consider choosing another name for the expect operator, do you
> have a suggestion Ekaitz?
> 
> I was considering "reusing" the she-bang, i.e. #!, since the expect operator
> throws an exception, but Janneke pointed out that ! as a modifier on the #
> comment is not very intuitive and I tend to agree.

My suggestion is to try to be closer to what PEG/LEG does simply because 
it's a very famous library:

https://www.piumarta.com/software/peg/peg.1.html

In any case, we should and probably must diverge from it a little bit in 
order to be compatible with our constructs. For example, that one 
supports (patter), {action} and <acc> that we might not be able to 
replicate. My idea is to continue its line as long as it's useful for 
us, but when it's not we can just diverge from the parts that we don't like.

I'm wondering if this fallback mechanism could fit in one of the 
constructs of PEG that the library supports. If it doesn't, we could 
just go with @ or % signs or anything like that. If it does, we could 
just follow what the library does.

WDYT?
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.