Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1244381.1244399acmconferencesArticle/Chapter ViewAbstractPublication PagespepmConference Proceedingsconference-collections
Article

Tools and libraries to model and manipulate circular programs

Published: 15 January 2007 Publication History

Abstract

This paper presents techniques to model circular lazy programs in a strict, purely functional setting. Circular lazy programs model any algorithm based on multiple traversals over a recursive data structure as a single traversal function. Such elegant and concise circular programs are defined in a (strict or lazy) functional language and they are transformed into efficient strict and deforested, multiple traversal programs by using attribute grammars-based techniques. Moreover, we use standard slicing techniques to slice such circular lazy programs.
We have expressed these transformations as an Haskell library and two tools have been constructed: the HaCirc tool that refactors Haskell lazy circular programs into strict ones, and the OCirc tool that extends Ocaml with circular definitions allowing programmers to write circular programs in Ocaml notation, which are transformed into strict Ocaml programs before they are executed. The first benchmarks of the different implementations are presented and show that for algorithms relying on a large number of traversals the resulting strict, deforested programs are more efficient than the lazy ones, both in terms of runtime and memory consumption.

References

[1]
D. S. Atze Dijkstra. Typing haskell with an attribute grammar (part i). Technical Report UU-CS-2004-037, Institute of Information and Computing Sciences, Utrecht University, 2004.
[2]
R. S. Bird. Using circular programs to eliminate multiple traversals of data. Acta Inf, 21:239--250, 1984.
[3]
O. Danvy and M. Goldberg. There and back again. In ICFP '02: Seventh ACM SIGPLAN international conference on Functional programming, pages 230--234, New York, USA, 2002. ACM Press.
[4]
O. de Moor, K. Backhouse, and S. D. Swierstra. First-class attribute grammars. Informatica (Slovenia), 24(3), 2000.
[5]
O. de Moor, S. Peyton-Jones, and E. Van Wyk. Aspect-oriented compilers. Lecture Notes in Computer Science, 1799, 2000.
[6]
A. Dijkstra. Stepping through Haskell. PhD thesis, Computer Science Depart., Utrecht University, The Netherlands, November 2005.
[7]
J. Engelfriet and G. Filé. Simple multi-visit Attribute Grammars. Journal of Computer and System Sciences, 24(3):283--314, 1982.
[8]
J. Fernandes and J. Saraiva. Calculating circular programs. (in preparation), 2006.
[9]
R. Hinze and J. Jeuring. Generic Haskell: Practice and theory. In Summer School on Generic Programming, 2002.
[10]
S. Horwits and T. Reps. The Use of Program Dependence Graphs in Software Engineering. In 14th International Conference on Software Engineering, pages 392--411, Melbourne, Australia, may 1992. ACM.
[11]
T. Johnsson. Attribute grammars as a functional programming paradigm. In Functional Programming Languages and Computer Architecture, pages 154--173, 1987.
[12]
N. Jones, C. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall International Series in Computer Science. Prentice-Hall, 1993.
[13]
U. Kastens. Ordered attribute grammars. Acta Informatica, 13:229--256, 1980.
[14]
D. E. Knuth. Semantics of Context-free Languages. Mathematical Systems Theory, 2(2):127--145, June 1968. Correction: Mathematical Systems Theory 5, 1, pp. 95--96 (March 1971).
[15]
M. Kuiper and D. Swierstra. Using attribute grammars to derive efficient functional programs. In Computing Science in the Netherlands CSN'87, November 1987.
[16]
J. L. Lawall. Implementing Circularity Using Partial Evaluation. In Proceedings of the Second Symposium on Programs as Data Objects PADO II, volume 2053 of LNCS, May 2001.
[17]
S. Marlow and S. P. Jones. The new GHC/Hugs Runtime System. 1999.
[18]
C. Okasaki. Breadth-first numbering: lessons from a small exercise in algorithm design. ACM SIGPLAN Notices, 35(9):131--136, 2000.
[19]
Y. Onoue, Z. Hu, H. Iwasaki, and M. Takeichi. A calculational fusion system HYLO. In Algorithmic Languages and Calculi, pages 76--106, 1997.
[20]
M. Pennings. Generating Incremental Evaluators. PhD thesis, Depart. of Comp. Science, Utrecht Univ., The Netherlands, 1994.
[21]
T. Reps and T. Teitelbaum. The Synthesizer Generator. Springer, 1989.
[22]
J. Saraiva. Purely Functional Implementation of Attribute Grammars. PhD thesis, Department of Computer Science, Utrecht University, The Netherlands, December 1999.
[23]
J. Saraiva and D. Swierstra. Data Structure Free Compilation. In Stefan Jähnichen, editor, 8th International Conference on Compiler Construction, CC/ETAPS'99, volume 1575 of LNCS, pages 1--16. Springer-Verlag, March 1999.
[24]
J. Saraiva, D. Swierstra, and M. Kuiper. Strictification of Computations on Trees. In R. Linz, editor, Third Latin-American Conference on Functional Programming - CLAPF'99 - Recife, Mar. 1999.
[25]
D. Swierstra, P. Azero, and J. Saraiva. Designing and Implementing Combinator Languages. In D. Swierstra, P. Henriques, and J. Oliveira, editors, Third Summer School on Advanced Functional Programming, volume 1608 of LNCS Tutorial, pages 150--206, September 1999.
[26]
D. Swierstra and H. Vogt. Higher order attribute grammars. In H. Alblas and B. Melichar, editors, International Summer School on Attribute Grammars, Applications and Systems, volume 545 of LNCS, pages 48--113. Springer-Verlag, 1991.
[27]
D. Swierstra and P. Azero. Attribute grammars in a functional style. In Systems Implementation 2000, Berlin, 1998. Chapman & Hall.
[28]
F. Tip. A Survey of Program Slicing Techniques. Technical report CS-R9438, CWI - Computer Science, Department of Software Technology, Amsterdam, February 1994.
[29]
J. Voigtländer. Using circular programs to deforest in accumulating parameters. Higher-Order and Symbolic Computation, 17:129--163, 2004.

Cited By

View all
  • (2022)The Tortoise and the Hare Algorithm for Finite Lists, CompositionallyACM Transactions on Programming Languages and Systems10.1145/356461945:1(1-35)Online publication date: 26-Sep-2022
  • (2018)Memoized zipper-based attribute grammars and their higher order extensionScience of Computer Programming10.1016/j.scico.2018.10.006Online publication date: Nov-2018
  • (2016)Multiple intermediate structure deforestation by shortcut fusionScience of Computer Programming10.1016/j.scico.2016.07.004132:P1(77-95)Online publication date: 15-Dec-2016
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PEPM '07: Proceedings of the 2007 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
January 2007
180 pages
ISBN:9781595936202
DOI:10.1145/1244381
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 15 January 2007

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. circular programming
  2. intermediate data structures
  3. multiple traversal algorithms
  4. traversal scheduling

Qualifiers

  • Article

Conference

PEPM07
Sponsor:

Acceptance Rates

Overall Acceptance Rate 66 of 120 submissions, 55%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)1
Reflects downloads up to 25 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2022)The Tortoise and the Hare Algorithm for Finite Lists, CompositionallyACM Transactions on Programming Languages and Systems10.1145/356461945:1(1-35)Online publication date: 26-Sep-2022
  • (2018)Memoized zipper-based attribute grammars and their higher order extensionScience of Computer Programming10.1016/j.scico.2018.10.006Online publication date: Nov-2018
  • (2016)Multiple intermediate structure deforestation by shortcut fusionScience of Computer Programming10.1016/j.scico.2016.07.004132:P1(77-95)Online publication date: 15-Dec-2016
  • (2016)Embedding attribute grammars and their extensions using functional zippersScience of Computer Programming10.1016/j.scico.2016.03.005132:P1(2-28)Online publication date: 15-Dec-2016
  • (2016)Memoized Zipper-Based Attribute GrammarsProgramming Languages10.1007/978-3-319-45279-1_4(46-61)Online publication date: 17-Sep-2016
  • (2014)A Visual DSL for the Certification of Open Source SoftwareComputational Science and Its Applications – ICCSA 201410.1007/978-3-319-09156-3_42(602-617)Online publication date: 2014
  • (2013)A Combinator Language for Software Quality ReportsInternational Journal of Computer and Communication Engineering10.7763/IJCCE.2013.V2.208(377-382)Online publication date: 2013
  • (2013)Circularity and Lambda AbstractionProceedings of the 25th symposium on Implementation and Application of Functional Languages10.1145/2620678.2620687(85-92)Online publication date: 28-Aug-2013
  • (2013)Multiple Intermediate Structure Deforestation by Shortcut FusionProgramming Languages10.1007/978-3-642-40922-6_9(120-134)Online publication date: 2013
  • (2013)Zipper-Based Attribute Grammars and Their ExtensionsProgramming Languages10.1007/978-3-642-40922-6_10(135-149)Online publication date: 2013
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media