You are on page 1of 11

Problem definition

• Input: SCXML statechart model


• Output:
– C++ switch structure
– ADA switch structure
– …any other language
• How to generate code from the input model?
– Many solutions
• One solution:
– Create a model to text transformation for each
language
• Too complicated if we have to deal with big
transformations for many languages
• Our solution:
– Apply transformation refinements
Our solution

• Create a base transformation with the common


rules
• Create a delta transformation for each
language with its specific elements
• Generate a transformation adding the delta
transformation to the base transfomation:
– TScXml2Cpp = Tbase • ΔTC++
– TScXml2Ada = Tbase • ΔTAda
Example
• Input model:
Example
• C++ code: • Ada code:
Example

• Base Transformation
– The code structure for both languages is the same
• We can use the same rules
– They differ in the syntax
– We create a base transformation with the common
rules to create a switch structure
Example
• Base T (base_T.m2t):
Example

• ΔT
– We use a ΔT for each language to introduce
specific elements for that language
– We specify the rules in the Base T that need to be
rewritten to generate specific language output
– We can introduce new rules. E.g. writeBreak() in
ΔTC++ (break; is not necessary in Ada)
Example
• ΔTC++
Example
• ΔTAda
Example

• Goal:
– ScXml2Cpp.m2t
– ScXml2Ada.m2t

How?

You might also like