Skip to main content Accessibility help
×
Home
Hostname: page-component-5d6d958fb5-c6lpx Total loading time: 0.713 Render date: 2022-11-29T12:05:03.747Z Has data issue: true Feature Flags: { "shouldUseShareProductTool": true, "shouldUseHypothesis": true, "isUnsiloEnabled": true, "useRatesEcommerce": false, "displayNetworkTab": true, "displayNetworkMapGraph": false, "useSa": true } hasContentIssue true

A positive supercompiler

Published online by Cambridge University Press:  07 November 2008

M. H. Sørensen
Affiliation:
DIKU, Department of Computer Science, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen ø, Denmark (e-mail: rambo@diku.dk)
R. Glück
Affiliation:
DIKU, Department of Computer Science, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen ø, Denmark (e-mail: rambo@diku.dk)
N. D. Jones
Affiliation:
DIKU, Department of Computer Science, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen ø, Denmark (e-mail: rambo@diku.dk)
Rights & Permissions[Opens in a new window]

Abstract

HTML view is not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We introduce a positive supercompiler, a version of Turchin's supercompiler maintaining only positive information during transformation, and using folding without generalization. The positive supercompiler can also be regarded as a variant of Wadler's deforestation maintaining an increased amount of information. We compare our algorithm to deforestation and, in less detail, to partial evaluation, Turchin's supercompiler, Generalized Partial Computation (GPC), and partial deduction by classifying these transformers by the amount of information they maintain during transformation. This factor is significant, as a differentiating example reveals: positive supercompilation, Turchin's supercompiler, GPC and partial deduction can specialize a general pattern matcher with respect to a fixed pattern to obtain an efficient matcher very similar to the Knuth–Morris–Pratt algorithm. Deforestation and traditional partial evaluation achieve this effect only after a non-trivial hand rewriting of the general matcher.

Type
Articles
Copyright
Copyright © Cambridge University Press 1996

References

Andersen, L. O. and Gomard, C. K. (1992) Speedup analysis in partial evaluation. ACM Workshop on Partial Evaluation and Semantics-Based Program Manipulation, Technical Report YALEU/DCS/RR-909, pp. 17.Google Scholar
Ariola, Z. M., Felleisen, M., Maraist, J., Odersky, M. and Wadler, P. (1995) A call-by-need lambda calculus. 22nd ACM Symposium on Principles of Programming Languages 1995, pp. 233246. ACM Press.Google Scholar
Augustsson, L. (1985) Compiling lazy pattern-matching. Conference on Functional Programming and Computer Architecture, Jouannaud, J.-P. (ed.). Lecture Notes in Computer Science 201, pp. 368381. Springer-Verlag.Google Scholar
Bird, R. (1984) Using circular programs to eliminate multiple traversals of data. Acta Informatica, 21: 239250.CrossRefGoogle Scholar
Bird, R. S. and Wadler, P. L. (1988) Introduction to Functional Programming. Prentice-Hall.Google Scholar
Bondorf, A. (1990) Self-applicable partial evaluation. PhD thesis, DIKU-Rapport 90/17, Department of Computer Science, University of Copenhagen.Google Scholar
Burstall, R. M. and Darlington, J. (1977) A transformation system for developing recursive programs. J. ACM, 24(1): 4467.CrossRefGoogle Scholar
Chin, W.-N. (1992) Safe fusion of functional expressions. ACM Conference on Lisp and Functional Programming, pp. 1120. ACM Press.Google Scholar
Consel, C. and Danvy, O. (1989) Partial evaluation of pattern matching in strings. Information Processing Letters, 30(2):7986.CrossRefGoogle Scholar
Consel, C. and Danvy, O. (1991) For a better support of static data flow. Conference on Functional Programming and Computer Architecture, Hughes, J. (ed.). Lecture Notes in Computer Science 523, pp. 495519. Springer-Verlag.Google Scholar
Feather, M. S. (1982) A system for assisting program transformation. ACM Trans. Programming Languages and Systems, 4(1):120.CrossRefGoogle Scholar
Ferguson, A. B. and Wadler, P. L. (1988) When will deforestation stop?. Glasgow Workshop on Functional Programming, pp. 3956.Google Scholar
Futamura, Y. and Nogi, K. (1988) Generalized partial computation. Partial Evaluation and Mixed Computation, Bjørner, D., Ershov, A. P. and Jones, N. D. (eds.), pp. 133151. North-Holland.Google Scholar
Futamura, Y. (1988) Program evaluation and generalized partial computation. International Conference on Fifth Generation Computer Systems, pp. 18, Tokyo, Japan.Google Scholar
Glück, R. and Klimov, A. V. (1993) Occam's razor in metacomputation: the notion of a perfect process tree. Static Analysis, Cousot, P., Falaschi, M., Filè, G. and Rauzy, A. (eds.), Lecture Notes in Computer Science 724, pp. 112123. Springer-Verlag.Google Scholar
Glück, R. and Jørgensen, J. (1994) Generating transformers for deforestation and supercompilation. Static Analysis, Le Charlier, B. (ed.), Lecture Notes in Computer Science 864, pp. 432448. Springer-Verlag.Google Scholar
Glück, R. and Sørensen, M. H. (1994) Partial deduction and driving are equivalent. Programming Language Implementation and Logic Programming, Hermenegildo, M. and Penjam, J. (eds.), Lecture Notes in Computer Science 844, pp. 165181. Springer-Verlag.Google Scholar
Glück, R. and Turchin, V. F. (1990) Application of metasystem transition to function inversion and transformation. Proc. ISSAC'90, pp. 286287. ACM Press.CrossRefGoogle Scholar
Hamilton, G. W. (1993) Compile-time optimisation of storage usage in lazy functional programs. PhD thesis, University of Stirling.Google Scholar
Jones, N. D. (1988) Automatic program specialization: a re-examination from basic principles. Partial Evaluation and Mixed Computation, Bjørner, D., Ershov, A. P. and Jones, N. D. (eds.), pp. 225282. North-Holland.Google Scholar
Jones, N. D., Gomard, C. K. and Sestoft, P. (1993) Partial Evaluation and Automatic Program Generation. Prentice-Hall.Google Scholar
Jones, N. D. (1994) The essence of program transformation by partial evaluation and driving. Logic, Language and Computation, Jones, N. D., Hagiya, M. and Sato, M. (eds.), Lecture Notes in Computer Science 792, pp. 206224. Springer-Verlag.Google Scholar
Komorowski, J. (1992) An introduction to partial deduction. Meta-Programming in Logic, Pettorossi, A. (ed.), Lecture Notes in Computer Science 649, pp. 4969. Springer-Verlag.Google Scholar
Knuth, D. E., Morris, J. H. and Pratt, V. R. (1977) Fast pattern matching in strings. SIAM J. Computing, 6(2):323350.CrossRefGoogle Scholar
Launchbury, J. (1993) A natural semantics for lazy evaluation. 20th ACM Symposium on Principles of Programming Languages, pp. 144154. ACM Press.Google Scholar
Lloyd, J. W. and Shepherdson, J. C. (1991) Partial evaluation in logic programming. J. Logic Programming, 11(3-4): 217242.CrossRefGoogle Scholar
Nielsen, K. and Sørensen, M. H. (1995) Call-by-name CPS-translation as a binding-time improvement. Static Analysis, Mycroft, A. (ed.), Lecture Notes in Computer Science 983, pp. 296313. Springer-Verlag.Google Scholar
Proietti, M. and Pettorossi, A. (1991) Unfolding - Definition - Folding, in this order for avoiding unnecessary variables in logic programs. Programming Language Implementation and Logic Programming, Lecture Notes in Computer Science 528, pp. 347358. Springer-Verlag.CrossRefGoogle Scholar
Sands, D. (1995a) Total correctness by local improvement in program transformation. 22nd ACM Symposium on Principles of Programming Languages, pp. 221232. ACM Press.Google Scholar
Sands, D. (1995b) Proving the correctness of recursion-based automatic program transformations. TAPSOFT'95: Theory and Practice of Software Development, Mosses, P. D., Nielsen, M. and Schwartzbach, M. I. (eds.), Lecture Notes in Computer Science 915, pp. 681695. Springer-Verlag.Google Scholar
Seidl, H. (1996) Integer constraints to stop deforestation. Programming Languages and Systems 1996, to appear in Lecture Notes in Computer Science. Springer-Verlag.Google Scholar
Sestoft, P. (1988) Automatic call unfolding in a partial evaluator. Partial Evaluation and Mixed Computation, Bjørner, D., Ershov, A. P. and Jones, N. D. (eds.), pp. 485506. North-Holland.Google Scholar
Smith, D. A. (1991) Partial evaluation of pattern matching in constraint logic programming languages. Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pp. 6271. ACM Press.Google Scholar
Sørensen, M. H. (1994a) Turchin's supercompiler revisited. An operational theory of positive information propagation. Master's Thesis, DIKU-rapport 94/9, Department of Computer Science, University of Copenhagen.Google Scholar
Sørensen, M. H. (1994b) A grammar-based data-flow analysis to stop deforestation. Trees in Algebra and Programming, Tison, S. (ed.), Lecture Notes in Computer Science 787, pp. 335351. Springer-Verlag.Google Scholar
Sørensen, M. H., Glück, R. and Jones, N. D. (1994) Towards unifying deforestation, supercompilation, partial evaluation, and generalized partial computation. Programming Languages and Systems, Sannella, D. (ed.), pp. 485500. Springer-Verlag.Google Scholar
Sørensen, M. H. and Glück, R. (1995) An algorithm of generalization in positive supercompilation. Logic Programming: Proceedings of the 1995 International Symposium, Lloyd, J. (ed.), pp. 465479. MIT Press.Google Scholar
Takano, A. (1991) Generalized partial computation for a lazy functional language. Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pp. 111. ACM Press.Google Scholar
Turchin, V. F. (1979) A supercompiler system based on the language Refal. SIGPLAN Notices, 14(2): 4654.CrossRefGoogle Scholar
Turchin, V. F. (1980) Semantic definitions in Refal and automatic production of compilers. Semantics-Directed Compiler Generation, Jones, N. D. (ed.), Lecture Notes in Computer Science 94, pp. 441474. Springer-Verlag.Google Scholar
Turchin, V. F.Nirenberg, R. M. and Turchin, D. V. (1982) Experiments with a supercompiler. ACM Symposium on Lisp and Functional Programming 1982, pp. 4755. ACM Press.CrossRefGoogle Scholar
Turchin, V. F. (1986) The concept of a supercompiler. ACM Trans. Programming Languages and Systems, 8(3): 292325.CrossRefGoogle Scholar
Turchin, V. F. (1988) The algorithm of generalization in the supercompiler. Partial Evaluation and Mixed Computation, Bjørner, D., Ershov, A. P. and Jones, N. D. (eds.), pp. 341353. North-Holland.Google Scholar
Wadler, P. L. (1984) Listlessness is better than laziness. ACM Symposium on Lisp and Functional Programming 1984, pp. 282305. ACM.Google Scholar
Wadler, P. L. (1987) Efficient compilation of pattern-matching. The Implementation of Functional Programming Languages, Peyton Jones, S. L. (ed.). Prentice-Hall.Google Scholar
Wadler, P. L. (1990) Deforestation: transforming programs to eliminate trees. Theoretical Computer Science, 73: 231248 (preliminary version in ESOP'88, Lecture Notes in Computer Science 300. Springer-Verlag).CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.
You have Access
85
Cited by

Save article to Kindle

To save this article to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

A positive supercompiler
Available formats
×

Save article to Dropbox

To save this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Dropbox account. Find out more about saving content to Dropbox.

A positive supercompiler
Available formats
×

Save article to Google Drive

To save this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Google Drive account. Find out more about saving content to Google Drive.

A positive supercompiler
Available formats
×
×

Reply to: Submit a response

Please enter your response.

Your details

Please enter a valid email address.

Conflicting interests

Do you have any conflicting interests? *