The base idea of the permissive grammars project is simple: given an SDF grammar, we derive a permissive grammar [1] that also accepts programs with minor errors (missing brackets, etc.). These grammars are normal SDF grammars and can be tweaked by the language engineer. Using a specialized version of the SGLR algorithm, both syntactically correct and incorrect programs can be efficiently parsed using these grammars [1]. As a refinement of these techniques, we also use indentation to constrain the search space of error recovery suggestions and to provide better error recovery suggestions [2].
Automatic generation of permissive grammars and use of error recovery in Eclipse has been integrated to and is automatically supported in the Spoofax language workbench.
The slides of our OOPSLA 2009 presentation, explaining the core recovery mechanism, are available here: Providing Rapid Feedback in Generated Modular Language Environments.
The presentation of our followup work at SLE 2009 can be downloaded here: Natural and Flexible Error Recovery for Generated Parsers.
The test set (input files and grammars), permissive grammar derivation tool, and stand-alone recovery tool can be found at:
https://svn.strategoxt.org/repos/StrategoXT/sglr-recovery/trunk
The implementation of JSGLR has been adapted to include the error recovery algorithm:
https://svn.strategoxt.org/repos/StrategoXT/spoofax/trunk
The components above are applied in the Spoofax/IMP editor trunk series at:
https://svn.strategoxt.org/repos/StrategoXT/spoofax-imp/trunk
We generated a number of grammars for languages including Java, Stratego, and Stratego-Java. These grammars can be downloaded from this page:
The Java test set can also be found here:
Please send questions or feedback to the users@strategoxt.org mailing list or directly to the authors (listed above). We'd be interested in any form of feedback or discussing ideas of applying these techniques in a different context. Also, the developers are usually available on IRC at #spoofax on freenode.net (web version). Feel free to drop by!