Questions tagged [bnf]

BNF stands for Backus-Naur Form, or Backus Normal Form. It is a form of notation for context-free grammars and is often used for (but is not restricted to) the description of the syntax of programming languages. In addition to programming languages, it is also used to describe communication protocols and document formats.

A BNF specification is a set of derivation rules, written as

<symbol> ::= __expression__

where <symbol> is a nonterminal, and the __expression__ consists of one or more sequences of symbols; more sequences are separated by | indicating a choice, the whole being a possible substitution for the symbol on the left. Symbols that never appear on a left side are terminals. On the other hand, symbols that appear on a left side are non-terminals and are always enclosed between the pair <>. The ::= means that the symbol on the left must be replaced with the expression on the right.

561 questions
14
votes
7 answers

_Actual_ Twitter format for hashtags? Not your regex, not his code-- the actual one?

Update: Use Twitter's Entities if you can- they figured it out for you as well as other items. My case is that I just have the tweet without entities and all the extra metadata I've spent what I consider an unreasonable amount of time trying to find…
dethSwatch
  • 1,152
  • 1
  • 10
  • 18
14
votes
2 answers

EBNF or BNF for the LOGO programming language

Does anyone know where I can get the BNF or EBNF for the LOGO programming language?
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
14
votes
5 answers

Are there tools to convert between ANTLR and other forms of BNF?

Are there any tools to convert ANTLR grammar syntax to and from other BNF syntaxes? There are several forms Backus-Naur Form (BNF, EBNF, ABNF, W3C-BNF, XBNF...) with specification, e.g. see this list. The ANTLR grammar syntax only seems to be…
Jakob
  • 3,570
  • 3
  • 36
  • 49
14
votes
2 answers

Converting EBNF to BNF

It's been a few years since my computer-language class and so I've forgotten the finer points of BNF's and EBNF's and I don't have a textbook next to me. Specifically, I've forgotten how to convert an EBNF into BNF. From what little I remember, I…
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
13
votes
2 answers

Is there a BNF grammar openly available for JavaScript ES6?

I am working on a merge tool for JavaScript programs, and I need to write a grammar for JavaScript (version >= ES6) in JavaCC format. For that, I want to use an openly available BNF grammar for ES6, then I would write the grammar in JavaCC format…
12
votes
1 answer

Pin & recoverWhile in a .bnf (Parsing)

I've searched the internet far and wide (for at least half a day now) and I can't seem to find the answers needed. Currently I'm trying to create a .bnf-file for an IntelliJ-Plugin with custom language support. A few tutorials mention the existance…
Fuchs
  • 133
  • 6
11
votes
2 answers

What is the easiest way of telling whether a BNF grammar is ambiguous or not?

Namely, is there a tool out there that will automatically show the full language for a given grammar, including highlighting ambiguities (if any)?
user456584
  • 86,427
  • 15
  • 75
  • 107
11
votes
4 answers

Any BNF IDE with test features

I'm working on a new language and while writting the grammar I'd like to be able to test the grammar for completeness, conflicts and similar. I'm not really concern about the underlaying parser generator (but one for .NET would be preferrable) So…
Rune FS
  • 21,497
  • 7
  • 62
  • 96
11
votes
3 answers

What is the BNF for a regex (in order to write a full or partial parser)

I am interested in parsing regexes (not to be confused with using regexes for parsing). Is there a BNF for Java 1.6 regexes (or other languages?) [NOTE: There is a similar older question which did not lead to an answer for Java.] EDIT To explain why…
peter.murray.rust
  • 37,407
  • 44
  • 153
  • 217
10
votes
4 answers

Where can I get material for learning EBNF?

Extended Backus–Naur Form: EBNF I'm very new to parsing concepts. Where can I get sufficiently easy to read and follow material for writing a grammar for the boost::spirit library, which uses a grammar similar to EBNF? Currently I am looking into…
yesraaj
  • 46,370
  • 69
  • 194
  • 251
10
votes
1 answer

extract BNF grammar rules from yacc file

I have a yacc file describing a certain language for which i am developing an Editor using IMP (eclipse project).I am using LPG as a parser generator, so I needed to extract a BNF rules from my yacc file. the yacc file i received contains rules and…
lferasu
  • 185
  • 2
  • 10
10
votes
1 answer

Scala Parser Token Delimiter Problem

I'm trying to define a grammar for the commands below. object ParserWorkshop { def main(args: Array[String]) = { ChoiceParser("todo link todo to database") ChoiceParser("todo link todo to database deadline: next tuesday context:…
BefittingTheorem
  • 10,459
  • 15
  • 69
  • 96
10
votes
3 answers

Z80 ASM BNF structure... am I on the right track?

I'm trying to learn BNF and attempting to assemble some Z80 ASM code. Since I'm new to both fields, my question is, am I even on the right track? I am trying to write the format of Z80 ASM as EBNF so that I can then figure out where to go from there…
Gary Paluk
  • 1,038
  • 1
  • 14
  • 28
9
votes
4 answers

BNF notation of T-SQL

Do you know where can I get the BNF (Backus Naur Form) notation for the latest version of T-SQL from. This is the microsoft version and I can't find anything for it. I found SQL2 The revised ISO standard here also called SQL92 but it seems to lack…
Mihail Shishkov
  • 14,129
  • 7
  • 48
  • 59
9
votes
2 answers

What is wrong with this ParseKit BNF?

I'm using ParseKit for objective-C which takes a BNF-like syntax for specifying grammers: @start = command+; command = new; new = 'new' object ';'; object = 'house' | other; Inclusion of the last line causes an error. Basically I want to say an…
FBryant87
  • 4,273
  • 2
  • 44
  • 72
1
2
3
37 38