Giter VIP home page Giter VIP logo

Comments (1)

t-h-e avatar t-h-e commented on August 28, 2024

The behaviour is expected, otherwise you would not be able to do many things in grammars.
You need quotation to be able to include the separator symbol | or empty productions "". Actually every terminal symbol should be in quotes as well as whitespace, but the parser allows to use whitespace and other symbols without using quotation out of convenience. This means the following two productions produce the same output:

<expr> + <expr>
<expr>" + "<expr>

The following production is different, as it does not have any whitespaces:

<expr>+<expr>

You can use single quotes to include double quotes and vice versa. So for your grammar, I would suggest the following solution:

<src> ::= '{"Ns": [3, '<es>']}'
<es> ::= <ds>, <ds>, <ds> | <ds>, <ds>, <ds>, <ds>
<ds> ::= 1<d> | 2<d>
<d> ::= 0 | 1 

BNF can be represented as a BNF. Single and double quotation is needed to do this. See the rule <literal> as example

from ponyge2.

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.