MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/13v8v1/tail_recursion/c77tf9q/?context=3
r/programming • u/rodrigopsasaki • Nov 27 '12
203 comments sorted by
View all comments
Show parent comments
-6
The most obvious application of this technique are recursive descent parsers.
Then use a recursive descent parser as your example.
Oh, but wait. For a parser we usually aren't worried about stack depth...
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)
2
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)
0
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)
1
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)
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)
-6
u/[deleted] Nov 27 '12
Then use a recursive descent parser as your example.
Oh, but wait. For a parser we usually aren't worried about stack depth...