A constraint language for static semantic analysis based on scope graphs

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.

[1]  Danfeng Zhang,et al.  Toward general diagnosis of static errors , 2014, POPL.

[2]  Eelco Visser,et al.  A Language Independent Task Engine for Incremental Name and Type Analysis , 2013, SLE.

[3]  Jens Palsberg,et al.  Object-oriented type systems , 1994, Wiley professional computing.

[4]  Torbjörn Ekman,et al.  Modular Name Analysis for Java Using JastAdd , 2005, GTTSE.

[5]  Donald E. Knuth,et al.  Semantics of context-free languages , 1968, Mathematical systems theory.

[6]  Eelco Visser,et al.  The State of the Art in Language Workbenches - Conclusions from the Language Workbench Challenge , 2013, SLE.

[7]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[8]  Eelco Visser,et al.  Evaluating and comparing language workbenches: Existing results and benchmarks for the future , 2015, Comput. Lang. Syst. Struct..

[9]  Mira Mezini,et al.  A co-contextual formulation of type rules and its application to incremental type checking , 2015, OOPSLA.

[10]  Jurriaan Hage,et al.  Scripting the type inference process , 2003, ICFP '03.

[11]  Görel Hedin,et al.  Reference Attributed Grammars , 2000, Informatica.

[12]  Eelco Visser,et al.  Declarative Name Binding and Scope Rules , 2012, SLE.

[13]  Eelco Visser,et al.  A Theory of Name Resolution , 2015, ESOP.

[14]  Janusz A. Brzozowski,et al.  Derivatives of Regular Expressions , 1964, JACM.

[15]  Torbjörn Ekman,et al.  The jastadd extensible java compiler , 2007, OOPSLA.

[16]  Eelco Visser,et al.  The spoofax language workbench: rules for declarative specification of languages and IDEs , 2010, OOPSLA.

[17]  Eelco Visser,et al.  A Language Designer's Workbench: A One-Stop-Shop for Implementation and Verification of Language Designs , 2014, Onward!.

[18]  William M. Waite,et al.  An abstract data type for name analysis , 1991, Acta Informatica.

[19]  Chang Liu,et al.  Term rewriting and all that , 2000, SOEN.

[20]  Simon L. Peyton Jones,et al.  Diagnosing type errors with class , 2015, PLDI.

[21]  Jens Palsberg,et al.  Object-oriented type inference , 1991, OOPSLA '91.