Backus-Naur form is technique for describing context-free grammars.
The difference in clarity between specifications using BNF and ones using informal English is enormous. The following EBNF is unlikely to translate to brief English:
number ::= "-"? (positiveInteger fraction? | "0" fraction)
| "0"
And even if it was short it wouldn't let you generate this for free (using GrammKit):
I think Haskell would be a natural fit for this kind of work, and so did a survey of the ecosystem to see what's been built so far. If no Haskell solution is available I list the best non-Haskell one.
Here are my goals:
Simply make sure a BNF file is valid.
ABNF: None yet. Perhaps a wrapper around parseABNF should be built.
EBNF: None yet. Ebnf2ps could do this, but it would also try to generate diagrams.
A clean, general Haskell data type that can be used by other libraries.
ABNF: [Rule]
EBNF: None yet.
ABNF: None yet.
EBNF: GrammKit is great for generating SVGs if you just need an executable (it's not Haskell). Ebnf2ps generates PostScript files.
Supported: ABNF
Summary: "Parse ABNF and generate parsers for the specified document"
Supported: EBNF
Summary: "Generate PostScript diagrams from an EBNF grammar"
Supported: Labelled BNF
Summary: "Given a Labelled BNF grammar the tool produces: an abstract syntax as a HaskellC++C module or Java directory, a case skeleton for the abstract syntax in the same language, an Alex, JLex, or Flex lexer generator file, a Happy, CUP, or Bison parser generator file, a pretty-printer as a HaskellJavaC++/C module, a Latex file containing a readable specification of the language."
Supported: Labelled BNF
Summary: Embed LBNF within Haskell using Template Haskell
Supported: EBNF
Summary: "A library & program that builds parsers from ISO EBNF using Parsec"