--4 grammar compiler theory introduced species

Grammar Introduction

Chomsky establish formal language system in 1956, he put grammar into four types: type 0,1,2,3

Type 0

The phrase grammar, Turing machine

  • Production of the form:

$$
\alpha \rightarrow \beta
$$

  • among them:

$$
\ Alpha \ in (V_T \ V_n Cup) and having at least one nonterminal Beta \\ \ in (V_T \ Cup V_n)
$$

Type 1

Context-sensitive grammar, linear boundaries automaton

  • Production of the form:

$$
\alpha \rightarrow \beta
$$

  • among them:

$$
|\alpha|\le|\beta|,仅S \rightarrow \epsilon
$$

Type 1 generation grammar all left-hand side may contain one, two or more characters, but must have at least a nonterminal

Type 2

Context-free grammar, non-deterministic pushdown automaton

  • Production of the form:

$$
A \rightarrow \beta
$$

  • among them:

$$
A \in V_N; \space \beta \in (V_T \cup V_N)*
$$

Type 3

Formal grammars, finite automata

Right Linear Grammar

  • Production of the form:

$$
A\rightarrow \alpha B \space或 A \rightarrow \alpha
$$

  • among them:

$$
\alpha \in V_T*; \space A,B \in V_N
$$

Left linear grammar

  • Production of the form:

$$
A \rightarrow B \alpha \space 或 A \rightarrow \alpha
$$

  • among them:

$$
\alpha \in V_T*; \space A,B \in V_N
$$

Guess you like

Origin www.cnblogs.com/littlepage/p/12047647.html