Questions tagged [ebnf-syntactic-exception]

As defined in the ISO EBNF (Extended BNF) standard, a syntactic-exception is a syntactic-factor that is an exception to another syntactic-factor with the meaning 'any of this pattern' except 'this'. For example, (letter - "A") means any letter except "A". The "A" is the syntactic-exception. Use with the [ebnf] tag.

ISO/IEC 14977:1996
Information technology — Syntactic metalanguage — Extended BNF

4.7 Syntactic exception

A syntactic-exception consists of a syntactic-factor subject to the restriction that the sequences of symbols represented by the syntactic-exception could equally be represented by a syntactic-factor containing no meta-identifiers.

5 questions
18
votes
2 answers

How to represent negation in BNF?

Does BNF or ABNF support negation. That is exclude certain members of the set? I did not see any such negation operator in its syntax. For example, suppose S is the set of all alphanumeric strings that are not equal to "foo" What is the BNF for S?
Jus12
  • 17,824
  • 28
  • 99
  • 157
6
votes
3 answers

What is the difference between EBNF and CFG

I understand that EBNF can be used to express Context Free Grammar, but is there any difference between the two? I am asking because there are questions that ask to convert EBNF to CFG, but as of my current understanding, they look same. Therefore,…
Shamim Hafiz - MSFT
  • 21,454
  • 43
  • 116
  • 176
5
votes
1 answer

Can extended Backus Naur Form (EBNF) describe an unordered set of values?

I'd like to define an unordered set of values using an Extended Backus-Naur Form (EBNF) context free grammar. It's easy to define an unordered list of values in EBNF, for example: value = 'A' | 'B' | 'C'; list = value, {',', value}; However, I'm…
2
votes
1 answer

Contents of exceptions in ISO EBNF

In the ISO 14977 EBNF standard, section 4.7, the legal contents of an exception is described. I'm fairly certain that an exception may consist of any valid syntactic factor, as long that it doesn't contain any meta-identifiers. Which means that…
Uran
  • 141
  • 2
  • 12
-1
votes
1 answer

Can't parse EBNF formula in python

import argparse from parglare import Grammar from parglare import Parser formula = r""" Formula : Number | (Formula Sign Formula) Number : '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' Sign : '+' | '-' """ grammar =…