Re: Tail-Call Elimination Use-Cases

"Neelakantan Krishnaswami" <neelk@alum.mit.edu>
24 Jul 2002 01:49:34 -0400

          From comp.compilers

Related articles
Tail-Call Elimination Use-Cases baueran@in.tum.de (Andreas Bauer) (2002-07-21)
Re: Tail-Call Elimination Use-Cases cr88192@hotmail.com (cr88192) (2002-07-24)
Re: Tail-Call Elimination Use-Cases neelk@alum.mit.edu (Neelakantan Krishnaswami) (2002-07-24)
Re: Tail-Call Elimination Use-Cases wilson@redhat.com (Jim Wilson) (2002-07-24)
Re: Tail-Call Elimination Use-Cases felixundduni@freenet.de (felix) (2002-07-24)
Re: Tail-Call Elimination Use-Cases baueran@in.tum.de (Andreas Bauer) (2002-07-25)
Re: Tail-Call Elimination Use-Cases baueran@in.tum.de (Andreas Bauer) (2002-07-25)
Re: Tail-Call Elimination Use-Cases David.Mosberger@acm.org (David Mosberger-Tang) (2002-07-31)
| List of all articles for this month |

From: "Neelakantan Krishnaswami" <neelk@alum.mit.edu>
Newsgroups: comp.compilers
Date: 24 Jul 2002 01:49:34 -0400
Organization: AT&T Broadband
References: 02-07-066
Keywords: optimize
Posted-Date: 24 Jul 2002 01:49:33 EDT

Andreas Bauer <baueran@in.tum.de> wrote:
>
> I think, such an optimisation in gcc would open a new customer-base to
> the compiler (and I'm not only referring to the Haskell community here).
> A few use-cases and examples would help me to convince maintainers and
> programmers of gcc alike, just how important it is to solve the
> "tail-call problem".


1) I'm writing a compiler for a functional language, and I'd like to
compile to GNU C. I can't do that very easily without cross-function
tail calls.


2) Cross-function tail calls enable a very beautiful style of
implementing state machines, in which each function represents a state
in the state machine and a state transition is a function call. This
is a very clean and modular style, and you can't do this without tail
calls because you'll blow the stack.


3) Full tail-call optimization permits writing code in continuation
passing style. This makes coding things like backtracking and
coroutines easier.
--
Neel Krishnaswami
neelk@alum.mit.edu


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.