ATL: Atlas Transformation Language Specification of the ATL Virtual
Total Page:16
File Type:pdf, Size:1020Kb
ATL: Atlas Transformation Language Specification of the ATL Virtual Machine - version 0.1 - 2005 by ATLAS group LINA & INRIA Nantes Content Figure List .................................................................................................................................. 4 Table List.................................................................................................................................... 4 1 Introduction....................................................................................................................... 5 2 ATL Programming Language Concepts ........................................................................... 6 2.1 OCL Types and OCL Expressions in ATL................................................................... 6 2.1.1 OCL Primitive Types.......................................................................................... 6 2.1.2 OCL Collections ................................................................................................. 7 2.1.3 OCL Model Elements ....................................................................................... 10 2.1.4 Enumerations .................................................................................................... 11 2.1.5 OCL If Expression............................................................................................ 11 2.1.6 OCL Let Expression ......................................................................................... 11 2.1.7 OCL Comment.................................................................................................. 11 2.1.8 OCL Tips and Tricks ........................................................................................ 12 2.2 ATL Modules.............................................................................................................. 12 2.2.1 Preparation........................................................................................................ 13 2.2.2 Header Section.................................................................................................. 13 2.2.3 Import Section................................................................................................... 14 2.2.4 Helpers.............................................................................................................. 14 2.2.5 Rules ................................................................................................................. 15 2.3 ATL Advanced Features............................................................................................. 16 2.3.1 Queries and the Generation of Text.................................................................. 16 2.3.2 Libraries............................................................................................................ 17 2.3.3 Complex Headers.............................................................................................. 17 2.3.4 Rules with Multiple Instantiations.................................................................... 18 2.3.5 Navigation and Multiple Instantiations............................................................. 18 2.3.6 Flexible Runtime Instantiation of Target Elements.......................................... 19 3 The Structure of the ATL Virtual Machine..................................................................... 21 3.1 Data Types .................................................................................................................. 21 3.1.1 Primitive Types................................................................................................. 21 3.1.2 Composite Types .............................................................................................. 21 3.2 Runtime Data Structures............................................................................................. 22 3.2.1 The pc Register ................................................................................................ 22 3.2.2 The ATL Virtual Machine Stack ...................................................................... 22 3.3 Frames......................................................................................................................... 22 3.3.1 Local Variables................................................................................................. 23 3.3.2 Operand Stack................................................................................................... 23 3.4 Representation of Model Elements............................................................................. 23 3.5 Instruction Set Summary............................................................................................. 23 3.5.1 Operand Stack Handling Instructions............................................................... 24 3.5.2 Control Instructions .......................................................................................... 24 3.5.3 Model Handling Instructions ............................................................................ 24 4 The ATL Virtual Machine Instruction Set...................................................................... 26 4.1 Format of Instruction Description............................................................................... 26 4.2 Stack Handling Instructions........................................................................................ 26 4.2.1 The push instruction.......................................................................................... 26 4.2.2 The pushi instruction......................................................................................... 26 4.2.3 The pushd instruction........................................................................................ 27 4.2.4 The pusht instruction......................................................................................... 27 4.2.5 The pushf instruction ........................................................................................ 27 4.2.6 The pop instruction........................................................................................... 27 4.2.7 The store instruction ......................................................................................... 28 4.2.8 The load instruction .......................................................................................... 28 4.2.9 The swap instruction......................................................................................... 28 4.2.10 The dup instruction ........................................................................................... 28 4.2.11 The dup_x1 instruction ..................................................................................... 29 4.3 Control Instructions .................................................................................................... 29 4.3.1 The if instruction............................................................................................... 29 4.3.2 The goto instruction.......................................................................................... 29 4.3.3 The iterate instruction....................................................................................... 30 4.3.4 The enditerate instruction ................................................................................. 30 4.3.5 The call instruction ........................................................................................... 30 4.4 Model Handling Instructions ...................................................................................... 31 4.4.1 The new instruction........................................................................................... 31 4.4.2 The get instruction ............................................................................................ 32 4.4.3 The set instruction............................................................................................. 32 4.4.4 The findme instruction...................................................................................... 32 4.4.5 The getasm instruction...................................................................................... 33 5 The asm File Format....................................................................................................... 34 5.1 Overview of the asm File Structure ........................................................................... 34 5.2 The Constant Pool....................................................................................................... 34 5.2.1 Data Types Encoding........................................................................................ 35 5.2.2 Operation Signatures Encoding ........................................................................ 36 5.2.3 Expressions Location Encoding........................................................................ 36 5.3 The Fields.................................................................................................................... 36 5.4 The Operations............................................................................................................ 37 5.4.1 The Context....................................................................................................... 37 5.4.2 The Parameters.................................................................................................. 38 5.4.3 The Code........................................................................................................... 38 5.4.4 The Line