Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying a timeout or max call number for processRule #44

Open
alessiostalla opened this issue Jul 6, 2020 · 2 comments
Open

Comments

@alessiostalla
Copy link
Contributor

Our language makes antlr4-c3 take an exponentially long time as we add clauses to a relatively simple expression. It appears that the processRule method enters into a loop of recursive calls that go on for a very long time.
Would it be possible to limit processRule with a timeout, or max number of calls?

@yangjunhan
Copy link

I am facing a similar situation. My defined grammar is non-trivial, and the core.collectCandidates(index) call seems to take a significantly long time when I attempt to run a relatively large script. What I am doing for a workaround is to break the script into parts and only parse the one which the caret locates.

@alessiostalla
Copy link
Contributor Author

alessiostalla commented May 12, 2021

In our case, scripts were not particularly big – it was a certain kind of recursive expression that caused exponential blowup when adding each new (simple) clause to it.
I ended up monkey-patching the processRule method to throw an error when a given timeout is exceeded. It's not the ideal solution, as intermediate results are lost that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants