So, here I am, roughing out some ideas for how I'm going to implement a very lovely and worthwhile scheme interpreter (or a compiler, I'm not proud) for parrot. If I'm going to be doing tail call optimization (and I can't call it scheme if I don't) then my first thought was as follows.
# This is a tail call branch FOO_tail ... # This not a tail call bsr FOO ... FOO: pop_call I0 FOO_tail: ... ... FOO_ret: push_call I0 ret (In the example I'm using 'I0' as my 'partial continuation register'. Essentially the partial continuation is the place where you want to return to when the current function is finished. For tail call optimization to work, this is not restricted to being the place from where the current function was called. And, once I implement full continuations it needn't even be anything that called any of the functions that called the current function, but that's scary, move right along the bus.) The problem here (obviously) is that (push|pop)_call don't actually exist as opcodes. Shame that. So, instead of doing that, I need to find out if something like: # tail call jump FOO # non tail call set I0, ret_nnnn jump FOO ret_nnnn: ... ... FOO: ... ... FOO_ret: jump I0 Can I use jump like that, or is my understanding still faulty. And if I can't use either of these approaches, is there any way to do what I want with current Parrot code? -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?