Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Abstracting definitional interpreters (functional pearl)

Published: 29 August 2017 Publication History

Abstract

In this functional pearl, we examine the use of definitional interpreters as a basis for abstract interpretation of higher-order programming languages. As it turns out, definitional interpreters, especially those written in monadic style, can provide a nice basis for a wide variety of collecting semantics, abstract interpretations, symbolic executions, and their intermixings.
But the real insight of this story is a replaying of an insight from Reynold's landmark paper, Definitional Interpreters for Higher-Order Programming Languages, in which he observes definitional interpreters enable the defined-language to inherit properties of the defining-language. We show the same holds true for definitional abstract interpreters. Remarkably, we observe that abstract definitional interpreters can inherit the so-called “pushdown control flow” property, wherein function calls and returns are precisely matched in the abstract semantics, simply by virtue of the function call mechanism of the defining-language.
The first approaches to achieve this property for higher-order languages appeared within the last ten years, and have since been the subject of many papers. These approaches start from a state-machine semantics and uniformly involve significant technical engineering to recover the precision of pushdown control flow. In contrast, starting from a definitional interpreter, the pushdown control flow property is inherent in the meta-language and requires no further technical mechanism to achieve.

Supplementary Material

Auxiliary Archive (icfp17-main114-s.zip)
This reusable artifact is an open-format virtual machine containing the Abstracting Definitional Interpreters framework, implementations, tests, and paper. See the included README for full instructions. To build the library, run the unit tests, and compile/execute the paper as a literate racket program, just boot the virtual machine and run the following commands: $ cd ~/monadic-eval $ make $ make test $ make pdf

References

[1]
Mads S. Ager, Olivier Danvy, and Jan Midtgaard. A functional correspondence between monadic evaluators and abstract machines for languages with computational effects. Theoretical Computer Science, 2005.
[2]
Roland N Bol and Lars Degerstedt. Tabulated Resolution for Well Founded Semantics. In Proc. ILPS, 1993.
[3]
Weidong Chen and David S Warren. Tabled evaluation with delaying for general logic programs. Journal of the ACM (JACM) 43(1), pp. 20–74, 1996.
[4]
David Darais, Matthew Might, and David Van Horn. Galois Transformers and Modular Abstract Interpreters: Reusable Metatheory for Program Analysis. In Proc. Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, 2015.
[5]
Steven Dawson, C. R. Ramakrishnan, and David S. Warren. Practical Program Analysis Using General Purpose Logic Programming Systems—a Case Study. In Proc. Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation, 1996.
[6]
Christopher Earl. Introspective Pushdown Analysis and Nebo. PhD dissertation, University of Utah, 2014.
[7]
Christopher Earl, Matthew Might, and David Van Horn. Pushdown control-flow analysis of higher-order programs. In Proc. Workshop on Scheme and Functional Programming, 2010.
[8]
Christopher Earl, Ilya Sergey, Matthew Might, and David Van Horn. Introspective pushdown analysis of higher-order programs. In Proc. Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, 2012.
[9]
Sebastian Fischer, Oleg Kiselyov, and Chung-chieh Shan. Purely functional lazy nondeterministic programming. Journal of Functional Programming 21(4-5), pp. 413–465, 2011.
[10]
Matthew Flatt and Matthias Felleisen. Units: Cool Modules for HOT Languages. In Proc. Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation, 1998.
[11]
Matthew Flatt and PLT. Reference: Racket. PLT Inc., 2010.
[12]
Daniel P. Friedman and Anurag Medhekar. Tutorial: Using an Abstracted Interpreter to Understand Abstract Interpretation, Course notes for CSCI B621, Indiana University. 2003.
[13]
Thomas Gilray, Steven Lyde, Michael D. Adams, Matthew Might, and David Van Horn. Pushdown Controlflow Analysis for Free. In Proc. Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 2016.
[14]
Robert Glück. Simulation of Two-Way Pushdown Automata Revisited. In Proc. Semantics, Abstract Interpretation, and Reasoning about Programs: Essays Dedicated to David A. Schmidt on the Occasion of his Sixtieth Birthday, Manhattan, Kansas, USA, 19-20th September 2013, 2013.
[15]
Ralf Hinze. Deriving Backtracking Monad Transformers. In Proc. Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, 2000.
[16]
Suresh Jagannathan, Peter Thiemann, Stephen Weeks, and Andrew Wright. Single and loving it: must-alias analysis for higher-order languages. In Proc. POPL ’98: Proceedings of the 25th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1998.
[17]
Suresh Jagannathan and Stephen Weeks. A unified treatment of flow analysis in higher-order languages. In Proc. POPL ’95: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1995.
[18]
Gerda Janssens and Konstantinos F Sagonas. On the Use of Tabling for Abstract Interpretation: An Experiment with Abstract Equation Systems. In Proc. TAPD, 1998.
[19]
Mauro Javier Jaskelioff. Lifting of operations in modular monadic semantics. PhD dissertation, University of Nottingham, 2009.
[20]
J. Ian Johnson, Ilya Sergey, Christopher Earl, Matthew Might, and David Van Horn. Pushdown flow analysis with abstract garbage collection. Journal of Functional Programming, 2014.
[21]
J. Ian Johnson and David Van Horn. Abstracting Abstract Control. In Proc. Proceedings of the 10th ACM Symposium on Dynamic Languages, 2014.
[22]
Neil D. Jones and Flemming Nielson. Abstract Interpretation: A Semantics-based Tool for Program Analysis. In Proc. Handbook of Logic in Computer Science (Vol. 4), 1995.
[23]
James C. King. Symbolic Execution and Program Testing. Commun. ACM, 1976.
[24]
Oleg Kiselyov. Typed tagless final interpreters. In Proc. Generic and Indexed Programming, 2012.
[25]
Oleg Kiselyov, Chung-chieh Shan, Daniel P. Friedman, and Amr Sabry. Backtracking, Interleaving, and Terminating Monad Transformers: (Functional Pearl). In Proc. Proceedings of the Tenth ACM SIGPLAN International Conference on Functional Programming, 2005.
[26]
Sheng Liang, Paul Hudak, and Mark Jones. Monad Transformers and Modular Interpreters. In Proc. Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1995.
[27]
Jan Midtgaard. Control-flow Analysis of Functional Programs. ACM Comput. Surv., 2012.
[28]
Jan Midtgaard and Thomas Jensen. A Calculational Approach to Control-FlowAnalysis by Abstract Interpretation. In Proc. Static Analysis Symposium, 2008.
[29]
Jan Midtgaard and Thomas P. Jensen. Control-flow Analysis of Function Calls and Returns by Abstract Interpretation. In Proc. ICFP ’09: Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, 2009.
[30]
Matthew Might. Environment analysis of higher-order languages. PhD dissertation, Georgia Institute of Technology, 2007a.
[31]
Matthew Might. Logic-flow Analysis of Higher-order Programs. In Proc. Proceedings of the 34th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 2007b.
[32]
Matthew Might and Olin Shivers. Environment analysis via ∆-CFA. In Proc. POPL ’06: Conference record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 2006a.
[33]
Matthew Might and Olin Shivers. Improving Flow Analyses via ΓCFA: Abstract Garbage Collection and Counting. In Proc. ICFP’06, 2006b.
[34]
Matthew Might and David Van Horn. A Family of Abstract Interpretations for Static Analysis of Concurrent Higher-OrderPrograms. In Proc. Static Analysis, 2011.
[35]
Eugenio Moggi. An Abstract View of Programming Languages. Edinburgh University, 1989.
[36]
Greg Morrisett, Matthias Felleisen, and Robert Harper. Abstract Models of Memory Management. In Proc. Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture, 1995.
[37]
Phúc C. Nguyễn, Sam Tobin-Hochstadt, and David Van Horn. Soft Contract Verification. In Proc. Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, 2014.
[38]
Phúc C. Nguyễn and David Van Horn. Relatively Complete Counterexamples for Higher-order Programs. In Proc. Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, 2015.
[39]
Flemming Nielson, Hanne R. Nielson, and Chris Hankin. Principles of Program Analysis. 1999.
[40]
Atze van der Ploeg and Oleg Kiselyov. Reflection without remorse: revealing a hidden sequence to speed up monadic reflection. In Proc. Proceedings of the 2014 ACM SIGPLAN Symposium on Haskell, 2014.
[41]
John C. Reynolds. Definitional interpreters for higher-order programming languages. In Proc. ACM ’72: Proceedings of the ACM Annual Conference, 1972.
[42]
Ilya Sergey, Dominique Devriese, Matthew Might, Jan Midtgaard, David Darais, Dave Clarke, and Frank Piessens. Monadic Abstract Interpreters. In Proc. Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation, 2013.
[43]
Olin Shivers. Control-flow analysis of higher-order languages. PhD dissertation, Carnegie Mellon University, 1991.
[44]
Guy L. Steele Jr. Building Interpreters by Composing Monads. In Proc. Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 1994.
[45]
Terrance Swift and David S Warren. XSB: Extending Prolog with tabled logic programming. Theory and Practice of Logic Programming 12(1-2), pp. 157–187, 2012.
[46]
Hisao Tamaki and Taisuke Sato. OLD resolution with tabulation. In Proc. International Conference on Logic Programming, 1986.
[47]
Sam Tobin-Hochstadt, Vincent St-Amour, Ryan Culpepper, Matthew Flatt, and Matthias Felleisen. Languages As Libraries. In Proc. Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, 2011.
[48]
Sam Tobin-Hochstadt and David Van Horn. Higher-order symbolic execution via contracts. In Proc. Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, 2012.
[49]
David Van Horn and Matthew Might. Abstracting Abstract Machines. In Proc. Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming, 2010.
[50]
David Van Horn and Matthew Might. Systematic abstraction of abstract machines. Journal of Functional Programming, 2012.
[51]
Alexander Vandenbroucke, Tom Schrijvers, and Frank Piessens. Fixing non-determinism. In Proc. IFL 2015: Symposium on the implementation and application of functional programming languages Proceedings, 2016.
[52]
Dimitrios Vardoulakis. CFA2: Pushdown Flow Analysis for Higher-Order Languages. PhD dissertation, Northeastern University, 2012.
[53]
Dimitrios Vardoulakis and Olin Shivers. CFA2: a Context-FreeApproach to Control-FlowAnalysis. Logical Methods in Computer Science, 2011.
[54]
Andrew K. Wright and Suresh Jagannathan. Polymorphic splitting: an effective polyvariant flow analysis. ACM Trans. Program. Lang. Syst., 1998.

Cited By

View all
  • (2024)Abstract Interpretation of Java Bytecode in SturdyProceedings of the 26th ACM International Workshop on Formal Techniques for Java-like Programs10.1145/3678721.3686226(17-22)Online publication date: 20-Sep-2024
  • (2024)Abstract Interpreters: A Monadic Approach to Modular VerificationProceedings of the ACM on Programming Languages10.1145/36746468:ICFP(602-629)Online publication date: 15-Aug-2024
  • (2024)Compiling with Abstract InterpretationProceedings of the ACM on Programming Languages10.1145/36563928:PLDI(368-393)Online publication date: 20-Jun-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 1, Issue ICFP
September 2017
1173 pages
EISSN:2475-1421
DOI:10.1145/3136534
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 29 August 2017
Published in PACMPL Volume 1, Issue ICFP

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. abstract interpreters
  2. interpreters

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)257
  • Downloads (Last 6 weeks)47
Reflects downloads up to 04 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Abstract Interpretation of Java Bytecode in SturdyProceedings of the 26th ACM International Workshop on Formal Techniques for Java-like Programs10.1145/3678721.3686226(17-22)Online publication date: 20-Sep-2024
  • (2024)Abstract Interpreters: A Monadic Approach to Modular VerificationProceedings of the ACM on Programming Languages10.1145/36746468:ICFP(602-629)Online publication date: 15-Aug-2024
  • (2024)Compiling with Abstract InterpretationProceedings of the ACM on Programming Languages10.1145/36563928:PLDI(368-393)Online publication date: 20-Jun-2024
  • (2024)A Pure Demand Operational Semantics with Applications to Program AnalysisProceedings of the ACM on Programming Languages10.1145/36498528:OOPSLA1(1154-1180)Online publication date: 29-Apr-2024
  • (2024)Interactive Abstract Interpretation with Demanded SummarizationACM Transactions on Programming Languages and Systems10.1145/364844146:1(1-40)Online publication date: 15-Feb-2024
  • (2024)Detection of Uncaught Exceptions in Functional Programs by Abstract InterpretationProgramming Languages and Systems10.1007/978-3-031-57267-8_15(391-420)Online publication date: 6-Apr-2024
  • (2023)Cross-Level Debugging for Static AnalysersProceedings of the 16th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3623476.3623512(138-148)Online publication date: 23-Oct-2023
  • (2023)Initializing Global Objects: Time and OrderProceedings of the ACM on Programming Languages10.1145/36228447:OOPSLA2(1310-1337)Online publication date: 16-Oct-2023
  • (2023)Combinator-Based Fixpoint Algorithms for Big-Step Abstract InterpretersProceedings of the ACM on Programming Languages10.1145/36078637:ICFP(955-981)Online publication date: 31-Aug-2023
  • (2023)Grisette: Symbolic Compilation as a Functional Programming LibraryProceedings of the ACM on Programming Languages10.1145/35712097:POPL(455-487)Online publication date: 11-Jan-2023
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media