Language

For the Sepro system we propose a domain specific modeling language. The language convers three aspects of the model: object prototypes, initial graph structures and simlator or observer related information.

Model and Model Objects

The model is a list of model objects: symbol definitions, actuators and structures.

model = { model_object }

model_object = symbol_definition | unary_actuator | binary_actuator | structure

Symbols

The symbol is an identifier that can contain letters, decimal digits or the underscore _ character. It can not start with a digit. For example open, next, site_a, site_b.

Each symbol in the model represents an instance of a type. There can be only one type associated with a symbol within the model. Type of a symbol can be specified explicitly or is determined by the compiler from the first use of the symbol in the model. Use of a symbol for different types results in an error. For example if a symbol is used as a tag it can not be used to label a relationship between objects.

Examples of explicity symbol definitions:

DEF TAG open
DEF TAG closed
DEF SLOT next
DEF SLOT site_a

Grammar:

symbol_definition = "DEF" symbol_type symbol symbol_type = "SLOT" | "TAG" | "STRUCT" | "ACTUATOR"

When an indirect symbol needs to be specified we use the . (dot) symbol qualification:

qualified_symbol = [symbol "."] symbol

Structures

Structure is a definition of a group of objects - a subgraph, that can be used to initialize the world. Structure contains list of objects and bindings (edges).

struct = "STRUCT" symbol { struct_item }

struct_item = object | binding

Structure objects have identifiers that are valid withing the scope of the structure. The identifiers are used to refer to objects in the structure binding specification.

object = "OBJ" symbol "(" { symbol } ")"

The bindings within structure can refer to objects within the same structure:

binding = "BIND" symbol "." symbol "TO" symbol

Example:

STRUCT triangle
    OBJ a (node)
    OBJ b (node)
    OBJ c (node)
    BIND a.next -> b
    BIND b.next -> c
    BIND c.next -> a

Worlds

World is a container specifying initial state of the simulation. It can be thought as a list of “ingredients of the simulation primordial soup”.

In the language more worlds can be specified in the model, despite only one world being used as a starting state of the system. If more worlds are specified then the one with name main is used if not specified explicitly otherwise.

world = "WORLD" symbol { world_item }

world_item = integer symbol

For example the following world will yield 10 copies of structure jar and 10 objects (out of structure) with tag lid:

WORLD main
    10 jar
    10 (lid)

Actuators

selector = "ALL" | "(" { symbol_presence } ")"

symbol_presence = ["!"] qualified_symbol

unary_actuator = "ACT" symbol "WHERE" selector { unary_transition }

unary_transition = "IN" unary_subject { modifier }

unary_subject = "THIS" ["." symbol] | symbol

modifier = "BIND" symbol "TO" qualified_symbol | "UNBIND" symbol | "SET" symbol | "UNSET" _symbol

binary_actuator = "REACT" symbol "WHERE" selector "ON" selector { binary_transition }

binary_transition = "IN" binary_subject { modifier }

binary_subject = ("LEFT" | "RIGHT") ["." symbol]