Automata Based Programming Margarita Spitšakova Institute of Cybernetics at Tallinn University of...
-
Upload
anissa-byrd -
Category
Documents
-
view
220 -
download
4
Transcript of Automata Based Programming Margarita Spitšakova Institute of Cybernetics at Tallinn University of...
Automata Based Programming
Margarita Spitšakova
Institute of Cybernetics at Tallinn University of Technology
19.03.08
Outline
• Introduction• Definition of FSM• Usage of FSM• FSM as programs• Example• Future work• Conclusions• Software, further reading
Introduction
• Master thesis: “Genetic Inference of Finite State Machines”
• Finite state machine is something abstract
• Why I need to generate FSMs?
Finite State Machines
• States, transitions, input and output alphabets, final state, initial state.
• Moore machine (output at state)• Mealy machine (output at transition)
• Deterministic machine
Using FSM
• FSM as hardware model
• Text recognition (regular expressions)• Text transformations
• Pushdown automata in parsers
FSM as program
Event
Controller=
Finite State
Machines
Controlled object
Event
Event Controlled object
Controlled object
Example. Traffic Lights
Red
Green
Yellow
Blinkinggreen
Red+
yellow
Model
Source code. Controlled objectpublic class TrafficLight implements ControlledObject {public void red(StateMachineContext context) {
System.out.println("Red"); }
public void green(StateMachineContext context) {System.out.println("Green");
}public void yellow(StateMachineContext context) {
System.out.println("Yellow"); }
public void greenblink(StateMachineContext context) {System.out.println("Green Blinking");
}
public void redyellow(StateMachineContext context) {System.out.println("red yellow");
}}
FSM
Source code. Controller switch (s) { case green: switch (event) { case next tick: if (counter_x4 < 20) { make transition to state “blinking green”;
return new StateMachineConfig("blinking green");
} if (counter_x4 >= 20) { make transition to final state; return new StateMachineConfig(" final state "); }
…}
Switch technology
Conclusions
• Modeling system• Modeling=writing the code• Step-by-step• Easier to verify• Good for modeling reactive systems
Future work
Event
Controller=
Finite State
Machine
Controlled object
Event
Event Controlled object
Controlled object
Can be generated
Software. Further reading
• Unimod. Eclipse plugin for designing object-oriented event-driven applications using automata-based programming adapted for UML. http://unimod.sourceforge.net
• AutoFSM. http://autogen.sourceforge.net
• Сайт по автоматному программированию http://is.ifmo.ru/