Abstract
The two predominant program specialization techniques, partial evaluation and staged programming, take opposite approaches to automating binding-time analysis (BTA). Despite their common goal, there are no systems integrating both methods. Programmers must choose between the precision of manually placing staging annotations and the convenience of automating such annotation.
We present an automatic BTA algorithm for a subset of MetaML. Such an algorithm provides a basis for a system integrating staged programming and partial evaluation because it allows programmers to switch between automatic and manual staging. Our algorithm is based on typing algorithm coupled with arithmetic-constraint solving. The algorithm decorates each subexpression of both a program and its type with numeric variables representing staging-annotations and then generates simple arithmetic constraints that describe the space of all possible stagings of the original program. Benefits of our approach include expressive BTA specifications in the form of stage-annotated types as well as support for polyvariance.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Henglein, F.: Efficient type inference for higher-order binding-time analysis. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 448–472. Springer, Heidelberg (1991)
Taha, W., Sheard, T.: Multi-stage programming with explicit annotations. In: Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM), pp. 203–217. ACM Press, New York (1997)
Sheard, T.: Accomplishments and research challenges in meta-programming. In: Taha, W. (ed.) SAIG 2001. LNCS, vol. 2196, pp. 2–44. Springer, Heidelberg (2001)
Sheard, T., Jones, S.P.: Template meta-programming for haskell. In: ACM SIGPLAN Workshop on Haskell, pp. 1–16. ACM Press, New York (2002)
Sheard, T., Linger, N.: Search-based binding time analysis using type-directed pruning. In: Proceedings of the ACM SIGPLAN Asian Symposium on Partial Evaluation and Semantics-Based Program Manipulation (ASIA-PEPM), pp. 20–31. ACM Press, New York (2002)
Jones, M.P.: Qualified Types: Theory and Practice. PhD thesis, Oxford University (1992); Also available as Programming Research Group technical report 106
Odersky, M., Sulzmann, M., Wehr, M.: Type inference with constrained types. Theory and Practice of Object Systems 5, 35–55 (1999)
Pugh, W.: The omega test: A fast and practical integer programming algorithm for dependence analysis. Communications of the ACM 38, 102–114 (1992)
Nielson, H., Nielson, F.: Automatic binding time analysis for a typed λ-calculus. Science of Computer Programming 10, 139–176 (1988)
Gomard, C., Jones, N.: A partial evaluator for the untyped lambda-calculus. Journal of Functional Programming 1, 21–69 (1991)
Heldal, R., Hughes, J.: Binding-time analysis for polymorphic types. In: Bjørner, D., Broy, M., Zamulin, A.V. (eds.) PSI 2001. LNCS, vol. 2244, pp. 191–201. Springer, Heidelberg (2001)
Glück, R., Jørgensen, J.: Fast binding-time analysis for multi-level specialization. In: Bjorner, D., Broy, M., Pottosin, I.V. (eds.) PSI 1996. LNCS, vol. 1181, pp. 261–272. Springer, Heidelberg (1996)
Davies, R.: A temporal-logic approach to binding-time analysis. In: Proceedings of the 11th Annual Symposium on Logic in Computer Science, pp. 184–195 (1996)
Glück, R., Jørgensen, J.: Efficient multi-level generating extensions for program specialization. In: Swierstra, S.D. (ed.) PLILP 1995. LNCS, vol. 982, pp. 259–278. Springer, Heidelberg (1995)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Linger, N., Sheard, T. (2004). Binding-Time Analysis for MetaML via Type Inference and Constraint Solving. In: Jensen, K., Podelski, A. (eds) Tools and Algorithms for the Construction and Analysis of Systems. TACAS 2004. Lecture Notes in Computer Science, vol 2988. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-24730-2_22
Download citation
DOI: https://doi.org/10.1007/978-3-540-24730-2_22
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-21299-7
Online ISBN: 978-3-540-24730-2
eBook Packages: Springer Book Archive