Skip to main content

9 Simulating Tailcalls in C

  • Chapter
  • 218 Accesses

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

Abstract

Implementations of modern high-level languages sometimes generate C as their ‘machine code’. While this can lead to a reasonable degree of portability and efficiency of the generated code, some features are difficult to express correctly, portably, and efficiently in C. One such feature is the tailcall, which is present in most functional and logic programming languages. This chapter describes and evaluates a number of techniques for simulating tailcalls in C.

Since RML can only express loops by tailcalls, and our compiler uses a continuation-passing style intermediate representation, efficient and correct implementation of tailcalls is of utmost importance to the rml2c compiler.

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.

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 1999 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Pettersson, M. (1999). 9 Simulating Tailcalls in C. In: Compiling Natural Semantics. Lecture Notes in Computer Science, vol 1549. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10693148_9

Download citation

  • DOI: https://doi.org/10.1007/10693148_9

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-65968-6

  • Online ISBN: 978-3-540-48823-1

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics