20090224 Mofscript Tool

  • Uploaded by: Ander Zubizarreta
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 20090224 Mofscript Tool as PDF for free.

More details

  • Words: 458
  • Pages: 17
MOFScript Ander Zubizarreta 2009-3-18

Big Picture Transformation definition

metamodel

template

<>

Model

Code

Big Picture (our example) Transformation definition

EMF

Wtsl.xsd

Wtsl.ecore

Cpp template

<>

Controllables. wtsl

C++ Code

Contents

1. MOFScript Tool 2. MOFScript Language 3. Example

MOFScript tool  Eclipse plugin  tool for model to text transformation  supports generation of implementation code or documentation from models

MOFScript M2T

<>

Doc

Code

MOFScript tool     

Rule-based .m2t extension Allows various input models Code completion Transformations can also be represented as models (XMI)

MOFScript

Creating transformation

 File  New  Other  MOFScript File

1

2

MOFScript Editor

MOFScript Compiling

MOFScript Executing

Select input model

MOFScript Console

MOFScript language  Transformation module – The definition of the transformation – Defined using keyword textmodule or texttransformation – It defines the input metamodels – The body of the transformation module contains the rules

 Transformation Inheritance – Transformations can be extended using extends keyword – Rules are inherited and they can be used or overriden in the subtransformation

MOFScript language  Imports – A transformation may import other transformations as libraries

 Variables and properties (constants) – Variables and properties can be declared either globally or locally – They can be of any of the MOFScript types

MOFScript language  Rules – Elements of a rule: • • • •

Context type -> metamodel type (optional) Return type (optional) Input parameters (optional) Body -> set of statements

– Types of rules: • Entry point rules – Defines where the execution starts -> main() – Defines for which metamodel element type it is executed – It is executed as many times as entry point type elements are in the input model

• Entry point rules without context type – It is executed only once

• Abstract rules – Abstract rules can be defined

– Rule Overriding • Rules can be overriden, either from imported transformation or within the same transformation – Different rule with the same name will be called depending on the context type.

MOFScript language  Files – Declaration of an output device for text. – Declared using keyword file. – File name and extension are given as a parameter

 If statements, Iterators, While statements, Select expressions, Printing, Logging, Expressions – Similar to other languages

 Types – Strings, Integer, Real, Boolean, List, Hashtable, Object, Model • Many operations available for each type

 Built-in functions – Many built-in functions are available in MOFScript: System functions and Output utility functions

 Other features: – Reflection support, Java invocation, UML2 integration, Unprotected Blocks, Aspects, M2M transformation

MOFScript language  For more detailed information:

– MOFScript Language Reference in Eclipse Help – Mofscript user guide: http://www.eclipse.org/gmt/mofscript/doc/MOFScript-User-

 For more information: – http://www.eclipse.org/gmt/mofscript/doc/MOFScript-User-Guide.pdf –

Related Documents

20090224
December 2019 40
Notes-20090224
December 2019 41
Tool
October 2019 30
Tool
August 2019 48

More Documents from ""