#Deterministic regular expressions

1 messages · Page 1 of 1 (latest)

cursive plume
#

Today I wrote a regex engine :)

This regex flavour is intentionally restricted to make the implementation simpler and faster, but it's still pretty expressive and should be perfectly fine for the intended usecase (programming language lexers).

Speaking of lexers, it has a neat little Lexer abstraction to make those very easy to do! It's designed to be plug-and-play with my parser generator, Zacc.

In future I might implement a converter to turn regular, nondeterministic regexes into DREs, but it's not a huge priority - let me know if this is stopping you from using the project!

Currently, this only works with regexes provided at comptime. I don't have any short-term plans to change this, but if someone wants to have a go I'm open to PRs :)

https://github.com/silversquirl/dre

GitHub

Deterministic regular expressions. Contribute to silversquirl/dre development by creating an account on GitHub.

strong pelican
#

Cool! That's a nice readme, adds some generally educational info in addition to usage instructions. Also nice to have another Zig package in the wild which is both a dependency and has dependencies, gotta put that new system to work :)

cursive plume
#

Yeah! I've been enjoying using the new package manager, it's been a good experience so far!

ornate sedge
#

One thing I've noticed with the package manager, is that there's a lot of name repetition in the common case.

In this example, it's zacc zacc zacc zacc in the build file and dre dre dre at the use site. I imagine this could get noisy when there's a bunch of deps/modules.

Would some sort of convenience wrapper for this common idiom be worthwhile? 🤔

cursive plume
#

It is quite repetitive yeah, particularly when you're using the same module in multiple places (eg. as a module dependency and in a test step)

#

I'm not sure if it's verbose enough to warrant a helper function though

#

Because it would basically just be exe.addModule(name, b.dependency(name, opts).module(name) -> exe.addModule(name, b.depModule(name, opts)) which isn't really that much shorter

ornate sedge
#

Yeah, not sure what can be done