Lexical state analyzer for JavaCC grammars |
| |
Authors: | Kartik Gupta V. Krishna Nandivada |
| |
Affiliation: | Dept of CSE, IIT Madras, Chennai, Tamil Nadu, India |
| |
Abstract: | Lexical states in JavaCC provide a powerful mechanism to scan regular expressions in a context sensitive manner. But lexical states also make it hard to reason about the correctness of the grammar. We first categorize the related correctness issues into two classes: errors and warnings. We then extend the traditional context sensitive and a context insensitive analysis to identify errors and warnings in context‐free grammars. We have implemented these analyses as a standalone tool (LSA ), the first of its kind, to identify errors and warnings in JavaCC grammars. The LSA tool outputs a graph that depicts the grammar and the error transitions. Importantly, it can also generate counter example strings that can be used to establish the errors. We have used LSA to analyze a host of open‐source JavaCC grammar files to good effect. Copyright © 2015 John Wiley & Sons, Ltd. |
| |
Keywords: | compilers context‐free grammar lexical states JavaCC |
|
|