Context-Free Grammar

A context‐free grammar consists of a number of productions. Each production has an abstract symbol called a “non‐terminal” as its left‐hand side, and zero or more possible sequences of non‐terminal symbols and or terminal characters as its right‐hand side.

Starting from a single goal non‐terminal symbol, a context‐free grammar describes a language: the set of possible sequences of characters that can be described by repeatedly replacing any non‐terminal in the goal sequence with one of the sequences it is defined by, until all non‐terminal symbols have been replaced by terminal characters.

Terminals are represented in this document in a monospace font in two forms: a specific Unicode character or sequence of Unicode characters (ex.=orterminal), and a pattern of Unicode characters defined by a regular expression (ex/[0-9]+/).

Non‐terminal production rules are represented in this document using the following notation for a non‐terminal with a single definition:

NonTerminalWithSingleDefinition

NonTerminal

terminal

While using the following notation for a production with a list of definitions:

NonTerminalWithManyDefinitions

OtherNonTerminal

terminal

terminal

A definition may refer to itself, which describes repetitive sequences, for example:

ListOfLetterA

a

ListOfLetterA

a

results matching ""

    No results matching ""