Strt Puse Step Noninverted Tree A Visul nd Interctive Input Automt String ccepted! 5 nodes generted. Theory Course with JFLAP 4.0 q0 even 's, even 's q2 even 's, odd 's q1 odd 's, even 's q3 odd 's, odd 's S S S B B! Ryn Cvlcnte Thoms q4 Finley Susn H. Rodger S S B! This work ws supported y: Ntionl Science Foundtion DUE-9752583 Derived! from B. Derivtions complete. Deprtment of Computer Science Duke University Mrch 4, 2004
Outline Why develop Tools? Previous Work Wht is JFLAP? How Does JFLAP Fit In Automt Course? JFLAP's Use in the Course New Fetures of JFLAP Feedck nd Use of JFLAP JFLAP's Future
Students Redy to Lern Automt Theory!
Things strt well enough...
But soon, insted of pictures, there re WORDS.
Big words! The type with more thn one syllle!
VIOLENCE AMONG STUDENTS AS NERVES FRAY!
We only wnted to lern utomt theory! Isn t there etter wy?
Try JFLAP...
Students Lerning Automt with JFLAP
Why Develop Tools for Automt Theory? Different Representtions of Presenttion Textul Tulr Visul q0 q1 q2 Interctive q0 q1 q2
Why Develop Tools for Automt Theory? Different Representtions of Presenttion Exmined 10 utomt theory textooks in pst 11 yers (Tylor, Cohen, Sipser, Kelley, Linz, Sudkmp, Lewis, Kiner, Hopcroft, Mrtin) One hd softwre integrted for prt of the ook (Tylor) All hd visul representtion of DFA Only 6 hd visul representtion for PDA Those hd few visul exmples, only 2 or 3 sttes Only 6 hd visul representtion for Turing mchine 3 of those switched different visul representtion Only 2 hd picture of NPDA creted in CFG to NPDA trnsformtion None hd picture of prse tree for unrestricted grmmr
Previous Work on Automt Tools y Others Turing's World - Brwise nd Etchemendy (1993) Deus Ex Mchin - Svoiu (seven models of computtion) Models of Computtion nd Forml Lnguges - Tylor (1998) Snpshots of the Theory of Computing - Ross (2002)
Our Previous Work on Automt Tools JFLAP - creting nd experimenting with utomt nd grmmrs (SIGCSE 2000, SIGCSE 1999, SIGCSE 1997) JeLLRp - LL nd LR prsing (SIGCSE 1997) Pâté - Brute force prser, grmmr trnsformer (SIGCSE 1997) Lsys - creting L-systems The new JFLAP incorportes concepts from ll of these.
Thnks to Students Who Hve Worked on JFLAP nd Automt Theory Tools NPDA - 1990, C++ Dn Cugherty FLAP - 1991, C++ Mrk LoScco, Greg Bdros JFLAP - 1996-1999, Jv version Eric Grmond, Ted Hung, Mgd nd Octvin Procopiuc Pâté, JeLLRp, Lsys Ann Bilsk, Json Slemme, Lenore Rmm, Alex Krweit, Royn Geer JFLAP 4.0-2003 Thoms Finley, Ryn Cvlcnte
Wht is JFLAP? Jv Forml Lnguges nd Automt Pckge Instructionl Tool to lern concepts of Forml Lnguges nd Automt Theory Regulr lnguges - crete DFA NFA regulr grmmr regulr expression q0 q2! q1 Regulr lnguges - conversions q0 q1 NFA DFA Miniml DFA NFA regulr expression NFA regulr grmmr 0 q2 0,1,2 0,1
Wht is JFLAP? (cont) Context-free lnguges - crete Strt Puse Step Noninverted Tree,! ;,! ; push-down utomton context-free grmmr Context-free lnguges - trnsform PDA CFG CFG PDA (LL prser) CFG PDA (LR prser) CFG CNF Input CFG LL prse tle nd prser CFG LR prse tle nd prser q0!, S ;! String ccepted! 5 nodes generted. S S S B B! CFG Brute force prser Derived! from B. Derivtions complete. S S q1 B!!, Z ;! q2
Wht is JFLAP? (cont) Recursively Enumerle lnguges Turing mchine (1-tpe) Turing mchine (multi-tpe) unrestricted grmmr unrestricted grmmr rute force prser L-Systems Crete L-systems
How JFLAP Fits Into Topics In Forml Lnguges Course Topic JFLAP 3.1 JFLAP 4.0 Finite Automt 1 1 Regulr Grmmrs/Expressions ¾ 1 Properties of Regulr Lnguges ½ Context-Free Grmmrs ½ 1 Simplify CFL 1 Pushdown Automt 1 1 Properties of CFL Turing Mchine (1-Tpe) ½ ¾ Other Models of TM ¼ ½ Recursively Enumerle Lnguges ¼ LL nd LR Prsing 1 L-Systems 1
How JFLAP Fits Into Topics In Forml Lnguges Course Summry JFLAP 3.1 covers 4 chpters of mteril spred out over 6 chpters. JFLAP 4.0 covers 9 chpters of mteril spred out over 11 chpters.
Use of JFLAP y Instructor Showing how to lyout items Poor: q0 q1 q2 q2 Better: q0 q1
Use of JFLAP y Instructor Is this correct for n n c n? ; 1, R 2 ; 2, R ;, R q1 ; 2, R 3 ; 3, R ;, R q2 c ; 3, L ;, L ;, L 3 ; 3, L 2 ; 2, L q0 1 ; 1, R q3 2 ; 2, R q4 How do we fix it?
Use of JFLAP y Instructor Experimenting with Difficult Concepts Nondeterminism: ww R Students ttempt t desk - difficult: wnt to find the middle Instructor solves with clss using JFLAP,! ;,! ;, ;!, ;!, ;!, Z ; Z, Z ; Z q0 q1, ;! q2 q3!, Z ; Z
Use of JFLAP y Instructor Testing Student Progrms ;, R! ;, R ;, R ;, L q0 ;, S! ;!, L q1 c ; c, R ; c, R q2 c ; c, S! ;!, R! ;!, R! ;!, R q3
Use of JFLAP y Instructor Relte to other CS Concepts Running Time Consider n n c n one-tpe TM O(n 2 ) two-tpe TM O(n)
Other Uses of JFLAP y Instructor Demonstrte Nondeterminism Demonstrte the running of CFG to PDA using LR method Which lookhed do you choose? Demonstrte trnsformtion from one form to nother Exmple: PDA to CFG And mny other uses...
JFLAP Student Use Recrete nd experiment with instructor s exmples Use with Homework A study id - crete dditionl exmples explore concepts in depth weker students get more feedck
Feedck from Students in CPS 140 Duke University - Spring 2003 Used JFLAP nd tools in 6 of 9 homeworks Questionnire - 33 responses Ws JFLAP esy to use? All 33 nswered yes. Did you look t the help t ll? If so, wht prt did you look t nd ws it helpful? 6 used help nd found it helpful, 27 did not look t help. Do you prefer creting FA using JFLAP or drwing them on pper? 17 students - prefer to use JFLAP 12 students - prefer pper first, then JFLAP for testing 2 students - prefer pper
New Fetures in JFLAP 4.0 RE FA reworked Brute force prsing Trnsform CF Grmmrs to Chomsky LL(1) nd SLR(1) prsing L-Systems Minor New Fetures in JFLAP 4.0 Compre Equivlence Comine Automt Grph Lyout 3-5 Tpe Turing Mchines
Finite Automt Editing nd Simultion The most sic feture of JFLAP hs lwys een the cretion of utomt, nd simultion of input on utomt. Here we demonstrte the cretion nd simultion on simple NFA.
FA Edit & Simultion Strt up JFLAP When we strt up JFLAP we hve choice of structures. The first of these is the Finite Automt!
FA Edit & Simultion Strt Editing! We strt with n empty utomton editor window.
FA Edit & Simultion Crete Sttes q0 q2 We crete some sttes... q1
FA Edit & Simultion Crete Trnsitions q0 c q2 We crete some trnsitions... q1
FA Edit & Simultion Initil nd Finl Stte c We set n initil nd finl stte. q0 q1 q2 Now we cn simulte input on this utomton!
FA Edit & Simultion Input to Simulte... When we sy we wnt to simulte input on this utomton, dilog sks us for the input.
FA Edit & Simultion Strt Simultion! q0 q1 c q2 When simultion strts, we hve configurtion on the initil stte with ll input remining to e processed.
FA Edit & Simultion After One Step q0 q1 c q2 This is nondeterministic FA, nd on this input we hve multiple configurtions fter we Step.
FA Edit & Simultion q0 After Two Steps The previous configurtions on c q2 q 1 nd q 2 re rejected, nd re shown in red. q1 The remining uncolored configurtions pths re not rejected, nd re still open.
FA Edit & Simultion After Three Steps c q0 q1 q2 Yet nother step.
FA Edit & Simultion After Four Steps c q0 q1 q2 One of the finl configurtions hs een ccepted!
FA Edit & Simultion Trceck One cn then see trceck to see the succession of configurtions tht led to the ccepting configurtion.
RE to FA New pproch strts with single RE trnsition in GTG, nd recursively reks RE trnsitions into norml FA trnsitions until the GTG ecomes n FA.
FA to RE New lgorithm trnsforms n FA to GTG, nd removes sttes until the GTG hs only the initil nd finl sttes. At this point conversion ecomes trivil. (+)(+) *
Amiguous Grmmr Prsing with SLR One cn lso prse strings with grmmrs in JFLAP using LL(1) or SLR(1) prsing. To the right is trivil, oviously miguous grmmr. We show how SLR(1) dels with miguity.
SLR(1) Prsing In order, students: Define First nd Follow Sets Build the FA modeling stck. Define the prse tle. Ornge entries indicte conflict in the prse tle. Current ctive vlue is displyed.
SLR(1) Prsing Suppose we prse with current conflicts oth set to the defult reduce entries. As students step, the prse tle entry eing used nd grmmr rule used (if reduce) is highlighted. Notice lso the input remining nd the stck.
SLR(1) Prsing Shown is the completed prse tree. Well done!
SLR(1) Prsing Recll the conflicts. When we click on the ornge entry, we cn choose different entry to resolve the conflict. In this cse we chnge the reduce opertions to shift opertions.
SLR(1) Prsing Notice, this chnge results in very different prse tree.
SLR(1) Prsing With Reduce Entries With Shift Entries
Brute Force Prsing Brute force prsing llows oth CFG nd unrestricted grmmr prsing. To the right is n unrestricted grmmr tht genertes the lnguge n n c n. We cn uild the unrestricted prse tree!
Brute Force Prsing We prse the string cc with the rute force prser. Notice how in this cse multiple nonterminl nodes re grouped together to form single node. This ccomplishes the unrestricted grmmr possily replcing multiple symols t once.
L-Systems L-Systems my e used to model iologicl systems nd crete frctls. Similr to Chomsky grmmrs, except ll vriles re replced in ech derivtion step, not just one! Commonly, strings from successive derivtions re interpreted s strings of render commnds nd re displyed grphiclly.
L-Systems This L-System renders s tree tht grows lrger with ech successive derivtion step.
L-Systems L-systems my lso e stochstic. The T Tg rule dds g to the derivtion, which drws line segment. We dd nother rewriting rule for T, T T. With two rewriting rules for T, the rule chosen is rndom, leding to uneven growth!
L-Systems The sme stochstic L-system, rendered 3 different times ll t the 9th derivtion.
Compre for Equivlence Determines if two FA recognize the sme lnguge. e q4 q0 q5 e e c d q0 c q1 d q2 q1 c q2 c q3
Multiple Tpe Turing Mchines For exmple, with 3 tpes, you cn reltively esily define Universl Turing Mchine. 1 ; 1, R 1 ; 1, S 1 ; 1, R 1 ; 1, S 1 ; 1, S! ;!, R 1 ; 1, S 0 ; 0, R 1 ; 1, S 1 ; 1, S! ;!, R 1 ; 1, S 1 ; 1, S 1 ; 1, S 1 ; 1, L 1 ; 1, R 1 ; 1, S 1 ; 1, S q11 q7 Rewind T3 Skip 4 T1 0s 1 ; 1, R 1 ; 1, S 1 ; 1, S 0 ; 0, R 1 ; 1, S 1 ; 1, S 0 ; 0, R 1 ; 1, S! ;!, L 0 ; 0, L 1 ; 1, S 1 ; 1, S 1 ; 1, S 1 ; 1, S! ;!, L 1 ; 1, R 1 ; 1, S 1 ; 1, R 1 ; 1, S 1 ; 1, S 1 ; 1, L 1 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; 1, R 1 ; 1, S 0 ; 0, S 0 ; 0, R 1 ; 1, S q19 Prev 0 q18 Fst Forwrd T2 0 ; 0, S! ;!, L 1 ; 1, S q28 Skip Right
JFLAP s Use Around the World JFLAP we pge hs over 42,000 hits since 1996 Google Serch JFLAP ppers on over 2300 we pges JFLAP ppers on utomt theory clss wepges t over 40 US universities Note: serch only shows pulic we pges Note: ppers to e mny foreign sites JFLAP hs een downloded over 8000 times since Jn. 2003 JFLAP ppers in use (we pges or downlods) in over 40 countries
Future Work Filling in the missing pieces for utomt theory course JFLAP User mnul out in Decemer 2004 (Rodger, Finley) JFLAP Automt Theory textook out in Fll 2005 (Rodger, Linz) JFLAP is FREE!