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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
Rights 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