Commit 120e91b7 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

* partial alignment of grammar, #208

- part 4 not done yet, terminals may be relocated
parent 765fe021
Loading
Loading
Loading
Loading
Loading
+174 −93
Original line number Diff line number Diff line
@@ -10,16 +10,18 @@ import "http://www.etsi.org/spec/TDL/1.3.1/configurations" as tc
//# Foundation

//Needs to be the first rule
//Package
Package returns tdl::Package:
    AnnotationCommentFragment
    'Package' name=PackageName
    (BEGIN
        (^import+=ElementImport//)*
        | packagedElement+=PackageableElement //)*
        (^import+=ElementImport
        | packagedElement+=PackageableElement
        | nestedPackage+=Package)*
    END)?
;

//PackageableElement
PackageableElement returns tdl::PackageableElement:
    (AnnotationType | TestObjective
     | ConstraintType
@@ -49,7 +51,6 @@ PackageableElement returns tdl::PackageableElement:
;

//Element : Abstract

fragment AnnotationFragment returns tdl::Element:
	'@' 
	//Workaround for upstream issue
@@ -70,18 +71,15 @@ fragment CommentFragment returns tdl::Element:
	)
;


fragment AnnotationCommentFragment returns tdl::Element:
    CommentFragment?
    AnnotationFragment?
    //(annotation+=Annotation)*
;

fragment PIXITAnnotationFragment returns tdl::Element:
	annotation+=PIXITAnnotation
;


fragment NameFragment returns tdl::Element:
    'Name' ':' name=Identifier
;
@@ -101,7 +99,9 @@ fragment WithNameFragment returns tdl::Element:
;

//NamedElement : Abstract
//Void.

//ElementImport
ElementImport returns tdl::ElementImport:
    AnnotationCommentFragment
    'Import'
@@ -113,6 +113,7 @@ ElementImport returns tdl::ElementImport:
    'from' importedPackage=[tdl::Package|QIdentifier]
;

//Comment
SingleComment returns tdl::Comment:
    (name=NIdentifier)? 
    ':' body=EString
@@ -123,7 +124,7 @@ MultiComment returns tdl::Comment:
    body=EString
;


//Annotation
Annotation returns tdl::Annotation:
    key=[tdl::AnnotationType|AIdentifier]
    (':' value=EString)?
@@ -139,13 +140,14 @@ PIXITAnnotation returns tdl::Annotation:
    (':' value=EString)?
;


//AnnotationType
AnnotationType returns tdl::AnnotationType:
    AnnotationCommentFragment
    'Annotation' name=AIdentifier
    ('extends' extension=Extension)?
;

//TestObjective
TestObjective returns tdl::TestObjective:
    AnnotationCommentFragment
    'Objective' name=DeclName
@@ -155,16 +157,19 @@ TestObjective returns tdl::TestObjective:
    END)?
;

//Extension
Extension returns tdl::Extension:
    //NOTE: No annotations or comments
    extending=[tdl::PackageableElement|DeclName]
;

//ConstraintType
ConstraintType returns tdl::ConstraintType: 
    AnnotationCommentFragment
    'Constraint' name=DeclName
;

//Constraint
Constraint returns tdl::Constraint: 
    //NOTE: No annotations or comments
    type=[tdl::ConstraintType|DeclName]
@@ -175,12 +180,14 @@ Constraint returns tdl::Constraint:

//## Data Definition

//DataResourceMapping
DataResourceMapping returns tdl::DataResourceMapping:
    AnnotationCommentFragment
    'Use' resourceURI=EString
    'as' name=Identifier
;

//DataElementMapping
DataElementMapping returns tdl::DataElementMapping:
    AnnotationCommentFragment
    'Map' mappableDataElement=[tdl::MappableDataElement|DeclName]
@@ -192,6 +199,7 @@ DataElementMapping returns tdl::DataElementMapping:
    END)?
;

//ParameterMapping
ParameterMapping returns tdl::ParameterMapping:
    AnnotationCommentFragment
    parameter=[tdl::Parameter|ParameterIdentifier]
@@ -199,11 +207,11 @@ ParameterMapping returns tdl::ParameterMapping:
;

//DataType: Abstract

fragment ConstraintFragment returns tdl::DataType:
    (LBrace constraint+=Constraint RBrace)* 
;

//SimpleDataType
SimpleDataType returns tdl::SimpleDataType:
    AnnotationCommentFragment
    'Type' name=Identifier
@@ -211,7 +219,7 @@ SimpleDataType returns tdl::SimpleDataType:
    ('extends' extension=Extension)?
;

//DONE: boolean data instance
//SimpleDataInstance
SimpleDataInstance returns tdl::SimpleDataInstance:
    AnnotationCommentFragment
    PIXITAnnotationFragment?
@@ -230,7 +238,7 @@ EnumDataInstance returns tdl::SimpleDataInstance:
    name=Identifier 
;


//StructuredDataType
StructuredDataType returns tdl::StructuredDataType:
    AnnotationCommentFragment
    'Structure' name=Identifier
@@ -239,6 +247,7 @@ StructuredDataType returns tdl::StructuredDataType:
    LParen (member+=Member (',' member+=Member)*)? RParen
;

//Member
Member returns tdl::Member:
    AnnotationCommentFragment
    (isOptional?='optional')?
@@ -248,6 +257,7 @@ Member returns tdl::Member:
    ('=' value=DataUse)?
;

//StructuredDataInstance
StructuredDataInstance returns tdl::StructuredDataInstance:
    AnnotationCommentFragment
    PIXITAnnotationFragment?
@@ -257,12 +267,14 @@ StructuredDataInstance returns tdl::StructuredDataInstance:
    LParen (memberAssignment+=MemberAssignment (',' memberAssignment+=MemberAssignment)*)? RParen
;

//MemberAssignment
MemberAssignment returns tdl::MemberAssignment:
    AnnotationCommentFragment
    member=[tdl::Member|ParameterIdentifier]
    '=' memberSpec=DataUse
;

//CollectionDataType
CollectionDataType returns tdl::CollectionDataType:
    AnnotationCommentFragment
    PIXITAnnotationFragment?
@@ -271,6 +283,7 @@ CollectionDataType returns tdl::CollectionDataType:
    'of' itemType=[tdl::DataType|Identifier]
;

//CollectionDataInstance
CollectionDataInstance returns tdl::CollectionDataInstance:
    AnnotationCommentFragment
    dataType=[tdl::DataType|Identifier] 
@@ -279,12 +292,14 @@ CollectionDataInstance returns tdl::CollectionDataInstance:
    '[' item+=DataUse (',' item+=DataUse)* ']'    
;

//ProcedureSignature
ProcedureSignature returns tdl::ProcedureSignature:
    AnnotationCommentFragment
    'Signature' name=DeclName
    LParen parameter+=ProcedureParameter ( ',' parameter+=ProcedureParameter)* RParen
;

//ProcedureParameter
ProcedureParameter returns tdl::ProcedureParameter:
    AnnotationFragment?
    kind=ParameterKind
@@ -294,9 +309,15 @@ ProcedureParameter returns tdl::ProcedureParameter:
    WithCommentFragment?
;

//ParameterKind
enum ParameterKind returns tdl::ParameterKind:
    In = 'in' | Out = 'out' | Exception = 'exception';
    In = 'in' | Out = 'out' | Exception = 'exception'
;

//Parameter
//Void.

//FormalParameter
FormalParameter returns tdl::FormalParameter:
    AnnotationFragment?
    dataType=[tdl::DataType|Identifier]
@@ -305,6 +326,7 @@ FormalParameter returns tdl::FormalParameter:
    WithCommentFragment?
;

//Variable
Variable returns tdl::Variable:
    AnnotationCommentFragment
    'variable' dataType=[tdl::DataType|Identifier]
@@ -312,6 +334,7 @@ Variable returns tdl::Variable:
    WithCommentFragment?
;

//Action
Action returns tdl::Action:
    AnnotationCommentFragment
    'Action' name=DeclName
@@ -319,6 +342,7 @@ Action returns tdl::Action:
    (':' body=EString)?
;
    
//Function
Function returns tdl::Function:
    AnnotationCommentFragment
    'Function' name=DeclName
@@ -327,9 +351,12 @@ Function returns tdl::Function:
    (':' body=EString)?
;

//UnassignedMemberTreatment
enum UnassignedMemberTreatment returns tdl::UnassignedMemberTreatment:
    AnyValue = '?' | AnyValueOrOmit = '*';
    AnyValue = '?' | AnyValueOrOmit = '*'
;

//PredefinedFunction
PredefinedFunction returns tdl::PredefinedFunction:
    AnnotationCommentFragment
    'Predefined' 
@@ -341,22 +368,18 @@ PredefinedFunction returns tdl::PredefinedFunction:
;

PredefinedIdentifierBinary returns ecore::EString:
    '+' | '-' | '*' | '/' | 'mod' 
  | '>' | '<' | '>=' | '<=' //DONE: fix extra '>=' also in TDLan2
  | '==' | '!=' | 'and' | 'or' | 'xor'
    PredefinedIdentifierOr
    | PredefinedIdentifierXor
    | PredefinedIdentifierAnd
    | PredefinedIdentifierEquality
    | PredefinedIdentifierRelational
    | PredefinedIdentifierMultiplicative
;

PredefinedIdentifierMinus returns ecore::EString:
    '-'
;

PredefinedIdentifierNot returns ecore::EString:
    'not'
;

PredefinedIdentifierSize returns ecore::EString:
    'size'
;
PredefinedIdentifierNot 			returns ecore::EString: 'not';
PredefinedIdentifierMinus			returns ecore::EString: '-';
PredefinedIdentifierSize 			returns ecore::EString: 'size';

// Precedence (lowest to highest):
// OrExpression → XorExpression → AndExpression → NotExpression → EqualityExpression
@@ -370,6 +393,7 @@ PredefinedIdentifierRelational returns ecore::EString: '<' | '>' | '<=' | '>
PredefinedIdentifierAdditive       	returns ecore::EString: '+' | '-';
PredefinedIdentifierMultiplicative 	returns ecore::EString: '*' | '/' | 'mod';

//EnumDataType
EnumDataType returns tdl::EnumDataType: 
    AnnotationCommentFragment
    'Enumerated' name=Identifier
@@ -381,6 +405,7 @@ EnumDataType returns tdl::EnumDataType:

//## Data Use

//DataUse
DataUse returns tdl::DataUse:
    XorExpression
    ({tdl::PredefinedFunctionCall.actualParameters+=current}
@@ -480,7 +505,7 @@ fragment CheckFragment returns tdl::DataUse:
    LBrace (annotation+=CheckAnnotation) RBrace
;


//ParameterBinding
ParameterBinding returns tdl::ParameterBinding:
    parameter=[tdl::Parameter|ParameterIdentifier]
	//TODO: is there a better way? -> will need to be rethought, semantics for collections still problematic..
@@ -492,18 +517,21 @@ fragment ParameterReductionFragment returns tdl::ParameterBinding:
    (reduction+=MemberReference)+
;

//MemberReference
MemberReference returns tdl::MemberReference:
    ('.' member=[tdl::Member|ParameterIdentifier])
    |
    ('.' 'get' LParen collectionIndex=DataUse RParen)
;

//StaticDataUse
StaticDataUse returns tdl::StaticDataUse:    
    DataInstanceUse
    | SpecialValueUse
    | LiteralValueUse
;

//DataInstanceUse
DataInstanceUse returns tdl::DataInstanceUse:
    (
    	'instance' dataInstance=[tdl::DataInstance|Identifier]
@@ -533,25 +561,30 @@ fragment CollectionItemFragmentDataInstanceUse returns tdl::DataInstanceUse:
    '[' (item+=DataUse (',' item+=DataUse)*)? ']'
;

//SpecialValueUse
SpecialValueUse returns tdl::SpecialValueUse:
    OmitValue | AnyValue | AnyValueOrOmit 
;

//AnyValue
AnyValue returns tdl::AnyValue:
    name='?'
    (LBrace dataType=[tdl::DataType|Identifier] RBrace)?
    CheckFragment?
;

//AnyValueOrOmit
AnyValueOrOmit returns tdl::AnyValueOrOmit:
    name='*'
    CheckFragment?
;

//OmitValue
OmitValue returns tdl::OmitValue:
    name='omit'
;

//LiteralValueUse
LiteralValueUse returns tdl::LiteralValueUse:
	(value=STRING | intValue=BIGINTEGER | boolValue=BOOLEAN)
    //Note overloaded syntax with constraints, in a sense this is a constraint too..
@@ -576,7 +609,7 @@ CastDataUse returns tdl::CastDataUse:
	// ReductionFragment now handled by PostfixExpression
;


//DynamicDataUse
DynamicDataUse returns tdl::DynamicDataUse:
    FunctionCall
    | FormalParameterUse
@@ -589,6 +622,7 @@ DynamicDataUse returns tdl::DynamicDataUse:
;

//TODO: deprecated?
//FunctionCall
FunctionCall returns tdl::FunctionCall:
    'instance' 'returned' 'from' function=[tdl::Function|DeclName]
    ParameterBindingFragment
@@ -596,12 +630,14 @@ FunctionCall returns tdl::FunctionCall:
;

//TODO: deprecated?
//FormalParameterUse
FormalParameterUse returns tdl::FormalParameterUse:
    'parameter' parameter=[tdl::FormalParameter|ParameterIdentifier]
    ParameterBindingFragment?
    // ReductionFragment now handled by PostfixExpression
;

//VariableUse
VariableUse returns tdl::VariableUse:
    componentInstance=[tdl::ComponentInstance|Identifier] '::' 
    variable=[tdl::Variable|Identifier]
@@ -616,6 +652,7 @@ VariableUseAssignment returns tdl::VariableUse:
    ParameterBindingFragment?
;

//PredefinedFunctionCall
PredefinedFunctionCall returns tdl::PredefinedFunctionCall:
    PredefinedFunctionCallSize
    | PredefinedFunctionCallNot
@@ -721,47 +758,55 @@ fragment CollectionItemFragment returns tdl::DataElementUse:

//# Time

//Time
Time returns tdl::Time:
    AnnotationCommentFragment
    'Time' name=DeclName
;

//TimeLabel
TimeLabel returns tdl::TimeLabel:
    //NOTE: No annotations or comments
    name=Identifier '=' 'now'    
;

//TimeLabelUse
TimeLabelUse returns tdl::TimeLabelUse:
    //NOTE: No reduction and parameter binding (constraint)
    '@' timeLabel=[tdl::TimeLabel|Identifier]
    ('.' kind=TimeLabelUseKind)?
;


//TimeLabelUseKind
enum TimeLabelUseKind returns tdl::TimeLabelUseKind:
    Last = 'last' | Previous = 'previous' | First = 'first'
;

//TimeConstraint
TimeConstraint returns tdl::TimeConstraint:
    //NOTE: No annotations or comments
    timeConstraintExpression=DataUse
;

//Timer
Timer returns tdl::Timer:
    AnnotationCommentFragment
    'timer' name=DeclName
;

//TimeOperation
TimeOperation returns tdl::TimeOperation: 
    Wait | Quiescence
;

//Wait
Wait returns tdl::Wait: 
    AtomicPrefixFragment
    'wait' 'for' period=DataUse
    ( 'on' componentInstance=[tdl::ComponentInstance|Identifier])?
;

//Quiescence
Quiescence returns tdl::Quiescence: 
    AtomicPrefixFragment
    'quiet' 'for' period=DataUse 
@@ -772,31 +817,31 @@ Quiescence returns tdl::Quiescence:
    )?
;


//TimerOperation
TimerOperation returns tdl::TimerOperation: 
    TimerStart | TimerStop | TimeOut
;

//TimerStart
TimerStart returns tdl::TimerStart:
    AtomicPrefixFragment
    //TODO: towards scoped components
    'start' 
    (componentInstance=[tdl::ComponentInstance|Identifier] '::')? 
    timer=[tdl::Timer|DeclName]
    'for' period=DataUse
;

//TimerStop
TimerStop returns tdl::TimerStop:
    AtomicPrefixFragment
    //TODO: towards scoped components
    'stop' 
    (componentInstance=[tdl::ComponentInstance|Identifier] '::')? 
    timer=[tdl::Timer|DeclName]
;

//TimeOut
TimeOut returns tdl::TimeOut:
    AtomicPrefixFragment
    //TODO: towards scoped components
    'timeout' 'on' 
    (componentInstance=[tdl::ComponentInstance|Identifier] '::')? 
    timer=[tdl::Timer|DeclName]
@@ -804,6 +849,7 @@ TimeOut returns tdl::TimeOut:

//# Test Configuration

//GateType
GateType returns tdl::GateType:
    AnnotationCommentFragment
    kind=GateTypeKind
@@ -812,10 +858,12 @@ GateType returns tdl::GateType:
    'accepts' dataType+=[tdl::DataType|Identifier] ( ',' dataType+=[tdl::DataType|Identifier])*
;

//GateTypeKind
enum GateTypeKind returns tdl::GateTypeKind:
    Message = 'Message' | Procedure = 'Procedure'
;

//GateInstance
GateInstance returns tdl::GateInstance:
    AnnotationCommentFragment
    'gate' type=[tdl::GateType|DeclName]
@@ -823,6 +871,7 @@ GateInstance returns tdl::GateInstance:
    WithCommentFragment?  
;

//ComponentType
ComponentType returns tdl::ComponentType:
    AnnotationCommentFragment
    'Component' name=DeclName
@@ -832,6 +881,7 @@ ComponentType returns tdl::ComponentType:
    END
;

//ComponentInstance
ComponentInstance returns tdl::ComponentInstance:
    AnnotationCommentFragment
    type=[tdl::ComponentType|DeclName]
@@ -843,6 +893,7 @@ enum ComponentInstanceRole returns tdl::ComponentInstanceRole:
    SUT = 'SUT' | Tester = 'Tester'
;

//GateReference
GateReference returns tdl::GateReference:
    //NOTE: No annotations or comments
    //		-> note that if the name is present, it shall be used exclusively
@@ -852,6 +903,7 @@ GateReference returns tdl::GateReference:
    gate=[tdl::GateInstance|Identifier]
;

//Connection
Connection returns tdl::Connection:
    AnnotationCommentFragment
    'connect' endPoint+=GateReference 
@@ -859,7 +911,7 @@ Connection returns tdl::Connection:
    WithNameFragment?
;


//TestConfiguration
TestConfiguration returns tdl::TestConfiguration:
    AnnotationCommentFragment
    'Configuration' name=DeclName
@@ -873,6 +925,7 @@ TestConfiguration returns tdl::TestConfiguration:

//## Test Description

//TestDescription
TestDescription returns tdl::TestDescription:
    TDPrefixFragment
    ('Test' 'Description' | isLocallyOrdered?='Test')
@@ -895,7 +948,7 @@ fragment TDObjectiveFragment returns tdl::TestDescription:
    ( ',' testObjective+=[tdl::TestObjective|DeclName])*
;


//BehaviourDescription
BehaviourDescription returns tdl::BehaviourDescription:
    //NOTE: No annotations or comments
    behaviour=Behaviour
@@ -903,6 +956,7 @@ BehaviourDescription returns tdl::BehaviourDescription:

//## Combined Behaviour

//Behaviour
Behaviour returns tdl::Behaviour:
    CombinedBehaviour | AtomicBehaviour
    //NOTE: Excluded via constraint:
@@ -920,10 +974,11 @@ fragment WithBehaviourFragment returns tdl::Behaviour:
;

fragment ObjectiveFragment returns tdl::Behaviour:
    'Objective' ':' testObjective+=[tdl::TestObjective|DeclName] ( ',' testObjective+=[tdl::TestObjective|DeclName])*
    'Objective' ':' testObjective+=[tdl::TestObjective|DeclName] 
    ( ',' testObjective+=[tdl::TestObjective|DeclName])*
;


//Block
Block returns tdl::Block:
    //NOTE: No annotations or comments
    ('['
@@ -946,6 +1001,7 @@ NoGuardBlock returns tdl::Block:
    END
;

//LocalExpression
LocalExpression returns tdl::LocalExpression:
    //NOTE: No annotations or comments
    expression=DataUse
@@ -958,7 +1014,7 @@ LocalLoopExpression returns tdl::LocalExpression:
    ('on' componentInstance=[tdl::ComponentInstance|Identifier])?
;


//CombinedBehaviour
CombinedBehaviour returns tdl::CombinedBehaviour:
    (SingleCombinedBehaviour | MultipleCombinedBehaviour)
    =>WithCombinedFragment?
@@ -970,12 +1026,12 @@ fragment WithCombinedFragment returns tdl::CombinedBehaviour:
        NameFragment?
        ObjectiveFragment?
        CommentFragment?
        (periodic+=PeriodicBehaviour //)*
        (periodic+=PeriodicBehaviour
        | exceptional+=ExceptionalBehaviour)*
    END
;


//SingleCombinedBehaviour
SingleCombinedBehaviour returns tdl::SingleCombinedBehaviour:
    CompoundBehaviour
    | BoundedLoopBehaviour
@@ -983,33 +1039,39 @@ SingleCombinedBehaviour returns tdl::SingleCombinedBehaviour:
    | OptionalBehaviour
;

//CompoundBehaviour
CompoundBehaviour returns tdl::CompoundBehaviour:
    AnnotationFragment?
    block=NoGuardBlock
;

//BoundedLoopBehaviour
BoundedLoopBehaviour returns tdl::BoundedLoopBehaviour:
    AnnotationFragment?
    'repeat' numIteration+=LocalLoopExpression (',' numIteration+=LocalLoopExpression)*
    block=Block
;

//UnboundedLoopBehaviour
UnboundedLoopBehaviour returns tdl::UnboundedLoopBehaviour:
    AnnotationFragment?
    'while' block=Block
;

//OptionalBehaviour
OptionalBehaviour returns tdl::OptionalBehaviour:
    AnnotationFragment?
    'optionally' block=Block
;

//MultipleCombinedBehaviour
MultipleCombinedBehaviour returns tdl::MultipleCombinedBehaviour:
    ConditionalBehaviour 
    | AlternativeBehaviour
    | ParallelBehaviour
;

//ConditionalBehaviour
ConditionalBehaviour returns tdl::ConditionalBehaviour:
    AnnotationFragment?
    'if' block+=Block
@@ -1018,12 +1080,14 @@ ConditionalBehaviour returns tdl::ConditionalBehaviour:
       ('else' block+=Block)))?
;

//AlternativeBehaviour
AlternativeBehaviour returns tdl::AlternativeBehaviour:
    AnnotationFragment?
    'alternatively' block+=Block
    ('or' block+=Block)+ 
;

//ParallelBehaviour
ParallelBehaviour returns tdl::ParallelBehaviour:
    AnnotationFragment?
    'run' block+=Block 
@@ -1031,10 +1095,12 @@ ParallelBehaviour returns tdl::ParallelBehaviour:
    ('and' block+=Block)*
;

//ExceptionalBehaviour
ExceptionalBehaviour returns tdl::ExceptionalBehaviour:
    DefaultBehaviour | InterruptBehaviour
;

//DefaultBehaviour
DefaultBehaviour returns tdl::DefaultBehaviour:
    AnnotationFragment?
    'default' 
@@ -1043,6 +1109,7 @@ DefaultBehaviour returns tdl::DefaultBehaviour:
    WithBehaviourFragment?
;

//InterruptBehaviour
InterruptBehaviour returns tdl::InterruptBehaviour:
    AnnotationFragment?
    'interrupt'
@@ -1051,6 +1118,7 @@ InterruptBehaviour returns tdl::InterruptBehaviour:
    WithBehaviourFragment?
;

//PeriodicBehaviour
PeriodicBehaviour returns tdl::PeriodicBehaviour:
    AnnotationFragment?
    'every'
@@ -1060,7 +1128,7 @@ PeriodicBehaviour returns tdl::PeriodicBehaviour:
;

//## Atomic Behaviour

//AtomicBehaviour
AtomicBehaviour returns tdl::AtomicBehaviour:
    (TimerOperation
    | TimeOperation
@@ -1096,25 +1164,27 @@ fragment TimeConstraintFragment returns tdl::AtomicBehaviour:
    LBrace timeConstraint+=TimeConstraint ( ',' timeConstraint+=TimeConstraint)* RBrace
;



//Break
Break returns tdl::Break:
    {tdl::Break}
    AtomicPrefixFragment
    'break'
;

//Stop
Stop returns tdl::Stop:
    {tdl::Stop}
    AtomicPrefixFragment
    'terminate'
;

//VerdictAssignment
VerdictAssignment returns tdl::VerdictAssignment:
    AtomicPrefixFragment
    'set' 'verdict' 'to' verdict=DataUse
;

//Assertion
Assertion returns tdl::Assertion:
    {tdl::Assertion}
    AtomicPrefixFragment
@@ -1123,10 +1193,12 @@ Assertion returns tdl::Assertion:
    ('otherwise' otherwise=DataUse)?
;

//Interaction
Interaction returns tdl::Interaction: 
    Message | ReceiveMessage | ProcedureCall | ProcedureCallResponse
;

//Message
Message returns tdl::Message:
    AtomicPrefixFragment
    sourceGate=[tdl::GateReference|GRIdentifier]
@@ -1135,38 +1207,53 @@ Message returns tdl::Message:
    'to' target+=TargetMessage ( ',' target+=TargetMessage)* 
;

TargetMessage returns tdl::Target:
    //NOTE: No name, annotations or comments
    targetGate=[tdl::GateReference|GRIdentifier]
    (valueAssignment+=ValueAssignmentMessage)?
;

ValueAssignmentMessage returns tdl::ValueAssignment:
    //NOTE: No name, annotations or comments
    'where' 'it' 'is' 
    'assigned' 'to' variable=[tdl::Variable|Identifier]
;

ReceiveMessage returns tdl::Message:
    AtomicPrefixFragment
    //NOTE: Only single target possible
    target+=ReceiveTargetMessage //( ',' target+=ReceiveTargetMessage)*
    target+=ReceiveTargetMessage
    'receives' (isTrigger?='trigger')? 
    argument=DataUse
    'from' sourceGate=[tdl::GateReference|GRIdentifier]
;

//Target
TargetMessage returns tdl::Target:
    //NOTE: No name, annotations or comments
    targetGate=[tdl::GateReference|GRIdentifier]
    (valueAssignment+=ValueAssignmentMessage)?
;

ReceiveTargetMessage returns tdl::Target:
    //NOTE: No name, annotations or comments
    (valueAssignment+=ReceiveValueAssignmentMessage)?
    targetGate=[tdl::GateReference|GRIdentifier]
;

TargetProcedure returns tdl::Target:
    //NOTE: No name, annotations or comments
    targetGate=[tdl::GateReference|GRIdentifier]
    (valueAssignment+=ValueAssignmentProcedure (',' valueAssignment+=ValueAssignmentProcedure)*)?
;

//ValueAssignment
ValueAssignmentMessage returns tdl::ValueAssignment:
    //NOTE: No name, annotations or comments
    'where' 'it' 'is' 
    'assigned' 'to' variable=[tdl::Variable|Identifier]
;

ReceiveValueAssignmentMessage returns tdl::ValueAssignment:
    //NOTE: No name, annotations or comments
    variable=[tdl::Variable|Identifier] '='
;

ValueAssignmentProcedure returns tdl::ValueAssignment:
    //NOTE: No name, annotations or comments
    'where' parameter=[tdl::Parameter|ParameterIdentifier] 'is'
    'assigned' 'to' variable=[tdl::Variable|Identifier]
;

//ProcedureCall
ProcedureCall returns tdl::ProcedureCall:
    AtomicPrefixFragment
    (name=Identifier ':')?
@@ -1185,18 +1272,7 @@ ProcedureCallResponse returns tdl::ProcedureCall:
    'to' target+=TargetProcedure
;

TargetProcedure returns tdl::Target:
    //NOTE: No name, annotations or comments
    targetGate=[tdl::GateReference|GRIdentifier]
    (valueAssignment+=ValueAssignmentProcedure (',' valueAssignment+=ValueAssignmentProcedure)*)?
;

ValueAssignmentProcedure returns tdl::ValueAssignment:
    //NOTE: No name, annotations or comments
    'where' parameter=[tdl::Parameter|ParameterIdentifier] 'is'
    'assigned' 'to' variable=[tdl::Variable|Identifier]
;
    
//TestDescriptionReference
TestDescriptionReference returns tdl::TestDescriptionReference:
    AtomicPrefixFragment
    'execute' testDescription=[tdl::TestDescription|DeclName]
@@ -1207,16 +1283,19 @@ TestDescriptionReference returns tdl::TestDescriptionReference:
    END)?
;

//ComponentInstanceBinding
ComponentInstanceBinding returns tdl::ComponentInstanceBinding:
    AnnotationCommentFragment
    formalComponent=[tdl::ComponentInstance|Identifier]
    '->' actualComponent=[tdl::ComponentInstance|Identifier]
;

//ActionBehaviour
ActionBehaviour returns tdl::ActionBehaviour: 
    ActionReference | InlineAction
;

//ActionReference
ActionReference returns tdl::ActionReference:
    AtomicPrefixFragment
    'perform' action=[tdl::Action|DeclName]
@@ -1224,12 +1303,14 @@ ActionReference returns tdl::ActionReference:
    ('on' componentInstance=[tdl::ComponentInstance|Identifier])?
;

//InlineAction
InlineAction returns tdl::InlineAction:
    AtomicPrefixFragment
    'perform' 'action' ':' body=EString
    ('on' componentInstance=[tdl::ComponentInstance|Identifier])?
;

//Assignment
Assignment returns tdl::Assignment:
    AtomicPrefixFragment
    //TODO: towards scoped components -> collides with receive