This makes me wonder if something similar can be done with petri nets.
See e.g. [2] for more on one of the Petri-net-based formalisms they're using.
[1] https://www.irit.fr/recherches/ICS/
[2] https://www.irit.fr/recherches/ICS/softwares/petshop/ico.htm...