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.

Bug in handling ambiguity?

See original GitHub issue

When running this code:

grammar = """
expression: "c" | "d" | "c" "d"
unit: expression "a"
    | "a" expression
    | "b" unit
    | "b" expression
start: unit*

%import common.WS
%ignore WS
"""

l = Lark(grammar, parser='earley', ambiguity='explicit')
print(l.parse('b c d a a c').pretty())

It is expected to have an ambiguous parse, but there is no ‘_ambig’ node.

At least these options are valid:

unit(
    b
    unit(
        expression(
            c
            d
        )
        a
    )
)
unit(
    a
    expression(
        c
    )
)

and this parse:

unit(
    b
    expression(
        c
    )
)
unit(
    expression(
        d
    )
    a
)
unit(
    a
    expression(
        c
    )
)

The only parse that comes back is the second one. When one removes the "b" expression option, you get the first one.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:67 (31 by maintainers)

github_iconTop GitHub Comments

3reactions
erezshcommented, Oct 29, 2017

Fixed! At the very least, the example you gave me now runs almost instantly. Please check if latest master fixes your issues.

Turns out it was a very simple bug, but it was a real flaw in my implementation. So thank you for reporting it and helping me weed it out.

See if you can find an example of name length affecting speed. I’ll be very happy to fix it if it’s true.

1reaction
erezshcommented, Dec 11, 2017

CAN DO

In master.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Deal With Ambiguity: Guidelines and Resources
“Ambiguity is a type of meaning in which a phrase, statement or resolution is not explicitly defined, making several interpretations plausible.
Read more >
CSCvf21978 - ISE failing to resolve ambiguity for ... - Cisco Bug
Conditions: This problem appear when ambiguity is presented in Active Directory: Ambiguity means case when user enters a short identity as a username...
Read more >
Ambiguity is a feature of natural languages, it's not a bug. It's ...
Ambiguity is a feature of natural languages, it's not a bug. ... The only reason certain words' meanings don't change is because people...
Read more >
'It's Not a Bug, It's a Feature.' Trite—or Just Right? - WIRED
It's not a bug, it's a feature is an acknowledgment, half comic, half tragic, of the ambiguity that has always haunted computer programming....
Read more >
326778 – Questionable ambiguity if both using declaration ...
Bugzilla – Bug 326778 Questionable ambiguity if both using declaration and using directive is used Last modified: 2010-10-07 03:17:43 EDT.
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