220 likes | 303 Vues
Learn how to write and test regular expressions and finite state machines with interactive tools provided by Jianguo Lu. Run simulations, generate diagrams, and construct automata step by step.
E N D
03-60-214: regular expression and automata Winter 2010 Jianguo Lu
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 Lu
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 Lu
select “save target as” Jianguo Lu
Construct and run a dfa from a text file Jianguo Lu
NFA //Type (a|b)*abb Fig 3. 23 in dragon book a b // input alphabet q0 q1 q2 q3 // Machine states q0 // the initial state q3 // final state q0 b q0 // transitions: input state, input symbol, output state q3 b q0 q1 a q1 q2 a q1 q3 a q1 q0 a q1 q1 b q2 q2 b q3 end Jianguo Lu
Construct a dfa in GUI Jianguo Lu
JFLAP: RENFADFAm. DFA Jianguo Lu