Sebastian Erdweg, Vlad A. Vergu, Mira Mezini, Eelco Visser. Finding bugs in program generators by dynamic analysis of syntactic language constraints. In Walter Binder, Erik Ernst, Achille Peternier, Robert Hirschfeld, editors, 13th International Conference on Modularity, MODULARITY '14, Lugano, Switzerland, April 22-26, 2014. pages 17-20, ACM, 2014.
Program generators and transformations are hard to implement correctly, because the implementation needs to generically describe how to construct programs, for example, using templates or rewrite rules. We apply dynamic analysis to program generators in order to support developers in finding bugs and identifying the source of the bug. Our analysis focuses on syntactic language constraints and checks that generated programs are syntactically well-formed. To retain a language’s grammar as the unique specification of the language’s syntax, we devised mechanisms to derive the analysis from the grammar. Moreover, we designed a run-time system to support the modular activation/deactivation of the analysis, so that generators do not require adaption. We have implemented the analysis for the Stratego term-rewriting language and applied it in case studies based on Spoofax and SugarJ.