GithubHelp home page GithubHelp logo

Comments (3)

vnmakarov avatar vnmakarov commented on June 12, 2024

Thank you for the proposal. Unfortunately, in general case the grammar ambiguity can be detected only on specific input after finishing building parse sets (meaning consuming all input) and starting building a parse tree.

Actually parse_tree function already returns a flag if the ambiguity is found.

As I remember recognizing ambiguity by grammar only is undecidable problem. But it is possible to recognize that grammar is out of narrow unambiguous grammar class (e.g. LR(k)). So I don't see a good solution right now for the ambiguity recognition problem although I'll think about some solution. May be I'll find an useful approach.

from yaep.

andres-erbsen avatar andres-erbsen commented on June 12, 2024

I agree that recognizing a grammar as ambiguous is undecidable, I meant to ask about recognizing an input as ambiguous. Here is another way of asking mostly the same question: how much work does yaep need to do before it can detect that an input is ambiguous? Is it O(n^3) or O(n^2)? is it fast in common cases?

from yaep.

andres-erbsen avatar andres-erbsen commented on June 12, 2024

Thinking about it some more: it should be possible to detect that an input is ambiguous in O(n^2) time. This is because parsing an ambiguous input will finish in O(n^2) time, and if we knew the big-constant, we could just have the parser abort after k*n^2 time and declare the input ambiguous. This, of course, would be dissatisfying strategy for implementation. Once I acquire some of that copious free time I have been dreaming about, I will look into this more to see whether a more practical approach comes up.

from yaep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.