From: tomas@tuxteam.de
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
Subject: Re: How to get a concatenation of the negations with rx (ex: [^a][^b])?
Date: Sun, 12 Nov 2023 11:38:29 +0100 [thread overview]
Message-ID: <ZVCrJbkdmP6oJ8dX@tuxteam.de> (raw)
In-Reply-To: <CAP_d_8U3euLr5Bh-mRvYUqVJGiXBCGZZq=9k_3ghRZsa_+U+AA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1227 bytes --]
On Sun, Nov 12, 2023 at 03:28:21PM +0700, Yuri Khan wrote:
> On Sun, 12 Nov 2023 at 14:27, <tomas@tuxteam.de> wrote:
>
> > Actually... the complement of a regular language is also a regular
> > language, so there should be a regexp for that, too.
>
> In all(?) the courses that taught me the theory of regular languages,
> the construction of a negation of a regexp would be suitable as the
> practical part of an exam question sheet.
>
> As the first step, it is relatively straightforward to build a
> non-deterministic finite state machine from the original regexp; then
> we complement that NDFA’s set of accepting states; and then it’s a
> tedious, error-prone job of building a regexp equivalent to that
> complemented NDFA.
OK -- this was roughly my train of thought: build the NFA, then
invert that... OMG. Then I decided this is better left as an
exercise to the reader.
But since a regexp library is building the NFA anyway, I think
it's surprising that it doesn't support negation. But I haven't
ever tried to implement that; perhaps I'd know the answer then :)
> The regexp thus obtained is often not a pretty sight, either.
I believe you right away on that!
Cheers
--
t
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2023-11-12 10:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 20:17 How to get a concatenation of the negations with rx (ex: [^a][^b])? Edgar Lux
2023-11-11 21:00 ` Emanuel Berg
2023-11-13 19:26 ` tomas
2023-11-12 7:03 ` Michael Heerdegen
2023-11-12 7:26 ` tomas
2023-11-12 8:28 ` Yuri Khan
2023-11-12 10:38 ` tomas [this message]
2023-11-12 11:53 ` Michael Heerdegen
2023-11-13 8:46 ` Anders Munch
2023-11-13 9:24 ` tomas
2023-12-24 11:54 ` tomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZVCrJbkdmP6oJ8dX@tuxteam.de \
--to=tomas@tuxteam.de \
--cc=help-gnu-emacs@gnu.org \
--cc=michael_heerdegen@web.de \
--cc=yuri.v.khan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.