Term rewriting algebra system in C#