Static ambiguity detection would be an important aspect of language workbenches for textual software languages. However, the challenge is that automatic ambiguity detection in context-free grammars is undecidable in general. Sophisticated approximations and optimizations do exist, but these do not scale to grammars for so-called ``scannerless parsers'', as of yet. We extend previous work on ambiguity detection for context-free grammars to cover disambiguation techniques that are typical for scannerless parsing, such as longest match and reserved keywords. This paper contributes a new algorithm for ambiguity detection in character-level grammars, a prototype implementation of this algorithm and validation on several real grammars. The total run-time of ambiguity detection for character-level grammars for languages such as C and Java is significantly reduced, without loss of precision. The result is that efficient ambiguity detection in realistic grammars is possible and may therefore become a tool in language workbenches.

, ,
, , ,
Springer
J. Saraiva , U. Aßmann , A.M. Sloane
GrammarLab: Foundations of a Grammar Laboratory
International Conference on Software Language Engineering
Software Analysis and Transformation

Basten, B., Klint, P., & Vinju, J. (2011). Ambiguity Detection: Scaling to Scannerless. In J. Saraiva, U. Aßmann, & A. M. Sloane (Eds.), Proceedings of the Fourth International Conference on Software Language Engineering (SLE 2011). Springer.