lawrancej / CompilerKit

Compiler construction library in C.
GNU Lesser General Public License v2.1
55 stars 33 forks source link

Derivative parser for regular expressions #25

Closed lawrancej closed 12 years ago

lawrancej commented 12 years ago

Write a function that takes in a regular expression and a character, and produces a new regular expression, called the derivative, as described in http://matt.might.net/articles/parsing-with-derivatives/ and http://matt.might.net/papers/might2011derivatives.pdf. The function will use the visitor class (see examples/visitor-demo.c for an idea).

GObject *compilerkit_derivative_parser(GObject *regex, gunichar symbol)

lawrancej commented 12 years ago

Here's an example of this in Java.

https://github.com/lawrancej/CompilerKitJava/blob/master/CompilerKit/src/com/joeylawrance/language/RegularDerivativeVisitor.java