DFA Minimization, Acceptor - Compiler Construction - Lecture Slides, Slides of Compiler Construction

DFA Minimization, Hopcroft algorithm, Equivalent states, Transitions, Optimized Acceptor, Lexical Analyzers, Multiple RE descriptions are basic concepts discussed of course.

Typology: Slides

2011/2012

Uploaded on 11/03/2012

ekavia
ekavia 🇮🇳

4.3

(58)

241 documents

1 / 31

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Compiler
Construction
Lecture 9
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download DFA Minimization, Acceptor - Compiler Construction - Lecture Slides and more Slides Compiler Construction in PDF only on Docsity!

Compiler

Construction

Lecture 9

2

DFA Minimization

 The generated DFA may

have a large number of

states.

 Hopcroft’s algorithm:

minimizes DFA states

4

DFA Minimization

 Idea: find groups of

equivalent states.

 All transitions from

states in one group G 1

go to states in the same

group G 2

5

DFA Minimization

 Idea: find groups of

equivalent states.

 All transitions from

states in one group G 1

go to states in the same

group G 2

7

DFA Minimization

DFA for (a | b )abb*

A

a

b a

b b B D E

C

a

b

b

a

a

8

DFA Minimization

Minimized DFA for (a | b )abb*

A,C

b a b b B D E a

b

a

a

10

Lexical Analyzers

 Lexical analyzers (scanners)

use the same mechanism

 but they:

  • Have multiple RE descriptions for multiple tokens
  • Have a character stream at the input

11

Lexical Analyzers

 Lexical analyzers (scanners)

use the same mechanism

 but they:

  • Have multiple RE descriptions for multiple tokens
  • Have a character stream at the input

13

Lexical Analyzers

  • Return a sequence of matching tokens at the output (or an error)
  • Always return the longest matching token

14

Lexical Analyzers

  • Return a sequence of matching tokens at the output (or an error)
  • Always return the longest matching token

16

Lexical Analyzer Generators

 The lexical analysis process

can automated

 We only need to specify

  • Regular expressions for tokens
  • Rule priorities for multiple longest match cases

17

Lexical Analyzer Generators

 The lexical analysis process

can automated

 We only need to specify

  • Regular expressions for tokens
  • Rule priorities for multiple longest match cases

19

Lexical Analyzer Generators

 Flex

generates lexical analyzer in C

or C++

 Jlex

written in Java. Generates

lexical analyzer in Java

20

Using Flex

 Provide a specification file

 Flex reads this file and

produces C or C++ output file

contains the scanner.

 The file consists of three

sections