Title: Implementing Language Extensions with Model Transformations
1Implementing Language Extensions with Model
Transformations Ivan Kurtev Software
Engineering Group University of Twente the
Netherlands
2Outline
- The Role of Languages in MDE
- Language Elements
- Language Extensions
- Examples
- Language composition
- Abstract syntax extension
- Conclusions
3Use of Languages in MDE
- Languages for expressing models
- Meta-modeling modeling of languages
- Transformation languages
Can we use MDE techniques to solve language
design problems?
4Language Elements
- 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 -gt D
5Language Extensions
- Syntax Extensions
- Extensible grammars
- Extensible parsers
- Macro definitions
- Semantic Extensions
- Modular attribute grammars
- Monads
- Action semantics
- Language Composition
- Involves syntax and semantic extensions
6Language 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 -gt D
7Language Elements in MDA Terms (2)
- 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
8Example 1 Composing XML Languages
- Application-specific XML processing
XMLDocument
DOM Parser
Processing Code
DOM Tree
Application Objects
Transformation
- 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
9Transformation Pattern for XML Processing
- Schema-less processing based on DOM
- Schema-based processing an XML schema and DOM
are available
10Structure of XML Applications
- Separation of concerns
- Syntax (schema)
- Processing logic (transformation specification)
- Application classes (semantic domain)
11Example (1)
- Processing of a subset of SMIL timing module
- Source schema
ltattribute namebegin typestring/gt ltattribute
nameend typestring/gt ltattribute namedur
typestring/gt ltattribute nametimeContainer
typestring/gt
- Example of a timed document
lta timeContainerseq begin1 dur20gt ltb
timeContainerpar dur10gt ltc
timeContainernone dur10/gt ltd
timeContainernone dur10/gt lt/bgt lte
timeContainernone dur10/gt lt/agt
SMIL Synchronized Multimedia Integration
Language
12Example (2)
- Target Application Classes
13Composition of XML Languages
- A new language may be composed with the timing
module
- New processor is obtained via
- Composing target application classes (software
composition) - Composing transformation definitions (based on
the transformation language constructs)
14Example 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
15Example 2 Implementation
- Extended syntax is transformed to the initial
syntax
16Sequential Composition of Extensions
17Conclusions
- 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,)