The current parser in OvaleCompile.lua is using a string.gsub() technique to implement a script grammar, but there are problems with this approach:
- It constantly creates new Lua strings which causes a lot of overhead.
- It takes an indeterminate number of passes over the code text to parse and generate an AST.
- It's slow: all reports of the "script ran too long" error have been from the Compile() method; it needs to execute within 200ms at most.
The parser should be rewritten as an LR parser that can parse the code in a single pass.
- 4 comments