A generalized LR(1) parser for extended context-free grammars