ATL: Atlas Transformation Language Specification of the ... - Eclipse
ATL: Atlas Transformation Language Specification of the ... - Eclipse
ATL: Atlas Transformation Language Specification of the ... - Eclipse
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Description<br />
<strong>Specification</strong> <strong>of</strong> <strong>the</strong> <strong>ATL</strong> Virtual Machine<br />
…, context, [arg1, [arg2 ...]] ⇒ result when called operation has a return value<br />
signature is a reference to an operation, which gives <strong>the</strong> name as well as <strong>the</strong> description <strong>of</strong> <strong>the</strong><br />
operation (context for which <strong>the</strong> operation is defined and parameters types). The named operation is<br />
resolved according to its name, its context and <strong>the</strong> number, type and order <strong>of</strong> its parameters. The<br />
context must be followed on <strong>the</strong> operand stack by nargs argument values, where <strong>the</strong> number, type,<br />
and order <strong>of</strong> <strong>the</strong> values must be consistent with <strong>the</strong> signature <strong>of</strong> <strong>the</strong> selected operation.<br />
The context and <strong>the</strong> nargs argument values are popped from <strong>the</strong> operand stack. If <strong>the</strong> operation is<br />
not native, a new frame is created on <strong>the</strong> <strong>ATL</strong> virtual machine for <strong>the</strong> method being invoked. The<br />
context and <strong>the</strong> argument values are consecutively made <strong>the</strong> values <strong>of</strong> local variables <strong>of</strong> <strong>the</strong> new<br />
frame, with context in local variable 0, arg1 in local variable 1, and so one. The new frame is <strong>the</strong>n<br />
made current, and <strong>the</strong> <strong>ATL</strong> virtual pc is set to <strong>the</strong> opcode <strong>of</strong> <strong>the</strong> first instruction <strong>of</strong> <strong>the</strong> operation to<br />
be invoked. Execution continues with <strong>the</strong> first instruction <strong>of</strong> <strong>the</strong> operation. When <strong>the</strong> operation has<br />
a return value, it is assigned to <strong>the</strong> remaining top value <strong>of</strong> <strong>the</strong> operand stack once <strong>the</strong> operation has<br />
completed. The return value is <strong>the</strong>n pushed onto <strong>the</strong> operand stack <strong>of</strong> <strong>the</strong> calling frame.<br />
If <strong>the</strong> called operation is a native method, <strong>the</strong> nargs argument values and context are passed to <strong>the</strong><br />
code that implements <strong>the</strong> method.<br />
Notes<br />
The <strong>ATL</strong> virtual machine instruction set includes no return-like instruction. It is however possible<br />
to replace it with a goto instruction pointing to <strong>the</strong> last operation instruction.<br />
4.4 Model Handling Instructions<br />
4.4.1 The new instruction<br />
Operation<br />
Create new object.<br />
Format<br />
Operand Stack<br />
Description<br />
new<br />
…, classifier-name, metamodel-name ⇒ …, reference<br />
This instruction is used to create new model elements and new composite objects. The type <strong>of</strong> <strong>the</strong><br />
object (<strong>the</strong> element) to be created is resolved from classifier-name and metamodel-name. If <strong>the</strong><br />
metamodel name is #native, <strong>the</strong> classifier is resolved from <strong>the</strong> set <strong>of</strong> supported composite native<br />
types. O<strong>the</strong>rwise, metamodel-name has to specify <strong>the</strong> name <strong>of</strong> a metamodel involved in <strong>the</strong> current<br />
transformation. The classifier is <strong>the</strong>n resolved from <strong>the</strong> target models that conform to <strong>the</strong><br />
metamodel identified by metamodel-name. If resolution completes successfully, memory for <strong>the</strong><br />
new object instance is allocated. As a result, both classifier-name and metamodel-name are popped<br />
from <strong>the</strong> operand stack and replaced by a reference to <strong>the</strong> allocated object.<br />
Notes<br />
The current version <strong>of</strong> <strong>the</strong> <strong>ATL</strong> language does not enable to run transformations producing several<br />
target models that conform to a same metamodel. In such a situation, <strong>the</strong> model in which <strong>the</strong> new<br />
model element is allocated is undefined (among <strong>the</strong> models sharing <strong>the</strong> same metamodel). Future<br />
versions <strong>of</strong> <strong>the</strong> <strong>ATL</strong> virtual machine will include an additional instruction for model element<br />
allocation. Compared to <strong>the</strong> new instruction, this instruction will accept an additional parameter in<br />
order to identify <strong>the</strong> target model into which <strong>the</strong> new element will have to be allocated.<br />
Page 31 / 62