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
1 answer

Removal of regex terminal from AST returned by lark-parser

I am interested in parsing typical output of a website crawler using lark. Here is an example of some sample output based on my own github website: -------------------------------------------------------------------- All found…
user32882
  • 5,094
  • 5
  • 43
  • 82
0
votes
1 answer

Explain BNF syntax for NID in RFC 2141

I am having trouble understanding some BNF syntax from RFC2141. The line is ::= [ 1,31 ]. I think it means that is a symbol for a string, with constrained by two rules: The string must be begin with a single…
smartcaveman
  • 41,281
  • 29
  • 127
  • 212
0
votes
1 answer

How to implement a "return" number with statements in EBNF?

Here is my current grammar: program -> stmt-sequence stmt-sequence -> statement { TT_NEWLINE statement } assign-stmt -> var identifier TT_EQ factor print-stmt -> print factor add-stmt -> add factor TT_COMMA factor sub-stmt …
Jack Murrow
  • 396
  • 3
  • 11
0
votes
0 answers

How to covert bnf to ebnf from that !? bnf ::= DCd | DC

How to covert bnf to ebnf from that !? BNF ::= DCd | DC EBNF ::= D[}C[d] or ::= D[C[d]] (i think that what wrong in grammar?)
ฺBUGS
  • 1
  • 1
0
votes
0 answers

EBNF to BNF convert for the expression of <<'while'>> ::= while <'Z'> do begin <'A'> { <'A'> } end

I'd like to convert EBNF to BNF. <<'while'>> ::= while <'Z'> do begin <'A'> { <'A'> } end ; How can I do this?
ashley
  • 1
0
votes
0 answers

Syntax of a language in BNF, how to indicate the "other similar" options

I'm tryting to write a small language syntax using BNF style. I came to an option like this: option ::= 'option1' | 'option2' | 'read' | 'write' | etc The first four options are as example of what values the option can have, but I can't enumerate…
Avah
  • 227
  • 3
  • 13
0
votes
1 answer

How do I get a railroad diagram (syntax diagram) in Docbook starting from an EBNF source file?

Docbook 5 apparently supports EBNF. But it doesn't output a railroad diagram. Is it possible to make it output a railroad diagram (AKA syntax diagram)?
Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120
0
votes
1 answer

How to implement the priority of expressions Bakus-Naur Form

There is a grammar of this kind described in the documentation: grammar = | ['()'] ['$'] {'#' &'#'} '#' | ['()'] {'#' &'#'} '#%' | ['()'] ['$'] {'0' &'0'} '0' | ['()'] {'0' &'0%'} '0%' | ['()'] ['$'] {'#' &'0'} {'0' &'0'}…
MadInc
  • 1
  • 3
0
votes
1 answer

How to optimze grammar for Lark parser

My goal is to create a parser which can be used to parse DBC files. The syntax of the fileformat is given here. To achive this I choose the Lark-parser based on the excellent JSON parser tutorial. I created a grammar file based on the above linked…
handras
  • 1,548
  • 14
  • 28
0
votes
1 answer

Python EBNF how to read

So I came across the grammar for the Python language (https://docs.python.org/3/reference/grammar.html) and I cannot fully understand how it works. Especially, I'm interested in this snipped about if statements. if_stmt: 'if' namedexpr_test ':'…
a.ilchinger
  • 398
  • 4
  • 13
0
votes
1 answer

Understanding ANTLR/EBNF parentheses

The ANTLR Reference Guide says about parentheses as follows: On the other hand, I have the following grammar: fragment LOWERCASE : [a-z] ; fragment UPPERCASE : [A-Z] ; fragment DIGIT : [0-9] ; WORD : (LOWERCASE | UPPERCASE | DIGIT…
isaac.hazan
  • 3,772
  • 6
  • 46
  • 76
0
votes
1 answer

How to create EBNF grammar for a list in xtext?

I m trying to create a list in xtext, If anybody can help me to create a grammar for that, it will be really helpful. I tried writing this but its not the xtext format so i getting errors on that. List: 'List' name=ID type = Nlist; Nlist: Array…
gigahex
  • 367
  • 1
  • 5
  • 14
0
votes
1 answer

Is there a BNF,ENBF standard?

I found a lot of information about BNF and EBNF on Google, but they are not uniform, so I want to ask if there are any standards for BNF and EBNF?
Daniel Lee
  • 65
  • 1
  • 6
0
votes
1 answer

How do I Convert EBNF to BNF?

I had a question while I was studying for my university project. I found out about the grammar of BNF and EBNF by searching the internet. (1) I need to convert this phrase to EBNF. ::= | | So I did this…
soncho
  • 113
  • 2
  • 6