SV: [gme-users] Transforming models into source code (e.g. C)

Attila Vizhanyo viza at isis.vanderbilt.edu
Wed Feb 1 10:41:07 CST 2006


>
> I have installed GReAT and looked into the samples included in the 
> distribution. It is difficult for me to see the big picture of how to 
> construct and separate the transformation rules in the right way 
> (where should I start). I will try to run the samples in the GReAT 
> debugger.

Please have a look at our tutorial to get started 
(GReAT\doc\Step-by-step GReAT Guide.pdf)

>  
> I have read your paper (Model-Driven Software Development of 
> Model-Driven Tools: A Visually-Specified Code Generator for 
> Simulink/Stateflow), that describes how a SF model is transformed into 
> source code, this is actually what I am looking for.
>  
> From the paper I understand that the source code is generated 
> directly using GReAT, could you describe the workflow of the tool 
> implemented in GReAT? how you generate source code directly, if I 
> understand the paper correctly.

The catch is that we created a metamodel for a stylized subset of C, 
called SFC. During the transformation, various SFC model objects are 
created upon finding various patterns of objects in the input StateFlow 
model. The GReAT code generator creates C++ code out of the GReAT 
transformation; this code is embedded into a Visual Studio C++ project, 
that contains (aside from the generated transformation code) a very 
straigtforward printer module, that traverses the SFC model, and prints 
out C code into a text file.

>  
> From looking at the interpreter and GReAT approach, I think that 
> building an interpreter is the fastest approach right now. But I 
> expect the source model to be extended through the development, so 
> GReAT would probably be the right solution for us in the end. What you 
> said in your recommendations.

As I said, if you need to write a simple transformation only, BON 
interpreters suffice.
If you plan to extend the metamodels, or add complexity to the 
transformation, then going with GReAT will certainly help you to manage 
and maintain the transformation.

HTH,
Attila



More information about the gme-users mailing list