[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make peg.el a built-in library?
From: |
Stefan Monnier |
Subject: |
Re: Make peg.el a built-in library? |
Date: |
Sat, 09 Oct 2021 23:43:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
>> (4) How hard would it be to parse regexps (or translate `rx' forms) into
>> an equivalent peg?
> I had this idea as well -- we've already got "regexps that look like
> forms", it seems like it would be a natural to integrate this with rx.
> One thing we're not short of here is new ideas for code, but I do think
> this would make a lot of sense.
I think turning a regexp into a PEG should be easy, but at one condition:
you shouldn't expect that PEG to be *equivalent* to the regexp.
E.g. when matching
(string-match "\\(ab\\|a)bc" "abc")
the "natural" PEG for that regexp will fail to match (because it will
see a success to match "ab" and will hence just skip the "a"
alternative).
Correctly matching regexps requires a deeper form of backtracking than
provided by PEGs.
Stefan
Re: Make peg.el a built-in library?, Stefan Monnier, 2021/10/09
Re: Make peg.el a built-in library?, Eric Abrahamsen, 2021/10/09
- Re: Make peg.el a built-in library?,
Stefan Monnier <=
- Re: Make peg.el a built-in library?, Michael Heerdegen, 2021/10/10
- Re: Make peg.el a built-in library?, Helmut Eller, 2021/10/10
- Re: Make peg.el a built-in library?, Stefan Monnier, 2021/10/10
- Re: Make peg.el a built-in library?, Michael Heerdegen, 2021/10/22
- Re: Make peg.el a built-in library?, Michael Heerdegen, 2021/10/31