castl
castl copied to clipboard
KaTeX compiles, but running fails with Lua error "too many C levels (limit is 200)"
I tried translating KaTeX (v0.7.1 from git) with castl (1.2.4). The translation "succeeded", with commands roughly as below:
$ cd katex
$ git checkout v0.7.1
$ for f in katex.js src/*.js; do castl $f -o --debug --node; done
However, trying to run the following Lua script afterwards with Lua 5.2:
local katex = assert(loadfile 'katex.js.lua')()
failed with a Lua error: [...] too many C levels (limit is 200) [...]
, which seems to mean there's too deep nesting in the code.
I'm aware that castl is an experimental project, but I'm reporting this problem just in case you (or someone else) are crazy enough to try fixing the issue somehow :)
Hi Mateusz, Thanks for reporting that. Yes I believe you are right in your assessment of the problem. One thing we can try to do is to narrow down what kind of JS code lead to such levels of nesting, maybe it's can be optimized. Does the error stack trace point to a particular piece of code? (If not, to be honest I won't have time to put effort investigating)
Yes, there was a stack trace, and not that long really (specifially, that's not a case of one's regular "stack overflow" with a super long stack trace). But I'm sorry, I don't really have time to reproduce it either.