Finite Automata

11
COP 3402 System Software Spring 2008

description

Finite Automata. COP 3402 System Software Spring 2008. A Sample Automata. 1 is the start state 4 is the final state abc : recognized abccabc : recognized ac : not recognized. a. b. c. a. 1. 2. 3. 4. c. Identifiers and Keywords. A-Za-z. 1. 2. A-Za-z 0-9. - PowerPoint PPT Presentation

Transcript of Finite Automata

Page 1: Finite Automata

COP 3402 System SoftwareSpring 2008

Page 2: Finite Automata

1 is the start state 4 is the final state abc : recognized abccabc : recognized ac : not recognized

1 2 3 4a b c

a

c

Page 3: Finite Automata

1 2

A-Za-z 0-9

A-Za-z

Page 4: Finite Automata

Allows character ‘-’, e.g. Next_Line Can not begin with ‘-’ Can not have consecutive ‘-’

1 2

A-Z 0-9

A-Za-z 3-

A-Za-z 0-9

Page 5: Finite Automata

Can begin with 0, e.g. 000025

1 2

0-9

0-9

Page 6: Finite Automata

Can not begin with 0 Except integer 0, followed by space

1 2

0-9

0-9

3 4space

0

Page 7: Finite Automata

Can begin with “0” , e.g. 001.35 Can end with “.”, e.g. 12. Can end with “0”, e.g. 3.1400

Float Point Number

1 2

0-9

0-9 4.

0-9

Page 8: Finite Automata

Token Code

PROGRAM 2

VAR 2

BEGIN 2

END 2

END. 3

INTEGER 2

FOR 2

READ 2

WRITE 2

TO 2

DO 2

1 2

A-Za-z 0-9

A-Za-z

4

3.

0-9

0-9

5

;,+-*()

6 7: =

Page 9: Finite Automata

Token Code

; 5

: 6

, 5

:= 7

+ 5

- 5

* 5

DIV 2

( 5

) 5

id 2

int 4

1 2

A-Za-z 0-9

A-Za-z

4

3.

0-9

0-9

5

;,+-*()

6 7: =

Page 10: Finite Automata

Reserved WordsToken Code

null 1

begin 21

end 22

if 23

then 24

while 25

do 26

call 27

const 28

X 2

Y 2

A 2

0 n 1.

23i f

33

u 34

l 35

l

21

.36

e 37

g 38

ib 39

n

2240

n 41

de

42

Page 11: Finite Automata

Special SymbolsToken Code

+ 4

- 5

* 6

/ 7

= 9

( 15

) 16

, 17

; 18

. 19

0

4

7/

6

+

*

5-

9=

15(