Refactor: Allow to specify tree_class when building Grammar

selector.g no longer contains python code
Small fix to maintain compatibility with Python 3.3