RE#: how we built the fastest regex engine in F#
43 points
2 days ago
| 8 comments
| iev.ee
| HN
noelwelsh
7 minutes ago
[-]
I love regular expression derivatives. One neat thing about regular expression derivatives is they are continuation-passing style for regular expressions. The derivative is "what to do next" after seeing a character, which is the continuation of the re. It's a nice conceptual connection if you're into programming language theory.

Low-key hate the lack of capitalization on the blog, which made me stumble over every sentence start.

reply
andriamanitra
9 minutes ago
[-]
This is very interesting. I'm a bit skeptical about the benchmarks / performance claims because they seem almost too good to be true but even just the extended operators alone are a nice improvement over existing regex engines.

The post mentions they also have a native library implemented in Rust without dependencies but I couldn't find a link to it. Is that available somewhere? I would love to try it out in some of my projects but I don't use .NET so the NuGET package is of no use to me.

reply
balakk
30 minutes ago
[-]
Finally, an article about humans programming some computers. Thank you!
reply
agnishom
14 minutes ago
[-]
The author mentions that they found Mamouras et al. (POPL 2024), but not the associated implementation. While the Rust implementation is not public, a Haskell implementation can be found here: https://github.com/Agnishom/lregex
reply
gbacon
27 minutes ago
[-]
That’s beautiful work. Check out other examples in the interactive web app:

https://ieviev.github.io/resharp-webapp/

Back in the Usenet days, questions came up all the time about matching substrings that do not contain whatever. It’s technically possible without an explicit NOT operator because regular languages are closed under complement — along with union, intersection, Kleene star, etc. — but a bear to get right by hand for even simple cases.

Unbounded lookarounds without performance penalty at search time are an exciting feature too.

reply
sourcegrift
1 hour ago
[-]
I've had nothing but great experience with F#. If it wasn't associated with Microsoft, it'd be more popular than haskell
reply
raincole
1 hour ago
[-]
I think if it weren't a 'first class' member of .NET ecosystem[0], no one would know F#. After all Haskell and Ocaml already exist.

[0]: my very charitable take, as MS obviously cares C# much much more than F#.

reply
pjmlp
20 minutes ago
[-]
Management has always behaved as if they repent having added F# to VS 2010, at least it hasn't yet suffered the same stagnation as VB, even C++/CLI was updated to C++20 (minus modules).

In any case, those of us that don't have issues with .NET, or Java (also cool to hate these days), get to play with F# and Scala, and feel no need to be amazed with Rust's type system inherited from ML languages.

It is yet another "Rust but with GC" that every couple of months pops up in some forums.

reply
dude250711
1 hour ago
[-]
reply
brabel
2 minutes ago
[-]
Did they ever get the full extra person who gives a shit?
reply
sourcegrift
51 minutes ago
[-]
> But they all just skip the press releases and go straight to the not using it part

Lol

reply
lynx97
1 hour ago
[-]
You realize that Microsoft Research employed Simon for many many years?
reply
anentropic
58 minutes ago
[-]
Fantastic stuff!

FYI some code snippets are unreadable in 'light mode' ("what substrings does the regex (a|ab)+ match in the following input?")

reply
ieviev
22 minutes ago
[-]
ah thank you for letting me know, fixed it now!
reply
sourcegrift
33 minutes ago
[-]
Obligatory: Hitler reacts to functional programming

https://m.youtube.com/watch?v=ADqLBc1vFwI

reply