GitXplorerGitXplorer
j

dr

public
1 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
c83b6a721ef5bd74911991b8a7823145dea6832a

check any's type

jjakebailey committed 8 years ago
Unverified
654e8f45dcbd7bc80395b983c1584800c9b64a56

rename function to be more clear

jjakebailey committed 8 years ago
Unverified
6f48377b121c7548f13984031cfaeefe3cb62a9a

fix typo in grammar

jjakebailey committed 8 years ago
Unverified
e1860a32f7ee33b944579889092cf3542b52ebb4

fix exported var, mention escaping

jjakebailey committed 8 years ago
Unverified
90ce5a288161be0dcf7a121b268e1f19ba38a5f7

fix copy/paste error

jjakebailey committed 8 years ago
Unverified
0fd5308e285236e5e14ad4b964deffbf34f67e97

syntax

jjakebailey committed 8 years ago

README

The README file for this repository.

dr

ERE derivative-based regex engine

GoDoc

This is based on the derivative-based membership checking from CS 598 GR, aka Runtime Verification.

The implementation is relatively trivial (it's quite literally the same as the paper), so it might as well be public. The parser was the time consuming part.

"dr" comes from dR, i.e. derivative of R, because I think I'm funny.

The syntax uses ! for complement, * for the Kleene star, + for union, and . for any character.

The characters +*!\(). can be escaped by prefixing with a \.

The output of the test program in cmd/drtest is:

asdfg => asdfg
aaa+bbb => (aaa)+(bbb)
!(a)b*(cd)*e+f => (!(a)(b)*(cd)*e)+(f)
\+\++\*(\!\\) => (\+\+)+(\*\!\\)

matching against ab(c)*
: false
a: false
ab: true
abc: true
abccccc: true

Which shows the input and output after parsing and generating the regex, as well as various examples of matching a common expression.

In addition to those rules described in class, I've also added a rule for . (any), which accepts any single character, although, it could have been represented by (!a+a).