Finite State Machine
Ideas for a baked-in DSL for generating code using a FSM language.
FSM language examples:
- Lucy: https://lucylang.org/docs/language/
Directed Graph language examples:
- DOT: https://www.graphviz.org/doc/info/lang.html
Machine
The container for a state machine definition.
- context: a structure with all data fields used by the state machine.
State
- name
- entry / exit state events
- custom events that cause state transition
- immediate / auto transition (executed when entering the state)
- available actions on state (side effects) / calling external functions
- initial, final and nested state (nested machines?)
Event
A representation of an external occurrence.
Causes a transition from the current state (on which the event is declared) to a new state.
Code Generation
No functions are generated - they are all implemented externally to the state machine.
Context
The machine context is auto generated by analyzing what fields are referenced in the dsl. The structure can be extended with custom fields. The structure is passed in as a template or generic parameter.