jianguo lu 1 03-60-214: regular expression and automata winter 2010

Post on 18-Jan-2016

221 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Jianguo Lu1

03-60-214: regular expression and automata

Winter 2010

Jianguo Lu2

Try RegexTester

• Running at course web site as an applet;– http://cs.uwindsor.ca/~jlu/214/regex_tester.htm

• Write regular expressions and try the match(), find() methods;

Jianguo Lu3

Try FSM simulator

• Run the simulator – The java code can be downloaded at

• http://cs.uwindsor.ca/~jlu/214/fsm.zip

– Unzip the zip file • >unzip fsm.zip

– Go to the directory fsmsim_bgm/classes– Run the java program: >java FSM

• Define the FSM in the text file;– The text files are in fsm-sources

• Generate the transition diagram;– Machine/new machine

• Run the simulator and observe how strings are recognized.

Jianguo Lu4

• select “save target as”

Jianguo Lu5

Construct and run a dfa from a text file

Jianguo Lu6

NFA //Type(a|b)*abb Fig 3. 23 in dragon booka b // input alphabetq0 q1 q2 q3 // Machine statesq0 // the initial stateq3 // final stateq0 b q0 // transitions: input state, input

symbol, output stateq3 b q0q1 a q1q2 a q1q3 a q1q0 a q1 q1 b q2 q2 b q3end

Jianguo Lu7

Jianguo Lu8

Jianguo Lu9

Jianguo Lu10

Construct a dfa in GUI

Jianguo Lu11

Jianguo Lu12

JFLAP: RENFADFAm. DFA

Jianguo Lu13

Jianguo Lu14

Jianguo Lu15

Jianguo Lu16

Jianguo Lu17

Jianguo Lu18

Jianguo Lu19

Jianguo Lu20

Jianguo Lu21

Jianguo Lu22

top related