# 5.1.1 Context-Free Grammars

一个*上下文无关文法*(context-free grammar)由一组*产生式*（productions）组成。每个产生式，左端（*left-hand side*）是一个被称为*非终结符*的抽象记号，右端（right-hand side）是

一个*上下文无关文法（context-free grammar）*&#x7531;一组*产生式（productions）*&#x7EC4;成。每个产生式有一个抽象符号称为*非终结符号（nonterminal）*&#x4F5C;为它的*左部（left-hand side）*，以及包含零个或多个非终结符号和*终结符号（terminal）*&#x7684;一个序列作为它的*右部（right-hand side）*。对于每个文法而言，终结符号都取自一个指定的符号表。

一个*链式产生式*是一个有一个非终结符号和零个或多个终结符号在右部的产生式。

从一个只包含一个独特的非终结符号（*目标符号，goal symbol*）的句子开始，一个给定的上下文无关文法定义了一种*语言（language）*，即终结符号序列的集合（甚至是无限的集合）。这些序列可以通过反复地把生成式序列中的非终结符号替换成以该非终结符号为左部的生成式的右部来生成。

A *context-free grammar* consists of a number of *productions*. Each production has an abstract symbol called a *nonterminal* as its *left-hand side*, and a sequence of zero or more nonterminal and *terminal* symbols as its *right-hand side*. For each grammar, the terminal symbols are drawn from a specified alphabet.

A chain production is a production that has exactly one nonterminal symbol on its right-hand side along with zero or more terminal symbols.

Starting from a sentence consisting of a single distinguished nonterminal, called thegoal symbol, a given context-free grammar specifies a *language*, namely, the (perhaps infinite) set of possible sequences of terminal symbols that can result from repeatedly replacing any nonterminal in the sequence with a right-hand side of a production for which the nonterminal is the left-hand side.上下文无关文法
