|
ABSTRACT
Multi-stage programming languages provide a convenient notation for explicitly staging programs. Staging a definitional interpreter for a domain specific language is one way of deriving an implementation that is both readable and efficient. In an untyped setting, staging an interpreter "removes a complete layer of interpretive overhead", just like partial evaluation. In a typed setting however, Hindley-Milner type systems do not allow us to exploit typing information in the language being interpreted. In practice, this can mean a slowdown cost by a factor of three or mor.Previously, both type specialization and tag elimination were applied to this problem. In this paper we propose an alternative approach, namely, expressing the definitional interpreter in a dependently typed programming language. We report on our experience with the issues that arise in writing such an interpreter and in designing such a language. .To demonstrate the soundness of combining staging and dependent types in a general sense, we formalize our language (called Meta-D) and prove its type safety. To formalize Meta-D, we extend Shao, Saha, Trifonov and Papaspyrou's λH language to a multi-level setting. Building on λH allows us to demonstrate type safety in a setting where the type language contains all the calculus of inductive constructions, but without having to repeat the work needed for establishing the soundness of that system.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
Lennart Augustsson. Cayenne -- a language with dependent types. Available from http://www.cs.chalmers.se/~augustss/cayenne.
|
| |
2
|
Lennart Augustsson and Magnus Carlsson. An exercise in dependent types: A well-typed interpreter. In Workshop on Dependent Types in Programming, Gothenburg, 1999. Available online from www.cs.chalmers.se/~augustss/cayenne/interp.ps.
|
| |
3
|
Henk P. Barendregt. Lambda calculi with types. In S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, editors, Handbook of Logic in Computer Science. Oxford University Press, Oxford, 1991.
|
 |
4
|
|
| |
5
|
Luca Cardelli. Phase distinctions in type theory. Unpublished manuscript available online from author's homepage, 1988.
|
| |
6
|
Thierry Coquand, Bengt Nordström, Jan~M. Smith, and Bjorne von Sydow. Type theory and programming. Bulletin of the European Association for Theoretical Computer Science, 52:203--228, February 1994. Columns: Logic in Computer Science.
|
 |
7
|
|
 |
8
|
|
 |
9
|
Karl Crary , Stephanie Weirich , Greg Morrisett, Intensional polymorphism in type-erasure semantics, Proceedings of the third ACM SIGPLAN international conference on Functional programming, p.301-312, September 26-29, 1998, Baltimore, Maryland, United States
|
 |
10
|
|
| |
11
|
Peter Dybjer. Inductively defined sets in Martin-Löf's set theory. In A. Avron, R. Harper, F. Honsell, I. Mason, and G. Plotkin, editors, Workshop on General Logic, February 1987.
|
| |
12
|
Peter Dybjer. Inductive sets and families in Martin-Löf's type theory and their set-theoretic semantics. In G. Huet and G. Plotkin, editors, Preliminary Proc. of 1st Int. Workshop on Logical Frameworks, Antibes, France, 7--11 May 1990, pages 213--230. 1990. ftp://ftp.inria.fr/INRIA/Projects/coq/types/Proceedings/\\book90.ps.Z.
|
| |
13
|
|
| |
14
|
Peter Dybjer. Inductive families. Formal Aspects of Computing, 6(4):440--465, 1994.
|
| |
15
|
Peter Dybjer. A general formulation of simultaneous inductive-recursive definitions in type theory. Journal of Symbolic Logic, 65(2):525--549, 2000.
|
| |
16
|
Peter Dybjer and Anton Setzer. Finite axiomatizations of inductive and inductive-recursive definitions. In R. Backhouse and T. Sheard, editors, Informal Proc. of Workshop on Generic Programming, WGP'98, Marstrand, Sweden, 18 June 1998. Dept. of Computing Science, Chalmers Univ. of Techn., and Göteborg Univ., June 1998. Electronic version available at http://wsinwp01.win.tue.nl:1234/WGPProceedings/.
|
| |
17
|
Eduardo Giménez. A tutorial on recursive types in Coq. Technical Report TR-0221, INRIA Rocquencourt, May 1998.
|
| |
18
|
|
| |
19
|
Robert Harper, Furio Honsell, and Gordon Plotkin. A framework for defining logics. In Proceedings Symposium on Logic in Computer Science, pages 194--204, Washington, 1987. IEEE Computer Society Press. The conference was held at Cornell University, Ithaca, New York.
|
 |
20
|
|
| |
21
|
Liwen Huang and Walid Taha. A practical implementation of tag elimination. In preperation.
|
 |
22
|
|
| |
23
|
|
 |
24
|
John Hughes , Lars Pareto , Amr Sabry, Proving the correctness of reactive systems using sized types, Proceedings of the 23rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.410-423, January 21-24, 1996, St. Petersburg Beach, Florida, United States
[doi> 10.1145/237721.240882]
|
| |
25
|
|
| |
26
|
|
| |
27
|
Meta-D: A dependently typed multi-stage language. Available online from http://www.cse.ogi.edu/~pasalic/metad/, 2002.
|
| |
28
|
MetaOCaml: A compiled, type-safe multi-stage programming language. Available online from http://cs-www.cs.yale.edu/homes/taha/MetaOCaml/, 2001.
|
| |
29
|
|
| |
30
|
|
 |
31
|
|
| |
32
|
Bengt Nordström, Kent Peterson, and Jan M. Smith. Programming in Martin-Lof's Type Theory, volume 7 of International Series of Monographs on Computer Science. Oxford University Press, New York, NY, 1990. Currently available online from first authors homepage.
|
| |
33
|
Oregon Graduate Institute Technical Reports. P.O. Box 91000, Portland, OR 97291-1000,USA. Available online from ftp://cse.ogi.edu/pub/tech-reports/README.html.
|
| |
34
|
Christine Paulin-Mohring. Inductive definitions in the system Coq: Rules and properties. Research report RR 92-49, Laboratoire de l'Informatique du Parallélisme, Ecole normale supérieure de Lyon, December 1992.
|
| |
35
|
|
| |
36
|
Emir Pašalic, Walid Taha, and Tim Sheard. Tagless staged interpreters for typed languages (formal development). Technical Report 02-006, OGI, 2002. Available from {33}.
|
| |
37
|
|
| |
38
|
|
| |
39
|
|
| |
40
|
Calton Pu, Andrew Black, Crispin Cowan, and Jonathan Walpole. Microlanguages for operating system specialization. In Proceedings of the Workshop on Domain-Specific Languages, Paris, 1997.
|
 |
41
|
|
 |
42
|
|
 |
43
|
|
 |
44
|
|
 |
45
|
Tim Sheard , Zine-el-abidine Benaissa , Emir Pasalic, DSL implementation using staging and monads, Proceedings of the 2nd conference on Domain-specific languages, p.81-94, October 03-06, 1999, Austin, Texas, United States
|
 |
46
|
Mark Shields , Tim Sheard , Simon Peyton Jones, Dynamic typing as staged type inference, Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.289-302, January 19-21, 1998, San Diego, California, United States
[doi> 10.1145/268946.268970]
|
| |
47
|
Yannis Smaragdakis and Don Batory. DiSTiL: A transformation library for data structures. In USENIX Conference on Domain-Specific Languages, October 1997.
|
| |
48
|
|
| |
49
|
|
 |
50
|
|
| |
51
|
|
| |
52
|
|
| |
53
|
Walid Taha and Henning Makholm. Tag elimination -- or -- type specialisation is a type-indexed effect. In Subtyping and Dependent Types in Programming, APPSEM Workshop. INRIA technical report, 2000.
|
| |
54
|
|
 |
55
|
|
| |
56
|
|
 |
57
|
|
| |
58
|
|
 |
59
|
|
 |
60
|
|
|