Skip to main content

Generating Heap-Bounded Programs in a Functional Setting

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2855))

Abstract

High-level programming languages offer significant expressivity but provide little or no guarantees about resource utilization. Resource-bounded languages provide strong guarantees about the runtime behavior of programs but often lack mechanisms that allow programmers to write more structured, modular, and reusable programs. To overcome this basic tension in language design, this paper advocates taking into account the natural distinction between the development platform and the deployment platform for resource-sensitive software.

To illustrate this approach, we develop the meta-theory for GeHB, a two-level language in which first stage computations can involve arbitrary resource consumption, but the second stage can only involve functional programs that do not require new heap allocations. As an example of a such a second-stage language we use the recently proposed first-order functional language LFPL. LFPL can be compiled directly to malloc-free, imperative C code. We show that all generated programs in GeHB can be transformed into well-typed LFPL programs, thus ensuring that the results established for LFPL are directly applicable to GeHB.

Supported by NSF grants ITR-0113569, CCR-0224244 and CCR-0229480.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Barendregt, H.P.: Lambda calculi with types. In: Abramsky, S., Gabbay, D.M., Maibaum, T.S.E. (eds.) Handbook of Logic in Computer Science, Oxford University Press, Oxford (1991)

    Google Scholar 

  2. Benaissa, Z.E.-A., Moggi, E., Taha, W., Sheard, T.: Logical modalities and multi-stage programming. In: Federated Logic Conference (FLoC) Satellite Workshop on Intuitionistic Modal Logics and Applications (IMLA) (1999)

    Google Scholar 

  3. Benton, N., Wadler, P.: Linear logic, monads and the lambda calculus. In: The Symposium on Logic in Computer Science (LICS 1996), New Brunswick, IEEE Computer Society Press, Los Alamitos (1996)

    Google Scholar 

  4. Calcagno, C., Moggi, E., Taha, W.: Closed types as a simple approach to safe imperative multi-stage programming. In: Welzl, E., Montanari, U., Rolim, J.D.P. (eds.) ICALP 2000. LNCS, vol. 1853, pp. 25–36. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  5. Crary, K., Weirich, S.: Resource bound certification. In: the Symposium on Principles of Programming Languages (POPL 2000), January 19-21, pp. 184–198. ACM Press, New York (2000)

    Chapter  Google Scholar 

  6. Czarnecki, K., Bednasch, T., Unger, P., Eisenecker, U.: Generative programming for embedded software: An industrial experience report. In: Batory, D., Consel, C., Taha, W. (eds.) Generative Programming and Component Engineer SIGPLAN/SIGSOFT Conference GPCE 2002, ACM. LNCS, vol. 2487, pp. 156–172. Springer, Heidelberg (2002)

    Google Scholar 

  7. Davies, R., Pfenning, F.: A modal analysis of staged computation. Journal of the ACM 48(3), 555–604 (2001)

    Article  MathSciNet  Google Scholar 

  8. Hofmann, M.: Linear types and non-size-increasing polynomial time computation. In: the Symposium on Logic in Computer Science (LICS 1999), pp. 464–473. IEEE, Los Alamitos (1999)

    Google Scholar 

  9. Hofmann, M.: A type system for bounded space and functional in-place update. Nordic Journal of Computing 7(4) (Winter 2000)

    Google Scholar 

  10. Hofmann, M.: A type system for bounded space and functional in-place update. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, p. 165. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  11. Hughes, R., Pareto, L.: Recursion and dynamic data-structures in bounded space: Towards embedded ML programming. In: Proceedings of the Fourth ACM SIGPLAN International Conference on Functional Programming (ICFP 1999), September 27-29. ACM Sigplan Notices, vol. 34.9, pp. 70–81. ACM Press, New York (1999)

    Chapter  Google Scholar 

  12. Hughes, R., Pareto, L., Sabry, A.: Proving the correctness of reactive systems using sized types. In: Steele Jr., G.L. (ed.) Proceedings of the ACM Symposium on Principles of Programming Languages (POPL), St Petersburg, Florida, vol. 23, ACM Press, New York (1996)

    Google Scholar 

  13. Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs (1993)

    MATH  Google Scholar 

  14. Kamin, S., Callahan, M., Clausen, L.: Lightweight and generative components II: Binary-level components. In: [25], pp. 28–50 (2000)

    Google Scholar 

  15. Lee, C.S.: Program termination analysis in polynomial time. In: Batory, D., Consel, C., Taha, W. (eds.) GPCE 2002. LNCS, vol. 2487, pp. 218–235. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  16. Lee, C.S., Jones, N.D., Ben-Amram, A.M.: The size-change principle for program termination. In: ACM Symposium on Principles of Programming Languages, vol. 28, pp. 81–92. ACM Press, New York (2001)

    Google Scholar 

  17. MetaOCaml, A.: compiled, type-safe multi-stage programming language (2001), Available online from http://www.cs.rice.edu/taha/MetaOCaml/

  18. Moggi, E., Taha, W., Benaissa, Z.E.-A., Sheard, T.: An idealized MetaML: Simpler, and more expressive. In: Swierstra, S.D. (ed.) ESOP 1999. LNCS, vol. 1576, pp. 193–207. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  19. Mycroft, A., Sharp, R.: A statically allocated parallel functional language. In: Automata, Languages and Programming, pp. 37–48 (2000)

    Google Scholar 

  20. National Instruments. Introduction to LabVIEW Real-Time (2003), Available online from http://volt.ni.com/niwc/labviewrt/lvr_tintro.jsp?node=2381&node=2381

  21. National Instruments. LabVIEW FPGA Module (2003), Available online from http://sine.ni.com/apps/we/nioc.vp?cid=11784&lang=US

  22. Nielson, F., Nielson, H.R.: Two-Level Functional Languages. Cambridge Tracts in Theoretical Computer Science, vol. (34). Cambridge University Press, Cambridge (1992)

    Book  MATH  Google Scholar 

  23. Oregon Graduate Institute Technical Reports. P.O. Box 91000, Portland, OR 97291-1000,USA, Available online from ftp://cse.ogi.edu/pub/techreports/README.html

  24. Taha, W.: Multi-Stage Programming: Its Theory and Applications. PhD thesis, Oregon Graduate Institute of Science and Technology (1999), Available from [23]

    Google Scholar 

  25. Taha, W. (ed.): SAIG 2000. LNCS, vol. 1924. Springer, Heidelberg (2000)

    MATH  Google Scholar 

  26. Taha, W.: A sound reduction semantics for untyped CBN multi-stage computation. Or, the theory of MetaML is non-trivial. In: Proceedings of the Workshop on Partial Evaluation and Semantics-Based Program Maniplation (PEPM), Boston, ACM Press, New York (2000)

    Google Scholar 

  27. Taha, W., Hudak, P., Wan, Z.: Directions in functional programming for real(-time) applications. In: Henzinger, T.A., Kirsch, C.M. (eds.) EMSOFT 2001. LNCS, vol. 2211, pp. 185–203. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  28. Wan, Z., Taha, W., Hudak, P.: Real-time FRP. In: The International Conference on Functional Programming (ICFP 2001), Florence, Italy, ACM, New York (2001)

    Google Scholar 

  29. Wan, Z., Taha, W., Hudak, P.: Event-driven FRP. In: Proceedings of Fourth International Symposium on Practical Aspects of Declarative Languages, ACM, New York (2002)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2003 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Taha, W., Ellner, S., Xi, H. (2003). Generating Heap-Bounded Programs in a Functional Setting. In: Alur, R., Lee, I. (eds) Embedded Software. EMSOFT 2003. Lecture Notes in Computer Science, vol 2855. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-45212-6_22

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-45212-6_22

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-20223-3

  • Online ISBN: 978-3-540-45212-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics