https://drive.google.com/file/d/0B0yPt9F6jiAbc3Q3M2tEclZ4MWs/edit?usp=sharing
I changed the way that rules are parsed and applied, and got all of the unit tests working. Right now, you should be able to do metathesis like
CN > $2$1
in order to reverse the order of two segments. You can also do longer-distance things like
CVN > $3V$1
which will swap
C and
N but leave
V; the statement
CVN > $3$2$1 is equivalent in this case. Just remember that the index number after the
$ sign counts every variable, and starts at 1.
It should be fairly easy to add further functionality so that
CN > $2$G1
will be possible, so that you can (in this case) do metathesis
and change voice at the same time, provided of course that
G and
C have the same number of elements.