Macro gmt_dos_actors::actorscript

source ·
actorscript!() { /* proc-macro */ }
Expand description

Interpreter for the scripting language of gmt_dos-actors models.

Generates all the boilerplate code to build gmt_dos-actors models.

See also the crate documentation for details about building gmt_dos-actors models with actorscript.

§Syntax

§Flow

1: ...

A flow always starts with an integer literal following by colon, then a chain.

§Chain

pair|client -> another_pair -> ... -> pair|client

The start and end of a chain can be either a client or a pair of a client and an ouput.

§Client-Output Pair

The syntax for a client-output pair is (optional parameters are preceded by ?)

?{ client ?::GatewayClient ?} [Output] ?suffix
  • client: is the name of the client identifier that is the variable declared in the main scope. If the client is surrounded by braces i.e {sys}, it is assumed to be a gmt_dos-actors system. The type of the client that receives an input or sends an output within a system acts as a gateway between the system and the other clients and the gateway client can be specified by appending its type GatewayClient to the system variable like so{sys::GatewayClient}.
  • Output: is the type of one of the outputs of the actor associated with the client, the client must implement the trait Write<Output>, if it preceded by another client-output pair it must also implement the Read<PreviousOutput> trait.
  • ?suffix: optional operators applied to the ouput (suffix can be combined in any order (e.g S!.. or !..$ are both valid)):
    • !: output bootstrapping
    • $: data logging: creates clients variables logging_<flow rate> and data file <model name>-data_<flow rate>.parquet,
    • ${n}: same as above but also specifies the data size,
    • ..: unbounded output
    • ~: stream the output to a gmt_dos-clients_scope client

§Attributes

§model
#[model(key = param, ...)]
§keys
  • name: model variable identifier (default: model), this is also the name given to the flowchart
  • state: model state identifier: ready, running or completed (default: completed)
  • flowchart: flowchart string literal name (default: "model")
§labels
#[model(<client> = "client label", ...)]
§keys

The key <client> is the name of the client identifier that is the variable declared in the main scope. The label associated to the key will be display in the flowchart instead of the <client> type.

§images
#[model(<client> = "<png file>", ...)]
§keys

The key <client> is the name of the client identifier that is the variable declared in the main scope. The image associated to the key will be display in the flowchart instead of the <client> type. If a label is also given for the same key, it will written over the image.