Very basic working version.

Features quadratic worst case time complexity for rule matching!
Optimizing comes later, maybe.