Refactoring Grammar Trait, moved grammar definition into json format