二元文法和一元文法
Noam Chomsky gave a mathematical model of grammar. This model is used to write computer languages effectively.
诺姆•乔姆斯基 ( Noam Chomsky)给出了语法的数学模型 。 该模型用于有效地编写计算机语言。
A grammar can be represented as a 4 tuple:
语法可以表示为4元组:
(N, T, P, S)
(N,T,P,S)
N denotes the set of variables or non-terminal symbols.
N表示变量或非结束符号的集合。
T denotes the set of terminal symbols.
T表示终端符号集。
S is a special variable called start symbol and S belongs to N.
S是一个特殊的变量,称为开始符号, S属于N。
P is production rules for terminals and non-terminals α → β, where α and β are strings on VN ∪ ∑ and least one symbol of α belongs to VN.
P是用于终端和非端子α→β,其中α和β是在VN∪Σ串和至少一个符号的α属于VN产生式规则。
Example:
例:
Grammar G1 − ({S, C, D}, {c, d}, S, {S → CD, C → c, D → d})
语法G1 −