Context-free grammar 上下文无关文法
(重定向自Proper grammar)
In formal language theory, a context-free grammar (CFG)
is a formal grammar in which every production rule is of the form

where
is a single nonterminal symbol, and
is a string of terminals and/or nonterminals (
can be empty). A formal grammar is considered "context free" when its production rules can be applied regardless of the context of a nonterminal. No matter which symbols surround it, the single nonterminal on the left hand side can always be replaced by the right hand side. This is what distinguishes it from a context-sensitive grammar.