Giter VIP home page Giter VIP logo

Comments (3)

renatahodovan avatar renatahodovan commented on June 15, 2024

Hi @bendrissou

Thanks for the report! The generated Python code is incorrect, since the input grammar is not correct either. Grammarinator follows the syntax of ANTLR where terminal rules must not refer to non-terminals. If you generate a parser from the grammar above with ANTLR then you get the following error message:

error(160): /work/dir/json.g4:11:29: reference to parser rule token in lexer rule NUMBER
warning(125): json.g4:8:5: implicit definition of token NUMBER in parser

If you transform token into a terminal rule (rename it to Token) then it will work as expected (both with Grammarinator and ANTLR).

You are right though, that it would be helpful to throw an error from grammarinator-process if the input grammar is not correct. I'll think about it how to handle all the possible input errors (w/o explicitly validating it with ANTLR).

from grammarinator.

renatahodovan avatar renatahodovan commented on June 15, 2024

@bendrissou Did you manage to fix the grammar? Can we close this issue?

from grammarinator.

bendrissou avatar bendrissou commented on June 15, 2024

Yes, I have fixed my grammar. I only wanted to report the bug. Found the bug with my fuzzer.

from grammarinator.

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.