interactive pushdown automata animation
DESCRIPTION
Interactive Pushdown Automata Animation. Jennifer McDonald [email protected] College of Computer Science Northeastern University Boston, MA This work was partially supported by NSF grant DUE-9950829. Recipe for Visualization Tool Design (serves many hungry students). - PowerPoint PPT PresentationTRANSCRIPT
Interactive Pushdown Automata Animation
Jennifer [email protected]
College of Computer ScienceNortheastern University
Boston, MAThis work was partially supported by NSF grant
DUE-9950829
Recipe for Visualization Tool Design
(serves many hungry students)
• ¾ cup Interactivity• 2 tbsp Multiple representation of data• 6 oz Algorithmic animation with control• 1 Starting point from which to explore
Mix well and serve to any students who wish to explore and learn!
Interactivity
• Students should be able to enter their own test data.
• Students should be able to modify the existing structure to see how changing one piece will affect the overall outcome.
• Students should be able to create and test their own structure.
Multiple Views
• All data members pertinent to the algorithm should be displayed to the user.
• Data should be represented graphically, algorithmically, and/or mathematically. The more ways data is displayed, the better!
• Views should be succinct and should fit on one screen.
Algorithmic Animation with Control
• Providing an animation of processes commonly demonstrated on the chalk-board can greatly increase a student’s understanding of the algorithm.
• Students must be given control so that they can learn at their own pace.
• Start, pause, step, and speed controls should always be available with an animation.
• Giving students the ability to control color is also helpful.
A Starting Point from which to Explore
• Supply simple test cases for students to explore and get accustomed to the program.
• Instruct students to start with simple test data such as the empty set.
A Brief History of the Program
• Began as an honors adjunct project for my own Automata Theory class.
• Was later revised to be a proof-of-concept program for the JPT.
• After the JPT overhaul it became a useful tool for the classroom.
JPT as a Development Aid
• Encapsulated away technical difficulties (listeners, threads, etc).
• Solved layout and display problems that I was having.
• Added error checking capabilities and allowed me to concentrate on implementing the algorithm.
The Data Structure
A three dimensional container with two hashtables and a vector.
Level 1:
All states in the automaton. (Hashtable)
qS q3 q4 qFq1 q2
qFq4
qF
q4
q3
q1
q3
qS
qF
q4
q2
qF
q1
Level 2:
States that can be reached from each state
in the automaton. (Hashtables)
•Searching this model is extremely efficient.
•Uses the JPT Stringable interface to save and load from file: To load model from a file: automata = new Automata(FileUtilities.readFile(file));
automata.draw(graphics);repaint();
To save model to a file: FileUtilities.writeFile(file, automata.toStringData(), true);
Level 3:
The transition rules to move
from source state to target state.
(Vectors)
qS q3 q4 qFq1 q2
qF
q1 E:$/E 1:$/E 0:$/E
E:E/E
The Algorithm
•Depth-first search of the PDA.
•Recursion over six methods.
•Three stacks to track progress:pushdownStackpathStackundoStack
•Returns all paths found until a successful path is found. Animator chooses the path to animate.
processTape( source state, tape ptr )
continueSearch( source state, tape symbol, tape ptr)
testTransitions( source state, target state,
tape symbol, tape ptr, transitions vector)
visit( path node, tape ptr )
advance( path node, tape ptr )
rewind()
x N*
* Where M is the number of target states reachable from the source state and N is the number of transitions between the source state and the target state that move on Epsilon or the given tape symbol
Check state of machine, return if successful path criteria has been met. If not, forward the source state and the current tape pointer.
Find all states reachable from the source state. For each source-target pair, test transitions between them. Forward source, target, tape symbol, tape pointer, and the transitions between the pair.
Test the first transition to see if its stack criteria match the current stack conditions. If so, create a new path node and forward it along with the current tape pointer to visit. Repeat for every transition in the vector.
Advance and rewind the machine.
Advance pushes the node onto the path stack and the nodes action onto the undo stack. It then performs the action, increases the tape pointer and recurses back to process tape.
Rewind reverts the machine to its former state before the advance method was called.
x M*
The Animated Path
If all possible paths are tested, why aren’t they all animated?
For automata with many states and transitions, showing all paths
can be confusing and time consuming.
What is the acceptance criteria?Paths are accepted if they result in every character being read off
of the tape and the stack is empty.
What if the user creates a PDA with an infinite loop?
Path traversal is limited to the depth maximum entered in the GUI. The default maximum is 100.
The Future of the Pushdown Automata Program
• The program will be introduced to the Automata Theory class during the Spring quarter.
• You can download and use the program in your classroom: http://www.jenimac.com/JPT
• “To do” list for Version 2.0:
Dragable/editable capabilities when designing automaton.
Animation option: best path or all paths showing depth first search.
Acceptance criteria specification: user can choose to accept at end of tape, end of stack, or both.
Interactive Pushdown Automata Animation
Jennifer McDonaldCollege of Computer Science
Northeastern UniversityBoston, MA
Email: [email protected]: www.jenimac.com/JPT
NU webiste: www.ccs.neu.edu/jpt
Acknowledgments
Thanks to my mentoring professors: Richard Rasala
Viera Proulxand also to:
Jeff Raab
This work was partially supported by NSF grant DUE-9950829