A simple context-free grammar implementation