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.

[question] `canMatchZeroChars` in cycles

See original GitHub issue

Hello,

while reimplementing pikaparser for another language (julia), I noticed a possible small discrepancy when initializing canMatchZeroChars values for clause objects in grammar cycles. Imagine a grammar with a simple cycle and a single terminal t such as this:

Start ← A
A ← B?
B ← C A
C ← t?

Here, in topological order, C can match zero chars, B should be able to match zero chars because both A and C can match zero chars, and A (resp. Start) can trivially (resp. transitively) match zero chars.

Despite of that, the topological-ordering initialization seems to initialize B with canMatchZeroChars=false, because the value at A is initially false.

Semantically this is probably not a very big deal, but I wonder if this could have an effect on grammar matching, such as in case there would be a rule:

D ← B t

…which (I guess) would at this point not be able to match with a zero-char B.

I understand that my above grammar is technically disallowed with B having canMatchZeroChars=true, because B? is equivalent to B|ε which would be erroneous if B can match zero chars. Is there a proof that one really can not construct a valid grammar that would trigger this possible discrepancy with initializaiton of canMatchZeroChars? I didn’t find any counterexample, but that ofc doesn’t prove much :]

Thank you very much for any help!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lukehutchcommented, Jun 20, 2022

You’re right. In the worst case the performance will be O(C^2) in the number of clauses. I’m OK with that.

1reaction
lukehutchcommented, Jun 20, 2022

OK, I committed a fix for this. It seems to work OK but I haven’t tested it extensively. Feel free to try the fix and let me know if it works for you too. Thanks again for your astute observation that led to finding this problem, @exaexa!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid noisy renders in Cycles?
I understand that there are tricks that can be used to reduce noise, but at the cost of extra processing time and usually...
Read more >
Cycles Samples - Blender 2.80 Fundamentals - YouTube
Blender is Free and Open Source SoftwareDownload: https://blender.org/downloadSupport core Blender development ...
Read more >
Cycles Render Settings Explained: Sampling and Light Paths
http://www.blenderhd.com/All of Blender Cycles ' sampling and light path settings explained in one video. Aimed at beginners, but helpful for ...
Read more >
Blender Tutorial - Rendering with Cycles - YouTube
In this tutorial I go into some detail on the many settings available when rendering with the Blender Cycles engine and also, provide...
Read more >
Cycles X, 2-7 times FASTER? Blender 3.0 - YouTube
https://www.creativeshrimp.com/You knew I would record a video testing new Cycles X, right? :) Here we go, it's faster and you can confirm ...
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