Executing Graph Grammar


This step consists of running the simulator and explain how it works step by step. Then we will explain how it was constructed. Ok, choose the option "execute Transformation" in the "transformation" section of the task bar:  

 

Lets explain the execution options: 

New, Edit, Delete Transformations  

   

This is a list of Graph Grammars file that where generated from a simulator_model file. New allow us to search a path for a generated Graph Grammar file and to add it to the list. Edit is used to change the current path of some element of the list while delete removes one. We see that we can combine multiple Graph Grammar and run them on the same model one after the other. This allow us to create several small transformations that are easy to maintain instead of creating one big transformation.  

Step by Step  

   

This options force the graph grammar to ask a confirmation before going into the next step of its execution semantics.  

Let entities move  

   

This option allow the entities on the canvas to move after a Graph Grammar step. This is used when your grammar as to move the entities of its model in order to get to the next step.  

Execution  

   

Sequential/Random: The graph grammar will execute only one possible "next state" at a time and it will choose randomly a state from multiple outcome possibilities.

Sequential/Manual: The graph grammar will also only exectute one possible "next state" at a time but will ask the user what state to branch in

Parallel: The graph will execute every possible "next state" at the same time.  


Ok, now we will load the simulator by clicking on "new" and browsing for the file "FSAsimulator.py". Also, we want the execution to be step by step to demonstrate how it works. In this case, manual or random doesn't change a thing since there is always only one unique possible "next state":  

 

Now, if you press "Ok", the simulator will start executing on the model on the canvas:  

 

If we click on "step", the simulator will ask you for a list of inputs for the FSA. We must, at that point, enter every input that will be used in the simulation. For example, in our case, if we want to go to the final state, we must enter "(A,B,C)" in the list:  

 

At this moment, we click on "Ok" on the list of inputs and the Graph Grammar will find the initial state of the model:  

 

Now, if we click on "step", the graph grammar will process every inputs that we entered in the list and will make the FSA evolute from state to state. Also, it will show us the correct output for every transition:  

 

If we press "Ok" on the output list and press "step", the FSA will evolute to its next state. If we do that multiple times, it will attain at one point its final state and the simulation will finish (take notice that we must attain a final state since a FSA can only terminate when it is in a final state) :