Petrex.Marking (petrex v1.0.0)

Copy Markdown View Source

Markings in their two representations.

  • A token marking, %{place_id => [token]}, is what the executor runs on. Tokens are arbitrary terms.
  • A skeleton marking, %{place_id => non_neg_integer}, is what analysis runs on: tokens are only counted.

In both, a place absent from the map holds no tokens. Conversion between the two is always explicit.

Summary

Functions

Builds a token marking from counts, using :token for every token.

Counts the tokens of a token marking.

Types

skeleton()

@type skeleton() :: %{required(Petrex.Place.id()) => non_neg_integer()}

t()

@type t() :: %{required(Petrex.Place.id()) => [term()]}

Functions

from_skeleton(skeleton)

@spec from_skeleton(skeleton()) :: t()

Builds a token marking from counts, using :token for every token.

iex> Petrex.Marking.from_skeleton(%{a: 2, b: 0})
%{a: [:token, :token], b: []}

to_skeleton(marking)

@spec to_skeleton(t()) :: skeleton()

Counts the tokens of a token marking.

iex> Petrex.Marking.to_skeleton(%{a: [:token, :token], b: []})
%{a: 2, b: 0}