Abstract
Abstract
The syntax of almost every programming language includes a notion of binder and corresponding bound occurrences, along with the accompanying notions of α-equivalence, capture-avoiding substitution, typing contexts, runtime environments, and so on. In the past, implementing and reasoning about programming languages required careful handling to maintain the correct behaviour of bound variables. Modern programming languages include features that enable constraints like scope safety to be expressed in types. Nevertheless, the programmer is still forced to write the same boilerplate over again for each new implementation of a scope-safe operation (e.g., renaming, substitution, desugaring, printing), and then again for correctness proofs. We present an expressive universe of syntaxes with binding and demonstrate how to (1) implement scope-safe traversals once and for all by generic programming; and (2) how to derive properties of these traversals by generic proving. Our universe description, generic traversals and proofs, and our examples have all been formalised in Agda and are available in the accompanying material available online at https://github.com/gallais/generic-syntax.
Publisher
Cambridge University Press (CUP)
Reference94 articles.
1. Substitution: A formal methods case study using monads and transformations
2. Dagand, P. (2013) A cosmology of datatypes : reusability and dependent types. Ph.D. thesis. University of Strathclyde, Glasgow, UK.
3. Building domain-specific embedded languages
4. Relative monads formalised;Altenkirch;Journal of Formalized Reasoning.,2014
5. Keuchel, S. (2011 ) Generic Programming With Binders and Scope. Master’s thesis. Utrecht University.
Cited by
7 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Scoped and Typed Staging by Evaluation;Proceedings of the 2024 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation;2024-01-11
2. A Formal Treatment of Bidirectional Typing;Lecture Notes in Computer Science;2024
3. Semantic analysis of normalisation by evaluation for typed lambda calculus;Mathematical Structures in Computer Science;2022-09
4. Datatype-generic programming meets elaborator reflection;Proceedings of the ACM on Programming Languages;2022-08-29
5. Formal metatheory of second-order abstract syntax;Proceedings of the ACM on Programming Languages;2022-01-12