skip to main content
10.1145/2847538.2847543acmconferencesArticle/Chapter ViewAbstractPublication PagespepmConference Proceedingsconference-collections
research-article
Open Access

A constraint language for static semantic analysis based on scope graphs

Published:11 January 2016Publication History

ABSTRACT

In previous work, we introduced scope graphs as a formalism for describing program binding structure and performing name resolution in an AST-independent way. In this paper, we show how to use scope graphs to build static semantic analyzers. We use constraints extracted from the AST to specify facts about binding, typing, and initialization. We treat name and type resolution as separate building blocks, but our approach can handle language constructs---such as record field access---for which binding and typing are mutually dependent. We also refine and extend our previous scope graph theory to address practical concerns including ambiguity checking and support for a wider range of scope relationships. We describe the details of constraint generation for a model language that illustrates many of the interesting static analysis issues associated with modules and records.

References

  1. F. Baader and T. Nipkow. Term rewriting and all that. Cambridge University Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. J. A. Brzozowski. Derivatives of regular expressions. JACM, 11(4):481–494, 1964. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. T. Ekman and G. Hedin. Modular name analysis for Java using JastAdd. In GTTSE, pages 422–436, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. T. Ekman and G. Hedin. The JastAdd extensible Java compiler. In OOPSLA, pages 1–18, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Erdweg, O. Bracevac, E. Kuci, M. Krebs, and M. Mezini. A cocontextual formulation of type rules and its application to incremental type checking. In OOPSLA, pages 880–897, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Erdweg, T. van der Storm, M. Völter, L. Tratt, et al. 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
  7. G. Hedin. Reference attributed grammars. informaticaSI, 24(3), 2000.Google ScholarGoogle Scholar
  8. B. Heeren, J. Hage, and S. D. Swierstra. Scripting the type inference process. In ICFP, pages 3–13, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. U. Kastens and W. M. Waite. An abstract data type for name analysis. ACTA, 28(6):539–558, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. L. C. L. Kats and E. Visser. The Spoofax language workbench: rules for declarative specification of languages and IDEs. In OOPSLA, pages 444–463, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. D. E. Knuth. Semantics of context-free languages. mst, 2(2):127–145, 1968.Google ScholarGoogle Scholar
  12. G. D. P. Konat, L. C. L. Kats, G. Wachsmuth, and E. Visser. Declarative name binding and scope rules. In SLE, pages 311–331, 2012.Google ScholarGoogle Scholar
  13. R. Milner. A theory of type polymorphism in programming. jcss, 17(3):348–375, 1978.Google ScholarGoogle Scholar
  14. P. Neron, A. P. Tolmach, E. Visser, and G. Wachsmuth. A theory of name resolution. In ESOP, pages 205–231, 2015.Google ScholarGoogle ScholarCross RefCross Ref
  15. J. Palsberg and M. I. Schwartzbach. Object-oriented type inference. In OOPSLA, pages 146–161, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Palsberg and M. I. Schwartzbach. Object-oriented type systems. Wiley professional computing. Wiley, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. H. van Antwerpen, P. Neron, A. P. Tolmach, E. Visser, and G. Wachsmuth. A constraint language for static semantic analysis based on scope graphs with proofs. Technical Report TUD-SERG-2015-012, Software Engineering Research Group, Delft University of Technology, 2015. Available at http://swerl.tudelft.nl/twiki/pub/ Main/TechnicalReports/TUD-SERG-2015-012.pdf.Google ScholarGoogle Scholar
  18. E. Visser, G. Wachsmuth, A. P. Tolmach, P. Neron, V. A. Vergu, A. Passalaqua, and G. D. P. Konat. A language designer’s workbench: A one-stop-shop for implementation and verification of language designs. In OOPSLA, pages 95–111, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. G. Wachsmuth, G. D. P. Konat, V. A. Vergu, D. M. Groenewegen, and E. Visser. A language independent task engine for incremental name and type analysis. In SLE, pages 260–280, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  20. D. Zhang and A. C. Myers. Toward general diagnosis of static errors. In POPL, pages 569–582, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. D. Zhang, A. C. Myers, D. Vytiniotis, and S. L. P. Jones. Diagnosing type errors with class. In PLDI, pages 12–21, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A constraint language for static semantic analysis based on scope graphs

                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
                • Published in

                  cover image ACM Conferences
                  PEPM '16: Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation
                  January 2016
                  108 pages
                  ISBN:9781450340977
                  DOI:10.1145/2847538

                  Copyright © 2016 Owner/Author

                  Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 11 January 2016

                  Check for updates

                  Qualifiers

                  • research-article

                  Acceptance Rates

                  Overall Acceptance Rate66of120submissions,55%

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader