DiscoverLearnDocumentationGet OpenPLXSearch Contact

Attribute syntax

The data inside models are stored in attributes, they can be declared inside a model with a type and an expression.

MyModel:
    my_variable is Real: 0.0

To declare a variable inside a model you must first indent it then give it a name followed by the is keyword and a type. The type can either be a model or one of the primitive types: Real, Int, Bool or String. You can also provide a value expression by entering a : after the type followed by an expression. Array types are also supported in which case the type is suffixed with brackets, [].

Examples

Foo:
    x is Real: 1.0

MyModel:
    foo is Foo
    foo_array is Foo[]
MyModel:
    str is String: "Hello"
    bool is Bool: true
    i is Int: 3
    arr is Real[]: [0.1, 3.3, -4.32]

Global Attributes

Attributes can also be declared globally by declaring them unindented. The syntax is the same but the semantics are slightly different.

my_global_variable is Real: 3.0

Grammar

variable → INDENT? IDENTIFIER "is" (IDENTIFIER ".")* IDENTIFIER ("[]")? (":" expression)?