This problem was "fixed" by using a hashmap to store keywords as described in the "definitive antlr 4 reference book" section 10.3. However, I am now getting a "code too large" in the parser (http://www.antlr.org/pipermail/antlr-interest/2012-November/045698.html).