Rules

ClockConstraintSystem:
ClockConstraintSystem_Impl

Block:
Block_Impl

ClockConstraintSystem_Impl:

( 'ClockConstraintSystem' ID '{'
( 'imports' '{'
Import + ) ? ) &
(
'}' 'entryBlock' [Block] ) &
Block &
( 'dataTypes' '{'
Type ( ',' Type ) *
'}' ) ? &

'}'

Block_Impl:
'Block' ID '{'
( Element | Relation | Expression | ClassicalExpression0 ';'? ) *
'}'

Relation:
'assert' ? 'Relation' ID '[' [RelationDeclaration] ']' '(' ( Binding ( ',' Binding ) * ) ? ')'

Expression:
'Expression' ID '=' [ExpressionDeclaration] '(' ( Binding ( ',' Binding ) * ) ? ')'

Import:
'import' STRING 'as' String0 ';'

Clock:
'Clock' ID ( ':' [Type] ) ? ( '->' Event ) ? ( 'definingEvent' [Event] ) ?

Event:
ID '(' ( [EObject] ( ',' [EObject] ) * ) ? ')' ( ':' EventKind ) ?

Enum EventKind:
'start' | 'finish' | 'stop' | 'consume' | 'produce' | 'receive' | 'send' | 'any' | 'all' | 'undefined'

Element:
Clock | StringElement | IntegerElement | SequenceElement

ClassicalExpression0:
BooleanRef | RealRef | IntegerRef | UnaryRealPlus | UnaryRealMinus | RealPlus | RealMinus | RealMultiply | UnaryIntPlus | UnaryIntMinus | IntPlus | IntMinus | IntMultiply | IntDivide | Not | And | Or | Xor | RealEqual | RealInf | RealSup | IntEqual | IntInf | IntSup | SeqIsEmpty | SeqGetTail | SeqGetHead | SeqDecr | SeqSched | BooleanVariableRef | IntegerVariableRef | RealVariableRef | NumberSeqRef | NumberSeqVariableRef

Type:
String1 | Boolean | Integer | Real | Char | Record | SequenceType | DiscreteClockType_Impl | DenseClockType | EnumerationType

PrimitiveElement:
StringElement | IntegerElement

BindableEntity:
Expression | Relation | AbstractEntity | ConcreteEntity_Impl

RealExpression:
RealRef | UnaryRealPlus | UnaryRealMinus | RealPlus | RealMinus | RealMultiply | RealVariableRef

IntegerExpression:
IntegerRef | UnaryIntPlus | UnaryIntMinus | IntPlus | IntMinus | IntMultiply | IntDivide | SeqGetHead | IntegerVariableRef

BooleanExpression:
BooleanRef | Not | And | Or | Xor | RealEqual | RealInf | RealSup | IntEqual | IntInf | IntSup | SeqIsEmpty | BooleanVariableRef

SeqExpression:
SeqGetTail | SeqDecr | SeqSched | NumberSeqRef | NumberSeqVariableRef

PrimitiveType:
String1 | Boolean | Integer | Real | Char | EnumerationType

String0:
( 'String' STRING ) | ID

StringElement:
'String' ID '=' String0

IntegerElement:
( 'Integer' ID ( ':' [Type] ) ? '=' INT ) | ( ID '=' INT )

BooleanElement:
'BooleanElement' ID ( ':' [Type] ) ? '=' Boolean0

SequenceElement:
'Sequence' ID ? ( ':' [Type] ) ? '=' ( PrimitiveElement ( ';' PrimitiveElement ) * ) ? ( '(' PrimitiveElement ( ';' PrimitiveElement ) * ')' ) ?

Boolean0:
( 'Bool' 'True' ) | 'False'

Binding:
[AbstractEntity] '->' [BindableEntity]

AbstractEntity:
ID ':' [Type]

ConcreteEntity_Impl:
'ConcreteEntity' ID

BooleanRef:
'BooleanRef' '{'
( 'name' ID ) ? 'referencedBool' [BooleanElement]
'}'

RealRef:
'RealRef' '{'
( 'name' ID ) ? 'realElem' [RealElement]
'}'

IntegerRef:
'IntegerRef' ( 'name' ID ) ? '[' [IntegerElement] ']'

UnaryRealPlus:
'UnaryRealPlus' '{'
( 'name' ID ) ? 'value' [RealElement] 'operand' RealExpression
'}'

UnaryRealMinus:
'UnaryRealMinus' '{'
( 'name' ID ) ? 'value' [RealElement] 'operand' RealExpression
'}'

RealPlus:
'RealPlus' '{'
( 'name' ID ) ? 'leftValue' RealExpression 'rightValue' RealExpression
'}'

RealMinus:
'RealMinus' '{'
( 'name' ID ) ? 'leftValue' RealExpression 'rightValue' RealExpression
'}'

RealMultiply:
'RealMultiply' '{'
( 'name' ID ) ? 'leftValue' RealExpression 'rightValue' RealExpression
'}'

UnaryIntPlus:
'UnaryIntPlus' '{'
( 'name' ID ) ? 'value' [IntegerElement] 'operand' IntegerExpression
'}'

UnaryIntMinus:
'UnaryIntMinus' '{'
( 'name' ID ) ? 'value' [IntegerElement] 'operand' IntegerExpression
'}'

IntPlus:
'IntPlus' '{'
( 'name' ID ) ? 'leftValue' IntegerExpression 'rightValue' IntegerExpression
'}'

IntMinus:
'IntMinus' '{'
( 'name' ID ) ? 'leftValue' IntegerExpression 'rightValue' IntegerExpression
'}'

IntMultiply:
'IntMultiply' '{'
( 'name' ID ) ? 'leftValue' IntegerExpression 'rightValue' IntegerExpression
'}'

IntDivide:
'IntDivide' '{'
( 'name' ID ) ? 'leftValue' IntegerExpression 'rightValue' IntegerExpression
'}'

Not:
'Not' '{'
( 'name' ID ) ? 'operand' BooleanExpression
'}'

And:
'And' '{'
( 'name' ID ) ? 'leftValue' BooleanExpression 'rightValue' BooleanExpression
'}'

Or:
'Or' '{'
( 'name' ID ) ? 'leftValue' BooleanExpression 'rightValue' BooleanExpression
'}'

Xor:
'Xor' '{'
( 'name' ID ) ? 'leftValue' BooleanExpression 'rightValue' BooleanExpression
'}'

RealEqual:
'RealEqual' '{'
( 'name' ID ) ? 'leftValue' RealExpression 'rightValue' RealExpression
'}'

RealInf:
'RealInf' '{'
( 'name' ID ) ? 'leftValue' RealExpression 'rightValue' RealExpression
'}'

RealSup:
'RealSup' '{'
( 'name' ID ) ? 'leftValue' RealExpression 'rightValue' RealExpression
'}'

IntEqual:
'IntEqual' '{'
( 'name' ID ) ? 'leftValue' IntegerExpression 'rightValue' IntegerExpression
'}'

IntInf:
'IntInf' '{'
( 'name' ID ) ? 'leftValue' IntegerExpression 'rightValue' IntegerExpression
'}'

IntSup:
'IntSup' '{'
( 'name' ID ) ? 'leftValue' IntegerExpression 'rightValue' IntegerExpression
'}'

SeqIsEmpty:
'SeqIsEmpty' '{'
( 'name' ID ) ? 'operand' SeqExpression
'}'

SeqGetTail:
'SeqGetTail' '{'
( 'name' ID ) ? 'operand' SeqExpression
'}'

SeqGetHead:
'SeqGetHead' ID ? '(' SeqExpression ')'

SeqDecr:
'SeqDecr' '{'
( 'name' ID ) ? 'operand' SeqExpression
'}'

SeqSched:
'SeqSched' '{'
( 'name' ID ) ? 'operand' SeqExpression 'integerExpr' IntegerExpression
'}'

BooleanVariableRef:
'BooleanVariableRef' '{'
( 'name' ID ) ? 'referencedVar' [AbstractEntity]
'}'

IntegerVariableRef:
'IntegerVariableRef' '{'
( 'name' ID ) ? 'referencedVar' [AbstractEntity]
'}'

RealVariableRef:
'RealVariableRef' '{'
( 'name' ID ) ? 'referencedVar' [AbstractEntity]
'}'

NumberSeqRef:
'NumberSeqRef' '{'
( 'name' ID ) ? 'referencedNumberSeq' [SequenceElement]
'}'

NumberSeqVariableRef:
'SequenceVarRef' '=' [AbstractEntity]

String1:
'StringType' ID

Boolean:
'BooleanType' ID

Integer:
'IntegerType' ID

Real:
'RealType' ID

Char:
'CharType' ID

Record:
'RecordType' ID '{'
Field ( ',' Field ) *
'}'

SequenceType:
'SequenceType' ID ':' [PrimitiveType]

DiscreteClockType_Impl:
'DiscreteClockType' ID

DenseClockType:
'DenseClockType' ID '{'
( 'baseUnit' String0 ) ? ( 'physicalMagnitude' String0 ) ?
'}'

EnumerationType:
'EnumerationType' '{'
( 'name' ID ) ? 'enumLiteral' '{'
String0 ( ',' String0 ) *
'}'
'}'

Field:
'Field' '{'
( 'name' ID ) ? 'type' [Type]
'}'

EString:
STRING | ID