Changes for page Kieler Compiler
Last modified by Richard Kreissig on 2023/09/14 10:52
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -10,157 +10,12 @@ 10 10 11 11 The KIELER Compiler (KiCo) project allows to register step-by-step model transformations on EObjects that could be written in Xtend or Java. These transformations are registered using an extension point provided (see below). After registering transformations these can be used by simply call the KielerCompiler compilation method as also explained further below. 12 12 13 -[[image:attach: KiCo.jpg]]13 +[[image:attach:IMAG4642.jpg]] 14 14 15 15 == Extension Point == 16 16 17 - In orderto add a transformation to KiCo you must follow these steps:17 +text 18 18 19 -1. ((( 20 -Add dependency to 21 - 22 -{{{de.cau.cs.kieler.kico}}} 23 - 24 - 25 -))) 26 -1. Add the extension 27 - 28 - 29 -{{{de.cau.cs.kieler.kico.transformation}}} 30 - 31 -Add one of the following 32 - 33 -[[image:attach:KiCo2.jpg]] 34 - 35 -|=((( 36 -Extension Element 37 -)))|=((( 38 -Description 39 -))) 40 -|((( 41 -transformationClass 42 -)))|((( 43 -The defined class must extend "de.cau.cs.kieler.kico.Transformation" and must implement the methods defined in "de.cau.cs.kieler.kico.ITransformation". These are 44 - 45 -* getId(): Returns a unique String ID for this transformation. This is the ID the transformation will be referenced throughout KiCo. 46 -* getName(): Optionally return a String name for this transformation. If null is returned here the ID will be used as a name. 47 -* getDependencies(): Optionally return a List<String> of other transformation IDs that must run BEFORE this transformation. If null is returned then this means there are no dependencies. 48 -* transform(EObject): Returns an EObject and does the central transformation. 49 -))) 50 -|((( 51 -transformationMethod 52 -)))|((( 53 -The defined class can be freely chosen and does not need to extend or implement any other class or interface. Although you have to give more information in the extension element now: 54 - 55 -* class: The class where the transform method is implemented in 56 -* method: The name of the transformation method. Its signature must ensure that it returns an EObject an only take an EObject argument. Otherwise it cannot be found by KiCo. 57 -* id: The unique String ID for this transformation. This is the ID the transformation will be referenced throughout KiCo. 58 -* name: An optional String name for this transformation. If nothing is entered here the ID will be used as a name. 59 -* dependencies: An optional String as comma separated list of other transformation IDs that must run BEFORE this transformation. If nothing is entered here then this means there are no dependencies. 60 -))) 61 -|((( 62 -transformationGroup 63 -)))|((( 64 -Sometimes you may want to group other transformations and give this group a specific transformation ID as a kind of shortcut. You can do this by using the transformationGroup element giving the following information: 65 - 66 -* id: The unique String ID for this transformation group. This is the ID the transformation group will be referenced throughout KiCo. It may also again be referenced by other transformation groups! 67 -* dependencies: These are NOT optional for groups. Groups must specify their transformations as dependencies. Use a String as comma separated list of other transformation IDs or transformation group IDs that should represent this group. Note that the order will be implied by the referenced transformations itself although if there is a free degree of order it can be influenced by the order specified here in the group. 68 -* name: An optional String name for this transformation. If nothing is entered here the ID will be used as a name. 69 -))) 70 - 71 -=== Example === 72 - 73 -{{code title="plugin.xml"}} 74 - <extension 75 - point="de.cau.cs.kieler.kico.transformation"> 76 - <transformationGroup 77 - id="NORMALIZE" 78 - dependencies="TRIGGEREFFECT, SURFACEDEPTH" 79 - name="Transform All Normalize"> 80 - </transformationGroup> 81 - </extension> 82 - <extension 83 - point="de.cau.cs.kieler.kico.transformation"> 84 - <transformationMethod 85 - class="de.cau.cs.kieler.sccharts.extensions.SCChartsCoreTransformation" 86 - id="TRIGGEREFFECT" 87 - method="transformTriggerEffect" 88 - name="Transform Trigger and Effect"> 89 - </transformationMethod> 90 - </extension> 91 - 92 - <extension 93 - point="de.cau.cs.kieler.kico.transformation"> 94 - <transformationMethod 95 - class="de.cau.cs.kieler.sccharts.extensions.SCChartsCoreTransformation" 96 - id="SURFACEDEPTH" 97 - method="transformSurfaceDepth" 98 - name="Transform Surface Depth"> 99 - </transformationMethod> 100 - </extension> 101 - 102 - <extension 103 - point="de.cau.cs.kieler.kico.transformation"> 104 - <transformationGroup 105 - id="ALL" 106 - dependencies="CORE NORMALIZE" 107 - name="Transform All"> 108 - </transformationGroup> 109 - </extension> 110 -{{/code}} 111 - 112 - 113 - 114 114 == Compilation == 115 115 116 -Once a bunch of model transformations are registered, these can simply be called using the KiCo central "KielerCompiler" class with its method compile(). This will be given a List<String> of transformation IDs or a comma separated String of transformation IDs as the first parameter. The second parameter is the EObject that is being transformed. It should meet the signature of the first model transformation called. Note that the actual model transformations that are done may vary because KiCo will automatically inspect the dependencies of each transformation requested (deep-recursively). If you do not like this to happen as an advanced user you can use a third parameter that will skip this autocompletion. Note that if you switch this off also NO transformation groups can be processed. Here is an overview and examples how to use the compile() method: 117 - 118 -|=((( 119 -Method 120 -)))|=((( 121 -Description 122 -))) 123 -|((( 124 -{{{EObject KielerCompiler.compile(List<String> transformationIDs, EObject eObject)}}} 125 -)))|((( 126 -* transformationIDs: List of Strings representing the transformation IDs and a pre-ordering. Note that KiCo may automatically modify the order to meet the dependencies of the referenced transformation IDs or transformation group IDs. 127 -* eObject: The EObject that is the input to the compilation process. 128 -* Returns: The EObject returned from the last model transformation called by KiCo. 129 -))) 130 -|((( 131 -{{{EObject KielerCompiler.compile(String transformationIDs, EObject eObject)}}} 132 -)))|((( 133 -This is a convenient method only which can be used to give transformation IDs or transformation group IDs as a comma separated String. For eObject and the return value see above. 134 -))) 135 -|((( 136 -{{{EObject KielerCompiler.compile(List<String> transformationIDs, EObject eObject, boolean autoexpand)}}} 137 -)))|((( 138 -This is an advanced compile method which can turn of auto-expansion with the last parameter. Use this with care! Note that if switching autoexpand off you cannot use transformation group IDs any more. Also no dependencies will be considered. The transformations will be applied straight forward in the order defined by the transformationIDs list. 139 -))) 140 - 141 -=== Examples === 142 - 143 -{{code title="Java Code"}} 144 -import de.cau.cs.kieler.kico.KielerCompiler; 145 -... 146 -private MyEObjectClass myMethod(EObject eObject) { 147 - ... 148 - transformed = (MyEObjectClass) KielerCompiler.compile("ABORT, SIGNAL", eObject); 149 - ... 150 - return transformed 151 -} 152 -{{/code}} 153 - 154 -{{code title="Xtend Code"}} 155 -import de.cau.cs.kieler.kico.KielerCompiler 156 -... 157 -def dispatch MyEObjectClass myMethod(EObject eObject) { 158 - transformed = KielerCompiler.compile("ABORT, SIGNAL", eObject) as MyEObjectClass 159 - ... 160 - transformed 161 -} 162 - 163 - 164 - 165 - 166 -{{/code}} 21 +text
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -94700 651 +9470059 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/94700 65/Kieler Compiler (KiCo)1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/9470059/Kieler Compiler (KiCo)