Refactor parser into class
Refactor generator into class