Rewrite

Write the rules. The machine does the rest.

Rules

Read top to bottom. The first rule that matches wins.

Machine

Step log

    Tests