implementing the parser generator