[ATL] Could we create an ATL rule without using the "TO" part [message #659331] |
Sat, 12 March 2011 07:11  |
Eclipse User |
|
|
|
Hi,
I would like to know if we can create an ATL rule without using the "TO" part.
For example :
module X;
create OUT : out1 from IN : in1, IN1 : in2;
rule TargetfromSource {
from
x :in1!element
using{
-- variables declaration
}
do
{
-- The next part of the rule
In the "DO" part I invoke called rules that treat the target model element.
I tried it and it works perfectly without errors and I had my target models but I dont know if it is correct or not.
Thanks,
Regards
|
|
|
Re: [ATL] Could we create an ATL rule without using the "TO" part [message #659488 is a reply to message #659331] |
Mon, 14 March 2011 05:21  |
Eclipse User |
|
|
|
Hi,
According to the user guide this is not allowed as "to" is not optional...
rule rule_name {
from
in_var : in_type [in model_name]? [(
condition
)]?
[using {
var1 : var_type1 = init_exp1;
...
varn : var_typen = init_expn;
}]?
to
out_var1 : out_type1 [in model_name]? (
bindings1
),
out_var2 : distinct out_type2 foreach(e in collection)(
bindings2
),
...
out_varn : out_typen [in model_name]? (
bindingsn
)
[do {
statements
}]?
}
Perhaps, you won't get an error but it isn't a good idea to write this sort of rule as you not using ATL as it was designed to be used. From what I can see with this technique you will be using ATL as an imperative/procedural language rather than using its declarative power.
Regards,
Ronan
|
|
|
Powered by
FUDForum. Page generated in 0.04426 seconds