Seventh jobs - formal style to the regular grammar and Automata

Regular Expression to regular grammar

For any regular formula R selecting a nonterminal Z → Z generation rule R

1. rules of the form A → ab converted into A → aB, B → b

2. the form A → a | b rules, be converted into A → a, A → b (A → a | b)

3. The form A → a * b rules, be converted into A → aA, A → b

   The form A → ba * As a rule, be converted into A → Aa, A → b

Continue using the conversion rules, each rule comprising at most until a terminator far.

1(0|1)*101

S→A1

A→B0

B→C1

C→1(0|1)*

  -C→C(0|1)|1

  C → C0 | C1 | 1

(a|b)*(aa|bb)(a|b)*

S→(a|b)S

S→(aa|bb)(a|b)*

  -S→S(a|b)

  -S → aa | bb

Agriculture → aS | bS | Sa | Sb | aA | bB

A→a

B→b

((0|1)*|(11))*

S→((0|1)*|(11))S

A→(0|1)*,A→11

A→(0|1)A

A → 0A | 1A | 11

(0|11*0)*

S→(0|11*0)S

A→0|11*0

A→0,A→11*0

A→B0

B→B1|1

 

Automaton M = ({q0, q1, q2, q3}, {0,1}, f, q0, {q3})

Where f:

(q0,0)=q1

(q1,0)=q2

(Q2,0) = q3

(q0,1)=q0

(q1,1)=q0

(Q2,1) = q0

(Q3,0) = q3

(Q3,1) = q3

Videos the current state transition matrix and a state transition diagram.

(1) state transition matrix

  0 1
q0 q1 q0
q1 q2 q0
q2 q3 q0
q3 q3 q3

(2) a state transition diagram

 

3. configured by regular automatic machine NFA formula R 

(A | b) * abb

 

 

(a|b)(aa|bb)(a|b)*

 

 

1(1010*|1(010)*1)*0

 

 

Guess you like

Origin www.cnblogs.com/lxml/p/11717979.html