In computer science, the most common type of grammar is context-free grammar .
The meaning of the term "context-free" is that context-free languages do not allow the expression of context dependence.
For example, in the C language, an expression a * b
, depending on the values a
and b
can mean a pointer declaration, or a multiplicative expression. Context-free grammars are drop-down, that is, some objects denoting an entity of the language are expressed in terms of other objects, which in turn can be expressed in terms of third objects, and so on.
“a * b” 既可以表示 定义一个指针a类型的指针变量b,又可以表示a与b的乘积,所以这是环境无关的,与环境不依赖的。