nodebnf icon indicating copy to clipboard operation
nodebnf copied to clipboard

Optimization on &OR -> AddExpected

Open akvlad opened this issue 3 years ago • 1 comments

Hello. First of all, thanks for (as I believe) the only working BNF powered script parser for NodeJS.

On the other hand it has some flaws obstructing the usage. In particular I saw the problem: https://github.com/daKuleMune/nodebnf/blob/d2739eca985ee2f3e4f4e66add87e967121ba460/BnfRules.js#L288 When I comment out the for loop it parses an invalid expression in 73ms. When I uncomment the loop it needs about 3s to parse the expression.

As far as I see, the loop is connected to gathering expected tokens in case of error. Can it be preprocessed upon the creation? Can some internal loops be omitted? What is the LHF you mentioned?

akvlad avatar Nov 21 '22 11:11 akvlad

It is time to do an update to new versions of node again. Also, the first pass debugging never quite worked correctly in catching syntax errors, and I never got back around to fixing the issue. I will assign myself this issue and work on a version bump for node 10+ support as well as first pass improvements. LHF meant Low Hanging Fruit, things that were simple optimizations that anyone interested in the repo could contribute to, or myself given time.

daKuleMune avatar Nov 21 '22 19:11 daKuleMune