skip to main content
research-article

Computing repair alternatives for malformed programs using constraint attribute grammars

Published:19 October 2016Publication History
Skip Abstract Section

Abstract

Attribute grammars decorate the nodes of a program's parse tree with attributes whose values are defined by equations encoding the (static) semantics of a programming language. We show how replacing the equations of an attribute grammar with equivalent constraints that can be solved by a constraint solver allows us to compute repairs of a malformed program solely from a specification that was originally designed for checking its well-formedness. We present two repair modes --- shallow and deep fixing --- whose computed repair alternatives are guaranteed to repair every error on which they are invoked. While shallow fixing may introduce new errors, deep fixing never does; to make it tractable, we implement it using neighborhood search. We demonstrate the feasibility of our approach by implementing it on top of ExtendJ, an attribute grammar based Java compiler, and by applying it to an example from the Java EE context, detecting and fixing well-formedness errors (both real and injected) in a body of 14 open-source subject programs.

References

  1. J. T. Boyland. Remote attribute grammars. J. ACM, 52(4): 627–687, 2005. doi: 10.1145/1082036.1082042. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Y. Brun, R. Holmes, M. D. Ernst, and D. Notkin. Speculative analysis: exploring future development states of software. In Proceedings of the Workshop on Future of Software Engineering Research, FoSER 2010, at the 18th ACM SIGSOFT International Symposium on Foundations of Software Engineering, 2010, Santa Fe, NM, USA, November 7-11, 2010, pages 59–64, 2010. doi: 10.1145/1882362.1882375. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. F. Demarco, J. Xuan, D. L. Berre, and M. Monperrus. Automatic repair of buggy if conditions and missing preconditions with SMT. In Proceedings of the 6th International Workshop on Constraints in Software Testing, Verification, and Analysis, CSTVA 2014, Hyderabad, India, May 31, 2014, pages 30–39, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. P. Deransart and J. Maluszynski. Relating logic programs and attribute grammars. J. Log. Program., 2(2):119–155, 1985. doi: 10.1016/0743-1066(85)90015-9.Google ScholarGoogle ScholarCross RefCross Ref
  5. W. Dietl, S. Dietzel, M. D. Ernst, K. Muslu, and T. W. Schiller. Building and using pluggable type-checkers. In Proceedings of the 33rd International Conference on Software Engineering, ICSE 2011, Waikiki, Honolulu, HI, USA, May 21-28, 2011, pages 681–690, 2011. doi: 10.1145/1985793.1985889. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. A. Egyed, E. Letier, and A. Finkelstein. Generating and evaluating choices for fixing inconsistencies in UML design models. In 23rd IEEE/ACM International Conference on Automated Software Engineering (ASE 2008), 15-19 September 2008, L’Aquila, Italy, pages 99–108, 2008. doi: 10.1109/ASE. 2008.20. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. T. Ekman and G. Hedin. The JastAdd extensible Java compiler. In Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2007, October 21-25, 2007, Montreal, Quebec, Canada, pages 1–18, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. S. Erdweg, T. van der Storm, M. Völter, L. Tratt, R. Bosman, W. R. Cook, A. Gerritsen, A. Hulshout, S. Kelly, A. Loh, G. D. P. Konat, P. J. Molina, M. Palatnik, R. Pohjonen, E. Schindler, K. Schindler, R. Solmi, V. A. Vergu, E. Visser, K. van der Vlist, G. Wachsmuth, and J. van der Woning. Evaluating and comparing language workbenches: Existing results and benchmarks for the future. Computer Languages, Systems & Structures, 44:24–47, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. Fowler. Domain-Specific Languages. The Addison-Wesley signature series. Addison-Wesley, 2011. ISBN 978-0-321- 71294-3.Google ScholarGoogle Scholar
  10. E. C. Freuder and A. K. Mackworth, editors. Constraint-Based Reasoning. The MIT Press, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. D. Gopinath, M. Z. Malik, and S. Khurshid. Specificationbased program repair using SAT. In Tools and Algorithms for the Construction and Analysis of Systems - 17th International Conference, TACAS 2011, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2011, Saarbrücken, Germany, March 26-April 3, 2011. Proceedings, pages 173–188, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. Gosling. Algebraic Constraints. PhD thesis, Department of Computer Science, Carngeie-Mellon University, 1983. CMUCS-83-132. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. G. Gottlob, G. Greco, and T. Mancini. Conditional constraint satisfaction: Logical foundations and complexity. In IJCAI 2007, Proceedings of the 20th International Joint Conference on Artificial Intelligence, Hyderabad, India, January 6-12, 2007, pages 88–93, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. G. Hedin. Reference attributed grammars. Informatica (Slovenia), 24(3), 2000.Google ScholarGoogle Scholar
  15. G. Hedin and E. Magnusson. Jastadd–an aspect-oriented compiler construction system. Sci. Comput. Program., 47 (1):37–58, 2003. doi: 10.1016/S0167-6423(02)00109-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. P. V. Hentenryck and L. Michel. Constraint-based local search. MIT Press, 2005. ISBN 978-0-262-22077-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. T. Hottelier and R. Bodík. Synthesis of layout engines from relational constraints. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2015, part of SLASH 2015, Pittsburgh, PA, USA, October 25-30, 2015, pages 74–88, 2015. doi: 10.1145/2814270.2814291. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Jourdan. An optimal-time recursive evaluator for attribute grammars. In International Symposium on Programming, 6th Colloquium, Toulouse, April 17-19, 1984, Proceedings, pages 167–178, 1984. doi: 10.1007/3-540-12925-1_37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. E. Knuth. Semantics of context-free languages. Mathematical Systems Theory, 2(2):127–145, 1968. doi: 10.1007/ BF01692511.Google ScholarGoogle ScholarCross RefCross Ref
  20. Linda DeMichiel. JSR 317: Java Persistence API, Version 2.0. JSR Specification, online at https://jcp.org/en/jsr/detail?id=317.Google ScholarGoogle Scholar
  21. S. Markstrum, D. Marino, M. Esquivel, T. D. Millstein, C. Andreae, and J. Noble. Javacop: Declarative pluggable types for java. ACM Trans. Program. Lang. Syst., 32(2), 2010. doi: 10.1145/1667048.1667049. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. K. Muslu, Y. Brun, R. Holmes, M. D. Ernst, and D. Notkin. Speculative analysis of integrated development environment recommendations. In Proceedings of the 27th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2012, part of SPLASH 2012, Tucson, AZ, USA, October 21-25, 2012, pages 669–682, 2012. doi: 10.1145/2384616.2384665. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. C. Nentwich, W. Emmerich, and A. Finkelstein. Consistency management with repair actions. In Proceedings of the 25th International Conference on Software Engineering, May 3-10, 2003, Portland, Oregon, USA, pages 455–464, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. H. D. T. Nguyen, D. Qi, A. Roychoudhury, and S. Chandra. Semfix: program repair via semantic analysis. In 35th International Conference on Software Engineering, ICSE ’13, San Francisco, CA, USA, May 18-26, 2013, pages 772–781, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. J. Palsberg and M. I. Schwartzbach. Object-oriented type systems. Wiley professional computing. Wiley, 1994. ISBN 978-0-471-94128-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. A. Reder and A. Egyed. Computing repair trees for resolving inconsistencies in design models. In IEEE/ACM International Conference on Automated Software Engineering, ASE’12, Essen, Germany, September 3-7, 2012, pages 220–229, 2012. doi: 10.1145/2351676.2351707. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. H. Samimi, M. Schäfer, S. Artzi, T. D. Millstein, F. Tip, and L. J. Hendren. Automated repair of HTML generation errors in PHP applications using string constraint solving. In 34th International Conference on Software Engineering, ICSE 2012, June 2-9, 2012, Zurich, Switzerland, pages 277–287, 2012. doi: 10.1109/ICSE.2012.6227186. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. M. Schäfer, A. Thies, F. Steimann, and F. Tip. A comprehensive approach to naming and accessibility in refactoring Java programs. IEEE Trans. Software Eng., 38(6):1233–1257, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. doi: 10.1109/TSE.2012.13.Google ScholarGoogle Scholar
  30. F. Steimann. From well-formedness to meaning preservation: model refactoring for almost free. Software and System Modeling, 14(1):307–320, 2015. doi: 10.1007/s10270-013-0314-z. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. F. Steimann. Refactoring and beyond. In R. Lämmel, J. Saraiva, and J. Visser, editors, Grand and Timely Topics in Software Engineering V, International Summer School, GTTSE 2015, Braga, Portugal, July, 2015. Revised Papers, Lecture Notes in Computer Science. Springer, 2017. In preparation.Google ScholarGoogle Scholar
  32. F. Steimann and B. Ulke. Generic model assist. In Model-Driven Engineering Languages and Systems - 16th International Conference, MODELS 2013, Miami, FL, USA, September 29 - October 4, 2013. Proceedings, pages 18–34, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. doi: 10.1007/978-3-642-41533-3_2.Google ScholarGoogle Scholar
  34. F. Steimann and J. von Pilgrim. Constraint-based refactoring with foresight. In ECOOP 2012 - Object-Oriented Programming - 26th European Conference, Beijing, China, June 11-16, 2012. Proceedings, pages 535–559, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. F. Steimann, C. Kollee, and J. von Pilgrim. A refactoring constraint language and its application to Eiffel. In ECOOP 2011 - Object-Oriented Programming - 25th European Conference, Lancaster, UK, July 25-29, 2011 Proceedings, pages 255–280, 2011. doi: 10.1007/978-3-642-22655-7_13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. F. Tip, R. M. Fuhrer, A. Kiezun, M. D. Ernst, I. Balaban, and B. D. Sutter. Refactoring using type constraints. ACM Trans. Program. Lang. Syst., 33(3):9, 2011. doi: 10.1145/1961204. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. 1961205.Google ScholarGoogle Scholar
  38. B. Ulke and F. Steimann. OCL as a constraint generation language. In Proceedings of the MODELS 2013 OCL Workshop co-located with the 16th International ACM/IEEE Conference on Model Driven Engineering Languages and Systems (MODELS 2013), Miami, USA, September 30, 2013.Google ScholarGoogle Scholar
  39. , pages 93–102, 2013.Google ScholarGoogle Scholar
  40. H. van Antwerpen, P. Neron, A. P. Tolmach, E. Visser, and G. Wachsmuth. A constraint language for static semantic analysis based on scope graphs. In Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation, PEPM 2016, St. Petersburg, FL, USA, January 20 - 22, 2016, pages 49–60, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. W. M. Waite and G. Goos. Compiler Construction. Texts and Monographs in Computer Science. Springer, 1984. ISBN 978-1-4612-9731-4. doi: 10.1007/978-1-4612-5192-7. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. D. A. Watt and O. L. Madsen. Extended attribute grammars. The Computer Journal, 26(2):142–153, 1983.Google ScholarGoogle ScholarCross RefCross Ref
  43. B. T. V. Zanden. Constraint grammars-a new model for specifying graphical applications. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, CHI 1989, Austin, Texas, USA, April 30 - June 4, 1989, pages 325–330, 1989. doi: 10.1145/67449.67513. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. B. T. V. Zanden, B. A. Myers, D. A. Giuse, and P. A. Szekely. Integrating pointer variables into one-way constraint models. ACM Trans. Comput.-Hum. Interact., 1(2):161–213, 1994. doi: 10.1145/180171.180174. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Computing repair alternatives for malformed programs using constraint attribute grammars

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 51, Issue 10
        OOPSLA '16
        October 2016
        915 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/3022671
        Issue’s Table of Contents
        • cover image ACM Conferences
          OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
          October 2016
          915 pages
          ISBN:9781450344449
          DOI:10.1145/2983990

        Copyright © 2016 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 19 October 2016

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!