Compiler theory work nine

1. DFA minimization: Textbook P65 Question 9

 

 

 

 

FIG follows minimized DFA

 

 

 

 

 

 

 

 

 

It identifies the language described by the regular formula:

a(c*|{da}*)bb*

 

2. The minimum configuration of the DFA corresponding grammar

S→ 0A|1B

A→ 1S|1

B→0S|0

S→ 0A|1B→S→ 0(1S|1)|1(0S|0)→01S | 01 | 10S | 10 →(01 | 10)S | (01 | 10)→(01 | 10)*(01 | 10)

FIG follows minimized DFA

 

 

 

 

 

 

3. Top-down parsing, why backtracking is generated?

 Reason: grammar productions in question

4.P100 exercises 4, extracted repeatedly left common factor.

S→C$

C → bA | aB

A → a | aC | bAA

B → b | bC | aBB

 

Extracting common factor was left

S→C$

C → bA | aB

A → AD | Bars

D→ε|C

B → bE | aBB

E→ε|C

1. DFA minimization: Textbook P65 Question 9

 

 

 

 

FIG follows minimized DFA

 

 

 

 

 

 

 

 

 

It identifies the language described by the regular formula:

a(c*|{da}*)bb*

 

2. The minimum configuration of the DFA corresponding grammar

S→ 0A|1B

A→ 1S|1

B→0S|0

S→ 0A|1B→S→ 0(1S|1)|1(0S|0)→01S | 01 | 10S | 10 →(01 | 10)S | (01 | 10)→(01 | 10)*(01 | 10)

FIG follows minimized DFA

 

 

 

 

 

 

3. Top-down parsing, why backtracking is generated?

 Reason: grammar productions in question

4.P100 exercises 4, extracted repeatedly left common factor.

S→C$

C → bA | aB

A → a | aC | bAA

B → b | bC | aBB

 

Extracting common factor was left

S→C$

C → bA | aB

A → AD | Bars

D→ε|C

B → bE | aBB

E→ε|C

Guess you like

Origin www.cnblogs.com/CMean/p/11813126.html