Documentation
¶
Overview ¶
Package ebnf lints the grammar files under docs/.
They are Wirth syntax notation rather than ISO 14977, so no ISO tool reads them. golang.org/x/exp/ebnf does: it documents this exact dialect, including the convention that an upper-case name is a nonterminal and a lower-case one is lexical. Parsing and reachability come from there.
What is here is the check no library makes. A quoted terminal has to be text lex turns into exactly one token, so a spelling the grammar invents is an error rather than a rule that could never match.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GrammarOptions = Options{Start: "File", LexSpellings: true}
GrammarOptions reads docs/grammar.ebnf.
var NotationOptions = Options{Start: "Grammar"}
NotationOptions reads docs/notation.ebnf, which describes the notation rather than TDL, so its quoted terminals are not TDL tokens.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// Start is the production everything must be reachable from.
Start string
// LexSpellings requires every quoted terminal to be text lex turns
// into exactly one token. It holds for a grammar of TDL and not for a
// grammar of anything else.
LexSpellings bool
}
Options say how to read one grammar file.