Questions tagged [ebnf]

EBNF stands for Extended Backus-Naur Form, or Extended Backus Normal Form. It is an extension to BNF and is used to describe the syntax of context-free grammars, such as programming languages, document formats, or communication protocols. It improves over BNF by providing operators to express optional, zero or more, and one or more occurrences of a term. This makes EBNF much more expressive and concise compared to BNF.

EBNF is standardized format for documenting syntax. It includes an extension mechanism for defining a two-level grammar that can produce an infinite number of production rules.

References

354 questions
0
votes
2 answers

Context Free Grammar BNF

need help with a non-extended BNF grammar: Σ = {a,b,c} L = {ω ɛ Σ^* | such that all a's (if any) comes before all c's(if any)} For example, the strings aba, cbc, and abacbc are in the language, but string abcabc is not. This is what i have so far…
Jon Abraham
  • 851
  • 3
  • 14
  • 27
0
votes
1 answer

How to write the syntax grammar of this diagram

I am trying to write the syntax grammar of the below diagram but I didn't succeed. I tried Choice ::= letter ( ( 'digit' | '_' ) letter ) but it is totally wrong. How can I write the Syntax of this?
Amir Jalilifard
  • 2,027
  • 5
  • 26
  • 38
0
votes
1 answer

Project on flex and bison

I have used flex and bison in order to make a lexical analyzer and a parser for an EBNF grammar. This work is done! I mean, when i put a file with a program I write, I can see if the program has mistakes. If it doesn't, I can see the whole program…
j.d
  • 11
  • 3
0
votes
3 answers

How to read alternates in EBNF grammars

I have an EBNF grammar that has a few rules with this pattern: sequence ::= item | item extra* sequence Is the above equivalent to the following? sequence ::= item (extra* sequence)* Edit Due to some of you observing bugs or…
AJM
  • 655
  • 1
  • 9
  • 19
0
votes
1 answer

Source code for Railroad Diagram Generator Site

There is one problem with the railroad diagram generator. When given a grammar, you may have to tweak it, and subsequently modify it several times. This would be done more quickly locally. Is there a place where I can download the source code used…
0
votes
1 answer

Python Language Reference And Function Definitions

As I understand it, the python language reference is written in extended BNF format. While looking at the documentation for function definitions I noticed that the spec doesn't seem to support the usage of trailing *args or **kwargs…
limik
  • 39
  • 1
  • 3
0
votes
2 answers

Avoiding left recursion in parsing LiveScript object definitions

I'm working on a parser for LiveScript language, and am having trouble with parsing both object property definition forms — key: value and (+|-)key — together. For example: prop: "val" +boolProp -boolProp prop2: val2 I have the key: value form…
0
votes
1 answer

Regex-EBNF conversion issue python

Am new to python and am trying my hands on regex and EBNF. Am not sure if my conversion are accurate. I just need a second look at my conversions. EBNF REGEX a{a} (convereted from regex) a+ …
user2887981
0
votes
1 answer

ANTLR4 Token is not recognized when substituted

I try to modify the grammar of the sqlite syntax (I'm interested in a variant of the where clause only) and I'm keep having a weird error when substituting AND to it's own token. grammar wtfql; /* SQLite understands the following binary…
Augunrik
  • 1,866
  • 1
  • 21
  • 28
0
votes
2 answers

EBNF: "multiple variables = value"

Now I have A = a; B = a; C = a; Can I instead do A , B , C = a; or something similar?
user3582590
  • 187
  • 2
  • 4
  • 13
0
votes
2 answers

Coco/r: Factor deletable

I am trying to implement a language in Coco/r for arithmetic operations in C# which takes operator precedence into consideration. My ATG code looks like this: /* Coco/R lexer and parser specification for arithmetic expressions. */ /* 2006-09-14…
Comforse
  • 2,027
  • 4
  • 25
  • 40
0
votes
0 answers

BNF to standard EBNF

I am converting BNF dialect 2 to standard EBNF and making the grammar as simple as possible from this problem below. -> | ; -> | ; -> | ; here is my attempt that I followed along page…
Noobie
  • 65
  • 5
0
votes
1 answer

EBNF rule into BNF

Hi I am having a lot of trouble with this problem and I came across a lot of sites but found this post How to convert BNF to EBNF to be very helpful but I just don't know where to start with this example. -->…
Noobie
  • 65
  • 5
0
votes
0 answers

Antlr grammar with EBNF

I'm trying to generate a Lexer/Parser through a simple grammar using ANTLR. What I've done right now : grammar ExprV2; @header { package mypack.parte2; } @lexer::header { package mypack.parte2; } start : expr EOF {…
smart548
  • 41
  • 7
0
votes
1 answer

Understanding some XML EBNF

I am reading the XML specification and I can't quite understand this rule: CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) Here's what I think I understand: [^<&]* - Any amount of optional characters that are not < or & - Except if it matches ([^<&]*…
Lerp
  • 2,957
  • 3
  • 24
  • 43