Implement re1 parsing.

It builds automata, but the automata themselves are completely untested.
Just the parsing is tested—and not well at that.