Lexical State Analyzer

Abstract Lexical states provide a powerful mechanism to scan regular expressions in a context sensitive manner. At the same time, 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 present a context sensitive and context insensitive analysis to identify the errors and warnings. We present a comparative study of these analyses. We have implemented these analyses as a standalone tool (LSA) that can identify errors and warnings in JavaCC grammars. The LSA tool outputs a graph that depicts the grammar and the error transitions. It also generates counter example strings that can be used to establish the errors. We have used LSA to analyze a host of opensource JavaCC grammar files to good effect.


Download the jar from here. Instructions to run can be found here.