caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Right recursion with ocamlyacc
@ 2005-02-16  2:10 Jon Harrop
  2005-02-16  2:28 ` [Caml-list] " Eric C. Cooper
  2005-02-16  3:58 ` Markus Mottl
  0 siblings, 2 replies; 7+ messages in thread
From: Jon Harrop @ 2005-02-16  2:10 UTC (permalink / raw)
  To: caml-list


I've just been converting a new Computer Language Shootout submission from 
OCaml to C++ and found that bison falls over very easily with right recursion 
(failing to load a 10^4-element list) but ocamlyacc had no problems (even on 
a 10^5-element list).

Now, I don't know much about yacc internals but I'm curious as to why this 
would be. Does g++ simply consume much bigger stack frames as it recurses 
(>10x the size?) running out much earler, or is there another reason?

Also, assuming this corresponds to non-tail-recursion inside ocamlyacc, could 
a rewrite in CPS eliminate this problem (probably with a performance hit)?

Or am I completely deluded and, in fact, this is a whole-other stack they're 
talking about, and ocamlyacc just happens to allocate a bigger one.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-02-18 15:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-16  2:10 Right recursion with ocamlyacc Jon Harrop
2005-02-16  2:28 ` [Caml-list] " Eric C. Cooper
2005-02-16  3:58 ` Markus Mottl
2005-02-16  4:35   ` Jon Harrop
2005-02-16  9:18     ` Radu Grigore
2005-02-18 15:27       ` Radu Grigore
2005-02-16  4:42   ` skaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).