Second complete turnaround of the day.

Changed the process of defining a grammar in code, now a ruleset is a dictionary instead of a tree.