Implemented context-free grammar.