Skip to main content

The domain specific language for operating statemachines. The default machine included in the package is microwave oven.

Project description

The machine operator package runs state machines based on the below meta-model:

StateMachine:
    'events'
        events+=Event
    'end'

    'commands'
        commands+=Command
    'end'

    ('commandgroups'
        commandGroupBlocks+=CommandGroupBlock        
    'end')? 

    states+=State
;

Keyword:
    'end' | 'events' | 'state' | 'actions' | 'commandgroups' | 'group' | 'groupend'
;

Event:
    name=SMID code=ID
;

Command:
    name=SMID code=ID
;

CommandGroupBlock:
    'group' name=SMID
        groupCommands+=[Command|SMID]       
    'groupend'
;

GroupOrCommand: Command | CommandGroupBlock;

State:
    'state' name=ID
        ('actions' '{' actions+=[GroupOrCommand | SMID] '}')?
        (transitions+=Transition)?
    'end'
;

Transition:
    event=[Event|SMID] '=>' to_state=[State]
;

SMID:
    !Keyword ID
;

Comment:
    /\/\*(.|\n)*?\*\//
;

The package will run a basic microwave oven as the default state machine. The default microwave oven has only 2 functionalities: baking and cleaning. This is a very legacy oven, because of which the cleaning is not timer controlled. You have to manually turn off the cleaning.

To run the oven as a state machine, execute the command machineop. If you want to execute a different state machine other than the default one, you can pass the path to the state machine file (with .pymo extension) to the package via the -m flag.

machineop -m <PATH-TO_CUSTOM_STATE_MACHINE>

To define a custom interpreter to the state machine model, you can pass the python interpreter using the -i flag.

machineop -i <PATH-TO_CUSTOM_INTERPRETER>

If you want to get even more creative, you can specify your custom meta-model as well using the -t flag.

machineop -t <PATH-TO_CUSTOM_META_MODEL>

Connecting all together, you can have your own completely customized textx setup using your own custom meta-model, model and interpreter.

machineop -m <PATH-TO_CUSTOM_STATE_MACHINE> -i <PATH-TO_CUSTOM_INTERPRETER> -t <PATH-TO_CUSTOM_META_MODEL>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

machineop-0.1.0.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

machineop-0.1.0-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page