TDLan2.xtext 39 KB
Newer Older
//;
//


SimpleDataInstance_Impl returns tdl::SimpleDataInstance:
	dataType=[tdl::DataType|Identifier]
	(name=Identifier | name=NumberAsIdentifier)
	('with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
	'}')?
	';'
	;

SimpleDataType_Impl returns tdl::SimpleDataType:
	{tdl::SimpleDataType}
	//'Simple' 'Data' 'Type'
	'Type'
	name=Identifier
	 (
    'with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
    '}')?
	';'
	;		

StaticDataUse returns tdl::StaticDataUse:
	DataInstanceUse | AnyValue | AnyValueOrOmit | OmitValue | LiteralValueUse;

Stop returns tdl::Stop:
	{tdl::Stop}
	'terminate'
	('with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
		('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
	
		('name' name=Identifier)?
		('time' 'label' timeLabel=TimeLabel)?
		('time' 'constraints' ':' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* ';' )?
	'}')?
	';';

String0 returns ecore::EString:
	STRING
;


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


StructuredDataInstance returns tdl::StructuredDataInstance:
	{tdl::StructuredDataInstance}
	dataType=[tdl::DataType|Identifier]
	(name=Identifier | name=NumberAsIdentifier)
	(unassignedMember=UnassignedMemberTreatment)?
	'('( memberAssignment+=MemberAssignment (',' memberAssignment+=MemberAssignment)*  )?')'		
	('with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
	'}')?
	';'
	;

StructuredDataType returns tdl::StructuredDataType:
	{tdl::StructuredDataType}
	//'Structured' 'Data' 'Type'
	'Type'
	name=Identifier
	(extension=Extension)?
	'(' ( member+=Member ( "," member+=Member)* )? ')'
   	(
    'with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
    '}')?
    ';';

TargetMessage returns tdl::Target:
	targetGate=[tdl::GateReference|IdentifierDot]
	//TODO: check what the correct syntax shall be
	(valueAssignment+=ValueAssignmentMessage)?
   	(
    'with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
		('name' name=Identifier)?
    '}')?
    ;

TargetProcedure returns tdl::Target:
    targetGate=[tdl::GateReference|IdentifierDot]
    //TODO: check what the correct syntax shall be
    (valueAssignment+=ValueAssignmentProcedure ("," valueAssignment+=ValueAssignmentProcedure)*)?
    (
    'with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
        ('name' name=Identifier)?
    '}')?
    ;


ValueAssignmentMessage returns tdl::ValueAssignment:
    //TODO: check what the correct syntax shall be
    'where' 'it' 'is' 'assigned' 'to' variable=[tdl::Variable|Identifier]
    (
    'with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
        ('name' name=Identifier)?
    '}')?
    ;

ValueAssignmentProcedure returns tdl::ValueAssignment:
    //TODO: check what the correct syntax shall be
    'where' parameter=[tdl::Parameter|Identifier] 'is' 'assigned' 'to' variable=[tdl::Variable|Identifier]
    
    (
    'with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
        ('name' name=Identifier)?
    '}')?
    ;


TestConfiguration returns tdl::TestConfiguration:
	'Test' 'Configuration'
		name=Identifier
	'{'
		componentInstance+=ComponentInstance (componentInstance+=ComponentInstance)* 
		connection+=Connection (connection+=Connection)* 
	'}'
    ('with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
    '}')?
	;

TestDescription returns tdl::TestDescription:
	'Test' 'Description'
		(isLocallyOrdered?='Implementation')?
	
		name=Identifier
		('(' formalParameter+=FormalParameter ( "," formalParameter+=FormalParameter)* ')')?
		'uses' 'configuration' testConfiguration=[tdl::TestConfiguration|Identifier] 
		(behaviourDescription=BehaviourDescription | ';')
    ('with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
        ('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
    '}')?
	;

TestDescriptionReference returns tdl::TestDescriptionReference:
	'execute'
	testDescription=[tdl::TestDescription|Identifier]
	('(' actualParameter+=ParameterBinding ( "," actualParameter+=ParameterBinding)* ')' )?
	('with'
	  '{'
		('bindings' '{' componentInstanceBinding+=ComponentInstanceBinding ( "," componentInstanceBinding+=ComponentInstanceBinding)* '}' )?
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
		('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
	
		('name' name=Identifier)?
		('time' 'label' timeLabel=TimeLabel)?
		('time' 'constraints' ':' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* ';' )?
	'}')?
	';';

TestObjective returns tdl::TestObjective:
	{tdl::TestObjective}
	'Test' 'Objective'
		(name=Identifier)?
	'{'
		('from' ':' objectiveURI+=String0 ';' ( 'from' ':' objectiveURI+=String0 ';')* )?
		('description' ':' description=String0 ';')?
	'}'
    ('with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
    '}')?
	;


Time returns tdl::Time:
	{tdl::Time}
	'Time'
	name=Identifier
    ('with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
    '}')?
	';';

TimeConstraint returns tdl::TimeConstraint:
		(name=Identifier)?
		timeConstraintExpression=DataUse
		('with'
		'{'
			(comment+=Comment (comment+=Comment)*)?
			(annotation+=Annotation (annotation+=Annotation)*)?
		'}')?
	;

TimeLabel returns tdl::TimeLabel:
	name=Identifier
//	'in' 
//	dataType=[tdl::DataType|Identifier]
    ('with'
    '{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
    '}')?
	';';

TimeOut returns tdl::TimeOut:
	componentInstance=[tdl::ComponentInstance|Identifier]
	'.'	
	timer=[tdl::Timer|Identifier]
	'times' 'out'
	('with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
		('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
		('name' name=Identifier)?
		('time' 'label' timeLabel=TimeLabel)?
		('time' 'constraints' ':' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* ';' )?
	'}')?
	';'
	;

Timer returns tdl::Timer:
	{tdl::Timer}
	'timer'
	name=Identifier
	('with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
	'}')?
	';';


TimerStart returns tdl::TimerStart:
	'start'
	componentInstance=[tdl::ComponentInstance|Identifier]
	'.'
	timer=[tdl::Timer|Identifier]
	'for'
	period=DataUse
	('with' 
	 '{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
		('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
		('time' 'label' timeLabel=TimeLabel)?
		('time' 'constraints' ':' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* ';' )?
		('name' name=Identifier)?
	'}')?
	';'
	;

TimerStop returns tdl::TimerStop:
	'stop'
	componentInstance=[tdl::ComponentInstance|Identifier]
	'.'
	timer=[tdl::Timer|Identifier]
	('with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
		('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
		('name' name=Identifier)?
		('time' 'label' timeLabel=TimeLabel)?
		('time' 'constraints' ':' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* ';' )?
	'}')?
	';'
	;


UnboundedLoopBehaviour returns tdl::UnboundedLoopBehaviour:
	'repeat'
	block=Block
	(
	'with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
		('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
		('name' name=Identifier)?
    	(periodic+=PeriodicBehaviour ( periodic+=PeriodicBehaviour)* )?
    	(exceptional+=ExceptionalBehaviour ( exceptional+=ExceptionalBehaviour)*)?
	'}'
	)?
	;

Variable returns tdl::Variable:
	'variable'
	name=Identifier
	'of' 'type'
	dataType=[tdl::DataType|Identifier]
	('with' 
	'{'
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
	'}')?
	';';

VariableUse returns tdl::VariableUse:
	//TODO: try to adjust syntax so that -> is not necessary
	componentInstance=[tdl::ComponentInstance|Identifier]
	'->'
	variable=[tdl::Variable|Identifier]
	('(' argument+=ParameterBinding ( "," argument+=ParameterBinding)* ')' )?
	(reduction+=CollectionReference)?
	('with' 
	'{'
		('name' name=Identifier)?
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
	'}')?
	;


//Verdict returns tdl::Verdict:
//	//'verdict'
//	(	(dataType=[tdl::DataType|PredefinedVerdict] name=Identifier)
//		| 
//		('Verdict' name=Identifier 'of type' dataType=[tdl::DataType|Identifier])
//	)
//    ('with'
//    '{'
//        (comment+=Comment (comment+=Comment)*)?
//        (annotation+=Annotation (annotation+=Annotation)*)?
//    '}')?
//    ';'
//	;


VerdictAssignment returns tdl::VerdictAssignment:
	'set' 'verdict' 'to'
	verdict=DataUse
	(
	'with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
		('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
		('name' name=Identifier)?
		('time' 'label' timeLabel=TimeLabel)?
		('time' 'constraints' ':' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* ';' )?
	'}')?
	';'
	;

Wait returns tdl::Wait:
	( 'component' componentInstance=[tdl::ComponentInstance|Identifier])
	'waits' 'for'
	period=DataUse
	('with'
	'{'
		(comment+=Comment (comment+=Comment)*)?
		(annotation+=Annotation (annotation+=Annotation)*)?
		('test' 'objectives' ':' testObjective+=[tdl::TestObjective|Identifier] ( "," testObjective+=[tdl::TestObjective|Identifier])* ';')?
		('name' name=Identifier)?
		('time' 'label' timeLabel=TimeLabel)?
		('time' 'constraints' ':' timeConstraint+=TimeConstraint ( "," timeConstraint+=TimeConstraint)* ';' )?
		
	'}')?
	';';
	
NumberAsIdentifier returns ecore::EString:
    '-'? INT ('.' INT)?;

Extension returns tdl::Extension:
	'extends' extending=[tdl::PackageableElement|Identifier]
	;



LiteralValueUse returns tdl::LiteralValueUse:
	{tdl::LiteralValueUse}
	value=String0
	(
 		'of' 'type' dataType=[tdl::DataType|Identifier]
	)?
    ('with'
    '{'
		('name' name=Identifier)?
        (comment+=Comment (comment+=Comment)*)?
        (annotation+=Annotation (annotation+=Annotation)*)?
    '}')?
	;