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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file machineop-0.1.0.tar.gz.

File metadata

  • Download URL: machineop-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for machineop-0.1.0.tar.gz
Algorithm Hash digest
SHA256 18caacd4a252b80d64ac8321c1430c58df895337eba9091ec6d94349ed89014d
MD5 29f372b6d0f64c6486f9b5d9686c6fe9
BLAKE2b-256 26534bb50878c0cde1f38ac8e8774ecbe6ea904d4aa2340c767e615d8feedd9b

See more details on using hashes here.

File details

Details for the file machineop-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: machineop-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for machineop-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8a294cb2cc0752831e20f0245994917504bcfef09cb52cb39d1510558182c55
MD5 c9c615612daa68d5738a64962525b1c2
BLAKE2b-256 a731e7222d9a5402e6ac8ab20ea2041244fee49566a1ceef8337be6872586855

See more details on using hashes here.

Supported by

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