question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some expressions take an enormous amount of time to parse

See original GitHub issue

Hi there,

I’ve just upgraded from sly 2.7.0.3 to 2.7.0.5 and switched from using laborious manually-driven precedence to the lovely new built-in precedence support. However, a couple of my expressions work but are incredibly slow.

Here’s an example piece of code for a project I maintain. This commit moves me from 2.7.0.3 to 2.7.0.5, introduces bitwise ‘&’ and ‘|’ operators and moves to using [Operand], [Infix] and [Prefix] attributes: https://github.com/RoystonS/BetterBravoLights/commit/6d066a9f986da911992bc5978946550d7546a187

All of the tests pass, but two in particular are now incredibly slow. I’m not sure what’s going on - I’d expect them either to fail with some sort of stack overflow exception due to excessive recursion, or pass very quickly.

image

To reproduce, grab the above project at that commit, built it in VS2019 and run the unit tests.

The particular case that’s problematic is one that mixes unary minus with parenthetic grouping, i.e. -(1+2).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:24 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
RoystonScommented, Nov 23, 2021

Heya. Thanks for doing that. Yep, I’ll get that built up and tested, hopefully later today. I’ll also get you the other superpower branch to take a look at for comparison.

0reactions
RoystonScommented, Nov 25, 2021

Yep, 2.8.0 looks absolutely fantastic. Outstanding job, sir - very much appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Leveling Up One's Parsing Game With ASTs
It's time to face the root of the abstract syntax tree head on — and level up our parsing game!
Read more >
c# - I need a fast runtime expression parser
Ideally I want to pass it a list of name/value pairs (e.g. variables) and a string containing the expression to evaluate. All I...
Read more >
Parsing Expressions
Some CS textbooks make a big deal out of parsers. ... For the left-hand expression , pick NUMBER , and use 6 ....
Read more >
Parsing Time: Learning to Interpret Time Expressions
Our approach draws inspiration from a large body of work on parsing expressions into a logical form. The latent parse parallels the formal ......
Read more >
Parsing expression grammar
In computer science, a parsing expression grammar (PEG) is a type of analytic formal grammar, i.e. it describes a formal language in terms...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found