A grammar G is defined as a 4-tuple (VN,VT,P,S )VNis a set of nonterminalsVTis a set of terminalsP is a set of productions,each production consists of a left side,an arrow(or ‘::=’),and a right sideS is a designation of one of the nonterminalsas the start symbolV =VN ∪ VT is the alphabet of G
A. 对
B. 错
Type 3: context-free grammarsProductions are of the form X→v where v is an arbitrary string of symbols in V, and X is a single nonterminal. Wherever you find X, you can replace with v (regardless of context).
A. 对
B. 错
Type 1: free or unrestricted grammars.These are the most general. Productions are of the form u→v where both u and v are arbitrary strings of symbols in V, with u non-null. There are no restrictions on what appears on the left or right-hand side other than the left-hand side must be non-empty.
A. 对
B. 错
Type 2: context-sensitive grammars.Productions are of the form uXw→uvw where u , v and w are arbitrary strings of symbols in V, with v non-null, and X a single nonterminal. In other words, X may be replaced by v but only when it is surrounded by u and w . (i.e. in a particu lar context).
A. 对
B. 错