Skip to main content



      Home
Home » Modeling » ATL » How to create a call to a helper in a HOT?
How to create a call to a helper in a HOT? [message #1114919] Mon, 23 September 2013 08:11 Go to next message
Eclipse UserFriend
Dear all,

I am writing a HOT (higher order transformation) that takes as input an ATL model and produces an ATL model.

In the output model, I create a helper and I want to add a call to this helper in one of the rules I produce.

Here is the code I use in the HOT to create the call to a helper:
lazy rule createHelperCall {
	from 
		theOperationName: String
	to
		call: MM_ATL!OperationCallExp(
			operationName <- theOperationName,
			source <- thisModule.getOutputModule()
		)
	do
	{
		call;
	}
}


getOutputModule is a helper that returns the output module created by the HOT.

Unfortunaltely, this does not work and I have no idea how to fill in the "source" field in order to produce something like this in the output ATL code:

thisModule.<theOperationName>()

Can someone give me a hint about this?
Thanks,
Etienne.

[Updated on: Mon, 23 September 2013 14:03] by Moderator

Re: How to create a call to a helper in a HOT? [message #1114977 is a reply to message #1114919] Mon, 23 September 2013 09:46 Go to previous messageGo to next message
Eclipse UserFriend
The "thisModule" is an ATL!VariableExp, not a Module. Tip: write the ATL code you want to generate by hand, and then use the ATL editor's outline view to see what the abstract syntax tree looks like. It is not always intuitive!

[Updated on: Mon, 23 September 2013 09:47] by Moderator

Re: How to create a call to a helper in a HOT? [message #1115076 is a reply to message #1114977] Mon, 23 September 2013 12:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi Dennis,

thanks for your quick answer. Indeed, your hint helps a lot. The problem now is to figure out how to fill the "referrefVariable" field of ATL!VariableExp class. Sorry to ask, but I really don't see what to put there.

Etienne.

[Updated on: Mon, 23 September 2013 13:43] by Moderator

Re: How to create a call to a helper in a HOT? [message #1115133 is a reply to message #1115076] Mon, 23 September 2013 14:02 Go to previous message
Eclipse UserFriend
OK, just had to create a VariableDeclaration object and assign its field varName the value 'thisModule'. The created object is then assigned to the referrefVariable field of my VariableExp object.

Here is the code I have now:
lazy rule createHelperCall {
	from 
		theOperationName: String
	to
		argcall: MM_ATL!OperationCallExp(
			operationName <- theOperationName,
			source <- currentModuleExp
		),
		currentModuleExp: MM_ATL!VariableExp
		(
			referredVariable <- currentModuleDecl
		),
		currentModuleDecl: MM_ATL!VariableDeclaration
		(
			varName <- 'thisModule'
		)
	do
	{
		argcall;
	}
}

[Updated on: Mon, 23 September 2013 14:02] by Moderator

Previous Topic:Output model tagged values from the stereotype point to the input model
Next Topic:Organizing logical combination of boolean expressions in a HOT
Goto Forum:
  


Current Time: Tue Jul 22 20:47:35 EDT 2025

Powered by FUDForum. Page generated in 0.03058 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top