61
A Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley Susan H. Rodger Department of Computer Science Duke University March 4, 2004 This work was supported by: National Science Foundation DUE-9752583 b a b b a a a b q1 odd a's, even b's q0 even a's, even b's q3 odd a's, odd b's q2 even a's, odd b's B b b a ! S S

A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

A Visual and Interactive Automata Theory Course with JFLAP 4.0

Ryan Cavalcante Thomas Finley

Susan H. Rodger

Department of Computer Science Duke University

March 4, 2004

This work was supported by: National Science Foundation DUE-9752583

b

a

b

b

a

a

a

b

q4

q1

odd a's, even b's

q0

even a's, even b's

q3

odd a's, odd b's

q2

even a's, odd b's

Derived ! from B. Derivations complete.

Bb

ba

!

S

SS aSbS bBB !

Noninverted TreeStepPauseStart

String accepted! 5 nodes generated.

abbInput

Page 2: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Outline• Why develop Tools?

• Previous Work

• What is JFLAP?

• How Does JFLAP Fit In Automata Course?

• JFLAP's Use in the Course

• New Features of JFLAP

• Feedback and Use of JFLAP

• JFLAP's Future

Page 3: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Students Ready to Learn Automata Theory!

Page 4: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Things start well enough...

Page 5: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

But soon, instead of pictures, there are WORDS.

Page 6: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Big words! The type with more than one syllable!

Page 7: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

VIOLENCE AMONG STUDENTS AS NERVES FRAY!

Page 8: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

We only wanted to learn automata theory! Isn’t there a better way?

Page 9: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Try JFLAP ...

Page 10: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Students Learning Automata with JFLAP

Page 11: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Why Develop Tools for Automata Theory?Different Representations of Presentation

Textual

Tabular

Visualb

a

a

b

aq1 q2

q0

Interactiveb

a

a

b

aq1 q2

q0

Page 12: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Why Develop Tools for Automata Theory?Different Representations of Presentation Examined 10

automata theory textbooks in past 11 years (Taylor, Cohen, Sipser, Kelley, Linz, Sudkamp, Lewis, Kinber, Hopcroft, Martin)

• One had software integrated for part of the book (Taylor)

• All had visual representation of DFA

• Only 6 had visual representation for PDAThose had few visual examples, only 2 or 3 states

• Only 6 had visual representation for Turing machine3 of those switched different visual representation

• Only 2 had picture of NPDA created in CFG to NPDA transformation

• None had picture of parse tree for unrestricted grammar

Page 13: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Previous Work on Automata Tools by Others

Turing's World - Barwise and Etchemendy (1993)

Deus Ex Machina - Savoiu (seven models of computation)

Models of Computation and Formal Languages - Taylor (1998)

Snapshots of the Theory of Computing - Ross (2002)

Page 14: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Our Previous Work on Automata Tools

The new JFLAP incorporates concepts from all of these.

• JFLAP - creating and experimenting with automata and grammars(SIGCSE 2000, SIGCSE 1999, SIGCSE 1997)

• JeLLRap - LL and LR parsing (SIGCSE 1997)

• Pâté - Brute force parser, grammar transformer (SIGCSE 1997)

• Lsys - creating L-systems

Page 15: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Thanks to Students Who Have Worked on JFLAP and Automata Theory Tools

• NPDA - 1990, C++Dan Caugherty

• FLAP - 1991, C++ Mark LoSacco, Greg Badros

• JFLAP - 1996-1999, Java versionEric Gramond, Ted Hung, Magda and Octavian Procopiuc

• Pâté, JeLLRap, LsysAnna Bilska, Jason Salemme, Lenore Ramm, Alex Karweit, Robyn Geer

• JFLAP 4.0 - 2003Thomas Finley, Ryan Cavalcante

Page 16: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

What is JFLAP?Java Formal Languages and Automata Package

Instructional Tool to learn concepts of Formal Languages and Automata Theory

Regular languages - create

• DFA• NFA• regular grammar• regular expression

a

b

!

a

a

a

q2

q1

q0

Regular languages - conversions

• NFA→DFA→Minimal DFA• NFA ↔ regular expression• NFA ↔ regular grammar

b a

a

a

q2

0,1,2

q1

0,1

q0

0

Page 17: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

What is JFLAP? (cont)

Context-free languages - create

• push-down automaton• context-free grammar

! , S ; !

a , ! ; a

b , ! ; b

! , Z ; !q2q1q0

Context-free languages - transform

• PDA → CFG• CFG → PDA (LL parser)• CFG → PDA (LR parser)• CFG → CNF• CFG → LL parse table and parser• CFG → LR parse table and parser• CFG → Brute force parser

Derived ! from B. Derivations complete.

Bb

ba

!

S

SS aSbS bBB !

Noninverted TreeStepPauseStart

String accepted! 5 nodes generated.

abbInput

Page 18: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

What is JFLAP? (cont)

Recursively Enumerable languages

• Turing machine (1-tape)• Turing machine (multi-tape)• unrestricted grammar• unrestricted grammar → brute force parser

L-Systems

• Create L-systems

Page 19: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

How JFLAP Fits Into Topics InFormal Languages Course

Topic JFLAP 3.1 JFLAP 4.0Finite Automata 1 1Regular Grammars/Expressions ¾ 1Properties of Regular Languages ½Context-Free Grammars ½ 1Simplify CFL 1Pushdown Automata 1 1Properties of CFLTuring Machine (1-Tape) ½ ¾Other Models of TM ¼ ½Recursively Enumerable Languages ¼LL and LR Parsing 1L-Systems 1

Page 20: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

How JFLAP Fits Into Topics InFormal Languages Course Summary

• JFLAP 3.1 covers 4 chapters of material spread out over 6 chapters.

• JFLAP 4.0 covers 9 chapters of material spread out over 11 chapters.

Page 21: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Use of JFLAP by InstructorShowing how to layout items

b

aa

bb

a

q2q1

q0

a

a

b

a

b

b

q2

q1

q0

Poor:

Better:

Page 22: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

2 ; 2 , R

3 ; 3 , L

b ; b , L

2 ; 2 , R

b ; b , R

b ; 2 , R

c ; 3 , L

1 ; 1 , R

a ; a , L

3 ; 3 , R

2 ; 2 , L

a ; 1 , R

a ; a , R

q0

q2q1

q4

q3

Use of JFLAP by Instructor

Is this correct for anbncn?

How do we fix it?

Page 23: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Use of JFLAP by InstructorExperimenting with Difficult Concepts

Nondeterminism: wwR

• Students attempt at desk - difficult: want to find the “middle”

• Instructor solves with class using JFLAP

b , b ; !

a , ! ; a

b , b ; !

a , a ; !b , ! ; b

b , Z ; bZ! , Z ; Za , Z ; aZ a , a ; !

q1q0 q2 q3

Page 24: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Use of JFLAP by InstructorTesting Student Programs

c ; c

, S | !

; ! , R

! ; ! , R | ! ; ! , R

b ; b , S | ! ; ! , L

b ; b , R | a ; b , La ; a , R | ! ; a , R

c ; c , R | b ; c , R

q0

q2q3

q1

Page 25: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Use of JFLAP by InstructorRelate to other CS Concepts

• Consider anbncn

• one-tape TM O(n2)

• two-tape TM O(n)

Running Time

Page 26: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Other Uses of JFLAP by Instructor

• Demonstrate Nondeterminism

• Demonstrate the running of a CFG to a PDA using LR method

Which lookahead do you choose?

• Demonstrate a transformation from one form to another

Example: PDA to CFG

• And many other uses...

Page 27: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

JFLAP Student Use

• Recreate and experiment with instructor’s examples

• Use with Homework

• A study aid - create additional examples

• explore concepts in depth

• weaker students get more feedback

Page 28: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Feedback from Students in CPS 140Duke University - Spring 2003

• Used JFLAP and tools in 6 of 9 homeworks

• Questionnaire - 33 responses

• “Was JFLAP easy to use?”All 33 answered yes.

• “Did you look at the help at all? If so, what part did you look at and was it helpful?”6 used help and found it helpful, 27 did not look at help.

• “Do you prefer creating FA using JFLAP or drawing them on paper?”17 students - prefer to use JFLAP 12 students - prefer paper first, then JFLAP for testing 2 students - prefer paper

Page 29: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

New Features in JFLAP 4.0• RE ↔ FA reworked

• Transform CF Grammars to Chomsky

• LL(1) and SLR(1) parsing

• Brute force parsing

• L-Systems

• Compare Equivalence

• 3-5 Tape Turing Machines

• Combine Automata

• Graph Layout

Minor New Features in JFLAP 4.0

Page 30: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Finite Automata Editingand Simulation

• The most basic feature of JFLAP has always been the creation of automata, and simulation of input on automata.

• Here we demonstrate the creation and simulation on a simple NFA.

Page 31: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationStart up JFLAP

• When we start up JFLAP we have a choice of structures.

• The first of these is the Finite Automata!

Page 32: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationStart Editing!

• We start with an empty automaton editor window.

Page 33: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationCreate States

• We create some states ...

q1

q0

q2

Page 34: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationCreate Transitions

• We create some transitions ...

a

b

a

c

a

b

q1

q0

q2

Page 35: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationInitial and Final State

• We set an initial and final state.

• Now we can simulate input on this automaton!

a

b

a

c

a

b

q1

q0

q2

Page 36: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationInput to Simulate...

• When we say we want to simulate input on this automaton, a dialog asks us for the input.

Page 37: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationStart Simulation!

• When simulation starts, we have a configuration on the initial state with all input remaining to be processed.

a

b

a

c

a

b

q1

q0

q2

Page 38: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationAfter One Step

• This is a nondeterministic FA, and on this input we have multiple configurations after we “Step.”

a

b

a

c

a

b

q1

q0

q2

Page 39: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationAfter Two Steps

• The previous configurations on q1 and q2 are rejected, and are shown in red.

• The remaining uncolored configurations paths are not rejected, and are still open.

a

b

a

c

a

b

q1

q0

q2

Page 40: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationAfter Three Steps

• Yet another step.

a

b

a

c

a

b

q1

q0

q2

Page 41: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationAfter Four Steps

• One of the final configurations has been accepted!

a

b

a

c

a

b

q1

q0

q2

Page 42: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA Edit & SimulationTraceback

• One can then see a traceback to see the succession of configurations that led to the accepting configuration.

Page 43: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

RE to FANew approach starts with a single RE transition in a GTG, and recursively

breaks RE transitions into normal FA transitions until the GTG becomes an FA.

Page 44: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

FA to RENew algorithm transforms an FA to a

GTG, and removes states until the GTG has only the initial and final states. At this

point conversion becomes trivial.

(a+ab)(b+ab)*a

Page 45: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Ambiguous Grammar Parsing with SLR

• One can also parse strings with grammars in JFLAP using LL(1) or SLR(1) parsing.

• To the right is a trivial, obviously ambiguous grammar.

• We show how SLR(1) deals with ambiguity.

Page 46: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

SLR(1) Parsing

Define First and Follow Sets

Build the FA modeling stack.

Define the parse table.

In order, students:

Orange entries indicate a conflict in the parse table.Current active value is displayed.

Page 47: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

SLR(1) Parsing• Suppose we parse aaba

with current conflicts both set to the default “reduce” entries.

• As students step, the parse table entry being used and grammar rule used (if a reduce) is highlighted.

• Notice also the input remaining and the stack.

Page 48: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

SLR(1) Parsing

• Shown is the completed parse tree. Well done!

Page 49: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

SLR(1) Parsing

• Recall the conflicts.

• When we click on the orange entry, we can choose a different entry to resolve the conflict.

• In this case we change the reduce operations to shift operations.

Page 50: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

SLR(1) Parsing

• Notice, this change results in a very different parse tree.

Page 51: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

SLR(1) ParsingWith Reduce Entries With Shift Entries

Page 52: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Brute Force Parsing• Brute force parsing

allows both CFG and unrestricted grammar parsing.

• To the right is an unrestricted grammar that generates the language anbncn.

• We can build the unrestricted parse tree!

Page 53: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Brute Force Parsing• We parse the string aabbcc

with the brute force parser.

• Notice how in this case multiple nonterminal nodes are grouped together to form a single node.

• This accomplishes the unrestricted grammar possibly replacing multiple symbols at once.

Page 54: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

L-Systems• L-Systems may be used to

model biological systems and create fractals.

• Similar to Chomsky grammars, except all variables are replaced in each derivation step, not just one!

• Commonly, strings from successive derivations are interpreted as strings of render commands and are displayed graphically.

Page 55: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

L-Systems• This L-System renders as

a tree that grows larger with each successive derivation step.

Page 56: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

L-Systems• L-systems may also be

stochastic.

• The T→Tg rule adds g to the derivation, which draws a line segment.

• We add another rewriting rule for T, T→T.

• With two rewriting rules for T, the rule chosen is random, leading to uneven growth!

Page 57: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

L-SystemsThe same stochastic L-system, rendered 3 different times all at the 9th derivation.

Page 58: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

b

b

a

c

c

c

e

d

a

a

b

e

q2

q4

q3q1

q0q5

d

ea

c

b

q2q1q0

Compare for Equivalence

Determines if two FA recognize the same language.

Page 59: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Multiple Tape Turing Machines

For example, with 3 tapes, you can relatively easily define a Universal Turing Machine.

1 ; 1 , R | 1 ; 1 , S | 1 ; 1 , S

1 ; 1

, S | ! ; !

, R | 1

; 1 , S

1 ; 1 , R | 1 ; 1 , S | 1 ; 1 , S

1 ; 1 , R | 1 ; 1 , S | 1 ; 1 , S

1 ; 1 , R | 0 ; 0 , R | 1 ; 1 , S

1 ; 1 , S | ! ; 1 , R | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , S | 1 ; 1 , L

0 ; 0

, R | 1

; 1 , S | 1

; 1 , S

! ; ! , R | 1 ; 1 , S | 1 ; 1 , R

0 ; 0

, R | 1

; 1 , S | 1

; 1 , S

0 ; 0 , R | 0 ; 0 , L | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , R | 1 ; 1 , S

0 ; 0

, S | ! ; ! , L

| 1 ; 1

, S

1 ; 1 , S | 0 ; ! , R | 1 ; 1 , S

1 ; 1 , R | 1 ; 1 , S | 1 ; 1 , R

0 ; 0 , S | 1 ; 1 , S | 1 ; 1 , S

1 ; 1 , R | 1 ; 1 , R | 1 ; 1 , S

1 ; 1 , S | ! ; 0 , S | 1 ; 1 , S

1 ; 1 , S | 0 ; 0 , R | 1 ; 1 , S

0 ; 0 , R | 1 ; 1 , S | ! ; ! , L

0 ; 0 , S | 0 ; 0 , L | 1 ; 1 , S

1 ; 1

, S | 1 ; 1

, S | 1 ; 1

, S

1 ; 1 , R | 0 ; 0 , R | 1 ; 1 , S

0 ; 0

, S | ! ; 0

, S | 1 ; 1

, S

0 ; 0 , L | 1 ; 1 , S | 1 ; 1 , S

0 ; 0 ,

R | 1 ;

1 , S |

1 ;

1 , S

1 ;

1 ,

S |

1 ;

1 ,

S |

! ;

! ,

R

0 ; 0 , S | 1 ; ! , R | 1 ; 1 , S

0 ; 0 , S | 1 ; ! , L | 1 ; 1 , S

0 ; 0 , S | 0 ; 1 , L | 1 ; 1 , S

1 ; 1 , S | ! ; 0 , L | 1 ; 1 , S

1 ; 1 , S | 0 ; 0 , R | 1 ; 1 , S

1 ; 1 , S

| 1 ; 1

, S | 1

; 1 , R

1 ; 1

, S | 1 ; 1

, S | ! ; ! , L

1 ; 1 , S | 1 ; 1 , S | ! ; ! , L

1 ; 1 , R | 1 ; 1 , S | ! ; 1 , R

0 ; 0 , R | 1 ; 1 , S | 1 ; ! , L

0 ; 0 , S | 1 ; 1 , L | 1 ; 1 , S

1 ; 1 , R | ! ; 1 , R | 1 ; 1 , S

0 ; 0

, S | 0 ; !

, L | 1 ; 1

, S

1 ; 1 , R | 1 ; 1 , S | 1 ; 1 , R

1 ; 1 , S | 1 ; 1 , S | ! ; ! , R

1 ;

1 ,

R |

1 ;

1 ,

R |

! ;

! ,

R

1 ; 1 , S | 1 ; 1 , L | 1 ; 1 , S

1 ; 1 , R | ! ; ! , R | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , R | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , S | 1 ; 1 , L

1 ; 1 , S | 1 ; 1 , L | 1 ; 1 , S

1 ; 1

, S | 0 ; 0

, R | 1

; 1 , S

1 ; 1 , R | 1 ; 1 , S | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , R | 1 ; 1 , S

1 ; 1

, S | 1 ; 1

, S | ! ; ! , L

1 ; 1 , S | ! ; 0 , L | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , R | 1 ; 1 , S

0 ; 0 , S | 1 ; 0 , L | 1 ; 1 , S

0 ; 0 , R | 1 ; 1 , S | ! ; ! , L

1 ; 1 , S | 1 ; 1 , L | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , R | 1 ; 1 , S

0 ; 0 , S | 1 ; 1 , R | 1 ; 1 , S1 ; 1 , R | 1 ; 1 , R | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , S | 1 ; 1 , S

1 ; 1 , S

| 0 ; 0 , L

| 1 ; 1 , S

1 ; 1 , S | ! ; ! , R | 1 ; 1 , S

1 ; 1 , S | 0 ; 1 , R | 1 ; 1 , S

0 ; 0

, S | 1 ; 1

, S | 1 ; 1

, S

0 ; 0

, S

| !

; 1

, S

| 1

; 1

, S

1 ; 1 , S | 1 ; 0 , R | 1 ; 1 , S

1 ; 1 , S

| ! ; 1

, S | 1

; 1 , S

1 ; 1 , R | 1 ; 1 , S | 1 ; 1 , S

1 ; 1 , S | 0 ; 0 , L | 1 ; 1 , S

1 ; 1

, S | 0 ; 0

, L | 1 ; 1

, S

1 ; 1 , S | 1 ; 1 , L | 1 ; 1 , S

1 ; 1 , L | 1 ; 1 , S | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , S | 1 ; 1 , L

0 ; 0 , S | 0 ; 0 , R | 1 ; 1 , S

0 ; 0

, L | 1 ; 1

, S | 1 ; 1

, S

0 ; 0 , L

| 1 ; 1 , S

| 1 ; 1 , S

1 ; 1

, R | ! ; 1

, S | 1 ; 1

, S

1 ; 1 , S | 0 ; 0 , R | 1 ; 1 , S

1 ; 1 , S | 1 ; 1 , L | 1 ; 1 , S

0 ; 0 , R

| 0 ; 0

, L | 1 ; 1

, S

0 ; 0 ,

R | 1 ;

1 , S |

1 ;

1 , S

0 ; 0 , R | 1 ; 1 , S | 1 ; 1 , S

q16

Rewind T2

q30

Fill Right Blank

q19

Prev 0

q27

Moved S

q8

Skip 3 T1 0s

q5

Rewind T3

q32

q2 or higher

q18

Fast Forward T2

q13

Write Symbol

q6

Skip 5 T1 0s

q3

Rewind T2

q14

Next 0

q28

Skip Right

q23

Rewind T2q10

Skip 1 T1 0s

q25

Rewind T1

q9

Skip 2 T1 0s

q4

Write State

q24

Moved L

q26

Skip Right

q2

Match Symbol

q20

Prev 1

q21

Start Compression

q31

q1 or higher

q12

Rewind T2

q1

Rewind T3

q29

Moved R

q22

Fill Left Blank

q0

Match State

q17

Rewind T2

q33

q2, ACCEPT!

q7

Skip 4 T1 0s

q11

Rewind T3

q15

Next 1

Page 60: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

JFLAP’s Use Around the World

• JFLAP web page has over 42,000 hits since 1996

• Google Search

• JFLAP appears on over 2300 web pages

• JFLAP appears on automata theory class webpages at over 40 US universities

• Note: search only shows public web pages

• Note: appears to be many foreign sites

• JFLAP has been downloaded over 8000 times since Jan. 2003

• JFLAP appears in use (web pages or downloads) in over 40 countries

Page 61: A Visual and Interactive Automata Theory Course with JFLAP 4rodger/talks/cse04/cse04jflap.pdfA Visual and Interactive Automata Theory Course with JFLAP 4.0 Ryan Cavalcante Thomas Finley

Future Work

• Filling in the missing pieces for automata theory course

• JFLAP User manual out in December 2004 (Rodger, Finley)

• JFLAP Automata Theory textbook out in Fall 2005 (Rodger, Linz)

JFLAP is FREE!