Usually when you bomb out of a deep recursion, you have reached your stack size limit. If you are on a Unixy system, use ulimit -s or ulimit -a to see your stack size limit. If you are lucky you can increase it yourself, if not you'll have to tweak the kernel-imposed limit.