shexSpec / grammar

ShEx grammar
MIT License
3 stars 1 forks source link

BNF or EBNF? #11

Open mistermboy opened 5 years ago

mistermboy commented 5 years ago

Taking a look to the bnf makes me wonder if it would be an EBNF instead of a BNF

I compared this syntax with the sprql EBNF grammar and they look the same.

Other references: https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form http://xahlee.info/parser/bnf_ebnf_abnf.html

ericprud commented 5 years ago

That's a very good question. SPARQL 19.8 Grammar passes the buck to XML 'cause some slacker author of the SPARQL 1.0 spec was trying to duck the whole naming question. XML 6 Notation claims that it's EBNF and immediately uses the BNF rule notation (symbol ::= expression). XML's (E-ish)BNF is pretty widely used and has inter-operable running code, though no name.

ShEx spec 6 Grammar deliberately avoids labeling the grammar language:

Below is the ShExC grammar following the notation in the XML specification[XML]:

PROPOSE: no change to spec, maybe a comment in the bnf document and some effort to make sure that the bnf doc isn't out of sync with the spec.

gkellogg commented 5 years ago

Definitely EBNF, which could use its own spec. There are some W3C conventions that go beyond what’s in the XML documents.

Strict BNF would not include “*”, “+”, and such. However, it needs to be turned into BNF via transformation for an LL parser to make use of it.