refactoring Lexer and Parser