README-work
Raku DSL::FiniteStateMachines
In brief
This repository is for a Raku package with class definitions and functions for creation of Finite State Machines (FSMs) and their execution.
Usage example (Address book)
Here we load the definition of the class AddressBookCaller (provided by this package)
and related entities package,
"DSL::Entity::AddressBook":
use DSL::FiniteStateMachines::AddressBookCaller;
use DSL::Entity::AddressBook;
use DSL::Entity::AddressBook::ResourceAccess;Here we obtain a resource object to access a (particular) address book:
my $resourceObj = DSL::Entity::AddressBook::resource-access-object();Here we create the FSM and show its states:
my DSL::FiniteStateMachines::AddressBookCaller $abcFSM .= new;
$abcFSM.make-machine(($resourceObj,));
.say for $abcFSM.states;(Each pair shows the name of the state object and the object itself.)
Here is the graph of FSM's state transitions:
$abcFSM.to-mermaid-jsRemark: In order to obtain a Mathematica -- or Wolfram Language (WL) -- representation of the state transitions
graph the method to-wl can be used.
Here is how the dataset of the created FSM looks like:
.say for $abcFSM.dataset.pick(3);For an interactive execution of the FSM we use the command:
#$abcFSM.run('WaitForCallCommand');Here we run the FSM with a sequence of commands:
$abcFSM.run('WaitForCallCommand',
["call an actor from LOTR", "",
"take last three", "",
"take the second", "", "",
"2", "5", "",
"quit"]);Object Oriented Design
Here is the Unified Modeling Language (UML) diagram corresponding to the classes in this package:
(The UML spec and the Mermaid spec above were automatically generated with "UML::Translators", [AAp5].)
Here is the MermaidJS spec generation shell command:
to-uml-spec --format=MermaidJS DSL::FiniteStateMachines References
Packages
[AAp1] Anton Antonov, DSL::Shared Raku package, (2020), GitHub/antononcube.
[AAp2] Anton Antonov, DSL::Entity::Metadata Raku package, (2021), GitHub/antononcube.
[AAp3] Anton Antonov, DSL::English::DataAcquisitionWorkflows Raku package, (2021), GitHub/antononcube.
[AAp4] Anton Antonov, DSL::Entity::AddressBook Raku package, (2023), GitHub/antononcube.
[AAp5] Anton Antonov, UML::Translators Raku package, (2021), GitHub/antononcube.
Videos
[AAv1] Anton Antonov, "Multi-language Data Wrangling and Acquisition Conversational Agents (in Raku)", (2021), YouTube.com.