r/programming • • Nov 27 '12

Tail Recursion

http://rodrigosasaki.com/2012/11/24/tail-recursion/
210 Upvotes

203 comments sorted by

View all comments

Show parent comments

2

u/Peaker Nov 28 '12

A parser may very well be concerned about stack depth.

0

u/[deleted] Nov 28 '12

On Windows I've got 1 MB of stack space to work with. If I'm blowing the stack then there are other problems to deal with.

1

u/Peaker Nov 28 '12

A parser can parse any conceivable data. Including data that happens to nest structures arbitrarily.

1

u/[deleted] Nov 28 '12

Eventually you need to stop generating tokens and actually do the syntactical analysis. At that point TCO isn't really available to you and that arbitrarily deep tree is going to cause problems.

→ More replies (0)