Next: , Previous: , Up: Terms   [Contents][Index]


5.4 Derivations

A step of a derivation, or derivation step, is a change made to a symbol string by applying one of the rules from the grammar. The rule must be one of those with a LHS that occurs in the symbol string. The result of the derivation step is another symbol string, one in which an occurrence of the LHS symbol from the rule is replaced by the RHS of the rule. For example, if A, B, C, D, and X are symbols, and

    X ::= B C

is a rule, then

    A X D -> A B C D

is a derivation step,

A derivation is a sequence of derivation steps. The length of a derivation is its length in steps.

Pedantically, a symbol X and a string that consists of only that symbol are two different things. But we often say “the symbol X”, or “X”, as shorthand for “the string of length 1 whose only symbol is X”. For example, if the string containing only the symbol X derives a string Y, we will usually say simply that “X derives Y”.

Wherever symbol or string X derives Y, we may also say X produces Y. Derivations are often described as symbol matches. Wherever symbol or string X derives Y, we may also say that Y matches X or that X matches Y. It is particularly common to say that X matches Y when Y is a sentence.

The parse of an input by a grammar is successful iff, according to the grammar, the start symbol produces the input sentence. The set of all input sentences that a grammar will successfully parse is the language of the grammar.


Next: , Previous: , Up: Terms   [Contents][Index]