[erlang-questions] Regular Expressions in Erlang

Robert Virding rvirding@REDACTED
Thu Dec 20 12:13:35 CET 2007


On 20/12/2007, mats cronqvist <mats.cronqvist@REDACTED> wrote:
>
> On Wed, 2007-12-19 at 18:14 +0000, Tomasz Blachowicz wrote:
> >
> > If there are any other decent implementations of regexp available
> > please let me know.
>
>   rumour has it that robert virding is working on a new erlang
> implementation; couldn't find any code by googling though.


Yes, I do have one that works but I haven't released it yet. Some info:

- It is written entirely in Erlang so it will be always available.
- It supports POSIX regexps and can capture subexpressions.
- It is a true NFA implementation and will never blow up irrespective of the
regexp. Most packages are unsafe for pathological cases, read Russ Cox
http://swtch.com/~rsc/regexp/
- It is probably not as fast as C implementations, but see above.
- It has a better parser ADT then the existing one.
- Having the ADT available in Erlang can be a big win.
- As it is written in Erlang it will nevre lock the emulator.

All that really needs to be done is to clean up the interface slightly. I
will release soon so people who want can test it. I have not been able to
compare speed with other implementation like PCRE as I only have access to a
toy environment, pure Windows. (see above features)

What I really think should be done is to split the work and have the
parser/compiler written in Erlang while the actual execution code written in
C. Try to get the best of both worlds. One benefit of this would be that it
would be then be easier to write other tools/apps which use regexps but
don't want to do just standard matching with them, for example leex or other
scanner/parser tools.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071220/2e81721f/attachment.htm>


More information about the erlang-questions mailing list