parser refactored to use lexer