next up previous contents index
Next: Pushlogic Object Level (VM Up: SPL Pushlogic Language Reference Previous: Ontology   Contents   Index

Subsections

Pushlogic Constants

Pushlogic source and object use the same constant forms.


Atomic Constant Values.

The constant values available are integers and strings.

Strings that are defined as part of an enumeration or the reserved strings `true' and `false' do not need quote marks when they appear at source level, but at object level there is no concept of whether a string was in quotes or not at source level.

Constant value strings containing spaces must be enclosed in quotes at the source level. They should be avoided for everyday device control.

Integers are rendered in base ten and have no leading zeros, except for zero itself. In all respects, an integer behaves equivalently to its corresponding base ten string. The runtime system (e.g. Pushlogic interpeter) may freely convert between ASCII string and binary representations of integers as it wishes.

Pushlogic object also uses the special constant bottom (also known as backstop) ($\bot$).

The null string, the string `false' (whether in quotes at source level or not), the integer zero and any strings containing only zeros are the values that represent logical false in the evaluation of Boolean operators.

The null string is defined as the string of length zero. There is no separate 'null pointer' version of the null string and string variables cannot be 'null'. Any platform that uses the null pointer to represent the null string must ensure the two are fully identified, under comparison and so on.


Event Constants

Certain fields or variables range over events. The event name is the same as the name as the field or variable that relays it. Events may be parameterised with an event constant that is a string or integer. An event type is a set of unique strings and/or integers that are the event constants possible for a given event. The null event constant denotes that an event is not currently occurring.


Pushlogic Types

Types in SPL1 are sets containing enumerations of constants and/or integer ranges. Types are designated using type expressions. A type expression is the name of a type or a list of constants enclosed in braces. A colon may partition the list: this defines the values before the colon as safe values. The constants are strings, which do not need quotes in this context, unless they contain spaces, or integer ranges of the form `nn .. mm ' where nn and mm are integers. The word `event' may be placed in front of the opening brace to declare an event type. An event type has an implied safe value that is the empty string and the given constants are unsafe values.

 type-expression ::= <id> |
              {  u1 u2 ... } |
              {  s0 s1 ... : u1 u2 ... } |
              event { e1 e2 ... } |
              fuse | bool | lock

Named types are defined with the `sort set' statement but the right-hand side type expressions can be used inline as anonymous types. Example:

 type-declaration ::= sort set <id> = <type-expression>

 sort set <typename> = {  s0, s1, ... : u1, u2, ... };

Lock Type

The lock type is built in to Pushlogic and ranges over any string constant. Its safe value is the null string. Only the bundle that last set a lock type to a non-null value can set it to any other value.

Fuse Type

The fuse type is built in to Pushlogic and defined as follows:

 sort set bool = {  true : false };

Boolean Type

The Boolean type is built in to Pushlogic and defined as follows:

 sort set bool = {  true, false };

The sort `bool' is already defined by the system and contains the reserved constants `false' and `true', both as unsafe values.

It is an error to define any field to range over the reserved constants `false' or `true', unless the field ranges over exactly these two fields. They may be safe or unsafe.

Examples:

  sort set  d0 = bool;               // OK - making use of predefined sort.
  sort set  d1 = { true : false };   // OK - true is safe.
  sort set  d2 = { true false };     // OK - both unsafe, same as boolean.
  sort set  d3 = { false : 0..9 };           // Illegal. 
  sort set  d3 = { false : true red brown }; // Illegal.


next up previous contents index
Next: Pushlogic Object Level (VM Up: SPL Pushlogic Language Reference Previous: Ontology   Contents   Index
David Greaves 2009-04-20