Implementing Language Extensions with Model Transformations Ivan Kurtev Software Engineering Group
-
Upload
miriam-nolan -
Category
Documents
-
view
18 -
download
3
description
Transcript of Implementing Language Extensions with Model Transformations Ivan Kurtev Software Engineering Group
Sheet 1Symposium How Adaptable is MDA May 20, 2005 Enschede
Implementing Language Extensions with Model
Transformations
Ivan Kurtev
Software Engineering GroupUniversity of Twente
the Netherlands
Sheet 2Symposium How Adaptable is MDA May 20, 2005 Enschede
Outline
The Role of Languages in MDE; Language Elements; Language Extensions; Examples:
Language composition; Abstract syntax extension;
Conclusions;
Sheet 3Symposium How Adaptable is MDA May 20, 2005 Enschede
Use of Languages in MDE
Meta-modeling: modeling of languages; Transformation languages:
ComputationIndependentModel (CIM)
PlatformIndependentModel (PIM)
PlatformSpecific
Model (PSM)
Source Model Transformer Target Model
TransformationSpecification
Languages for expressing models:
Can we use MDE techniques to solve language design problems?
Sheet 4Symposium How Adaptable is MDA May 20, 2005 Enschede
Concrete Syntax Related to parsing; Textual, visual;
Abstract Syntax (L) Defines the structures represented by the concrete
syntax;
Semantics: Semantic Domain (D); Semantic Mapping (M)
M: L -> D
Language Elements
Sheet 5Symposium How Adaptable is MDA May 20, 2005 Enschede
Language Extensions
Syntax Extensions: Extensible grammars; Extensible parsers; Macro definitions;
Semantic Extensions: Modular attribute grammars; Monads; Action semantics;
Language Composition: Involves syntax and semantic extensions;
Sheet 6Symposium How Adaptable is MDA May 20, 2005 Enschede
Language Elements in MDA Terms (1)
Concrete Syntax: ? Abstract Syntax (L)
Defined as a meta-model;
Semantics: Semantic Domain (D): a model Semantic Mapping (M): a model transformation;
M: L -> D
Sheet 7Symposium How Adaptable is MDA May 20, 2005 Enschede
How can MDA techniques be used for language design tasks?
What do we gain (do we do better than the current techniques) ?
How are traditional problems solved in MDA? Language reuse; Language composition; Language extension;
Language Elements in MDA Terms (2)
Sheet 8Symposium How Adaptable is MDA May 20, 2005 Enschede
Example 1: Composing XML Languages
XMLDocument
DOMParser
ProcessingCode
DOM Tree Application Objects
Application-specific XML processing:
Transformation from XML document to application objects;
XML Language Composition: Concrete syntax composition is solved; Semantic mapping: composition of transformations; Semantic domain: software composition;
Application: hybrid XML languages and compound documents;
Transformation
Sheet 9Symposium How Adaptable is MDA May 20, 2005 Enschede
Transformation Pattern for XML Processing
Schema-less processing: based on DOM; Schema-based processing: an XML schema and DOM are available;
XML DocumentModel
ApplicationClasses
XML Document ObjectsTransformationEngine
TransformationSpecification
input output
executed by
XML SchemaModel
an XML schema
TransformationLanguage
written in
instanceOf instanceOfinstanceOf
uses usesSchemaInstOfDef
SchemaInstOf
Sheet 10Symposium How Adaptable is MDA May 20, 2005 Enschede
Structure of XML Applications
Separation of concerns: Syntax (schema); Processing logic (transformation specification); Application classes (semantic domain);
XML DocumentModel
ApplicationClasses
XML Document ObjectsTransformation
Engine
TransformationSpecification
input output
executed by
XML SchemaModel
an XML schema
TransformationLanguage
written in
instanceOf instanceOfinstanceOf
Static part of an XML application
Dynamic part of an XML application
uses uses
Sheet 11Symposium How Adaptable is MDA May 20, 2005 Enschede
Example (1)
Processing of a subset of SMIL timing module; Source schema:
<attribute name=’begin’ type=’string’/><attribute name=’end’ type=’string’/><attribute name=’dur’ type=’string’/><attribute name=’timeContainer’
type=’string’/> Example of a timed document:
<a timeContainer=’seq’ begin=’1’ dur=’20’> <b timeContainer=’par’ dur=’10’> <c timeContainer=’none’ dur=’10’/> <d timeContainer=’none’ dur=’10’/> </b> <e timeContainer=’none’ dur=’10’/></a>
SMIL – Synchronized Multimedia Integration Language
Sheet 12Symposium How Adaptable is MDA May 20, 2005 Enschede
Target Application Classes:
Example (2)
start()stop()
beginenddurctrlObject : ControlledObject
«JavaClass»TimedElement
+activate()+deactivate()
«interface»ControlledObject
«JavaClass»Interval
«JavaClass»TimeContainer
«JavaClass»Parallel
«JavaClass»Sequence
1
+components
*
Sheet 13Symposium How Adaptable is MDA May 20, 2005 Enschede
Composition of XML Languages
A new language may be composed with the timing module:
XML DocumentModel
XML Document(time constrained
widgets)
Time graph andwidget objects
TransformationEngine
executed by
XML SchemaModel
instanceOf instanceOfinstanceOf
Widget language
Timing Module
Widget Transformation
Timing Transformation
Widget Classes
Time GraphClasses
New processor is obtained via: Composing target application classes (software
composition); Composing transformation definitions (based on the
transformation language constructs);
Sheet 14Symposium How Adaptable is MDA May 20, 2005 Enschede
Example 2: Abstract Syntax Extensions
Problem: what if a transformation language does not support
required compositional operators?
Possible Solutions: Compose transformation definitions by applying a
transformation; Extend the transformation language with new constructs;
Example: Extending the abstract syntax of a language;
Sheet 15Symposium How Adaptable is MDA May 20, 2005 Enschede
Example 2: Implementation
TLMeta-ModelExt TLMeta-Model
TExt TTLTranslation
ExtensionImpl
InstanceOf InstanceOf
Extends
Executed by
Source TargetInstanceOf
Input Output
Extended syntax is transformed to the initial syntax:
Sheet 17Symposium How Adaptable is MDA May 20, 2005 Enschede
Conclusions
Examples of applicability of MDA techniques: Composition of XML languages; Abstract syntax extension;
Open Questions: Are model transformations suitable for defining semantic
mappings? For which type of languages? Scalability in case of language composition? Comparison to other techniques (attribute grammars,
action semantics,…)