[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dfa, awk
- To: Leonid Leibman <http://www.raqia.com/~leonidl>
- Subject: Re: dfa, awk
- From: http://dummy.us.eu.org/robert (robert)
- Date: Tue, 4 Sep 2001 10:24:48 -0400
- In-Reply-To: <3B94D326.3D2AC3A0@raqia.com>
- Keywords: Leonid Leibman <http://www.raqia.com/~leonidl>
> From: Leonid Leibman <http://www.raqia.com/~leonidl>
> Date: Tue, 04 Sep 2001 09:12:06 -0400
>
> ---Executing: html-to-ascii
> Hi, Robert -- first of all (if you're still interested in the subject) I
> learnt that the algorithm for conversion of
> a regular expression directly to DFA (without the intermediate NFA) is
> much more efficient than the
> classical Thompson algorithm I (we) used. Somehow the need of e-closure
> for empty transitions is
> eliminated from the picture by some trick. All this is in the next
> section of the Dragon book. Seems like
> the commercial products use this algorithm as well.
That's good to know.
> Second -- a question -- how can one use backreferences in awk (in sed
> one does s/a\(b*\)a\1/.....).
> Can I do something of this sort in awk? For example can I accomplish
> something like
>
> /a\(b*\)a\1/ { print \1}
>
> or maybe something simpler like
>
> /a\(b*\)a/ {print \1}
>
> More generally, is there some mechanism like this in awk?--
I don't know of any way. Can't sed be used? If I had to do this, I'd
probably just use Perl.
> Leonid Leibman