
A Regular Expression Matcher (2007) - sagargv
http://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html
======
colanderman
"[star] matches zero or more occurrences of the previous character"

…those aren't regular expressions. Those are fancy globs. Regular expressions
have a formal definition that is strictly more expressive than that.

They mention they use recursion (which you can use to _actually_ implement
regular expressions, albeit poorly) but…

…they use the recursion as a way of implementing a _state machine_ in _C_? You
can get away with this (and it's somewhat common) in a language like Lisp or
ML that guarantees tail-call optimization, but this is poor form _at best_ in
C, where some compilers are unable to optimize tail calls, and you will blow
your stack with long-lived state machines. Code recursion is really only
appropriate when your data structures are recursive.

This is poor pedagogy. Students internalize stuff; you can't present them
incorrect definitions and poor coding practices. C'mon guys, can't I expect
better from the _inventors of C and Unix_??

