Add petrinet language

This commit is contained in:
Joeri Exelmans 2024-11-21 12:10:28 +01:00
parent dd7a0536c9
commit 5240c7e21a
12 changed files with 137 additions and 7 deletions

View file

@ -0,0 +1,11 @@
# Places, transitions, arcs (and only one kind of arc)
Connectable:Class { abstract = True; }
arc:Association (Connectable -> Connectable)
Place:Class
Transition:Class
:Inheritance (Place -> Connectable)
:Inheritance (Transition -> Connectable)

View file

@ -0,0 +1,16 @@
# A place has a number of tokens, and that's it.
PlaceState:Class
PlaceState_numTokens:AttributeLink (PlaceState -> Integer) {
name = "numTokens";
optional = False;
constraint = `"numTokens cannot be negative" if get_value(get_target(this)) < 0 else None`;
}
of:Association (PlaceState -> Place) {
# one-to-one
source_lower_cardinality = 1;
source_upper_cardinality = 1;
target_lower_cardinality = 1;
target_upper_cardinality = 1;
}