[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: OR, quantifier support in Lua patterns
- From: Jay Carlson <nop@...>
- Date: Wed, 10 Oct 2018 16:20:33 -0400
I take no position on the suitability of this implementation.
On 2018-10-09, at 5:47 PM, Victor Krapivensky <krapivenskiy.va@phystech.edu> wrote:
> I am not sure why everybody seems to believe that (non-PCRE) regular
> expression engine has to be complex. See
> https://swtch.com/~rsc/regexp/regexp1.html for implementation in less than
> 400 lines of C (probably less rewritten in a "modern" style).
Counting semicolons:
$ cat *.c *.h | tr -c -d ';' | wc
0 1 656
Using https://dwheeler.com/sloccount/
$ sloccount regcomp.c regcomp.h regerror.c regerror.h regexec.c regsub.c regaux.c rregexec.c rregsub.c
[...]
Totals grouped by language (dominant language first):
ansic: 1139 (100.00%)
[...]
But with clang -O2 on Darwin-x86_64:
$ gsize --total -d libregexp9.a | tail -1
10500 0 752 11252 2bf4 (TOTALS)
And with clang -Os, it's 8293 bytes. gcc -Os on Linux is 7503 bytes.
--
Jay