[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [m2t-dev] [MTL] discussion about the specification
|
Hello all
My name is Tor Neple, and I was part of the SINTEF team
working with Arjan and Wim on the OMG spec.
With regard to
the delimiters of the protected code, and forgive me if I am misunderstanding
the point of the question totally; The idea was that we wanted
to support protected blocks in any target syntax, meaning that
we could not define what delimiter to use as part of the standard. One
approach could be that the delimiter for the protected area is stored in each
transformation description/template. This would aid in interoperability. I guess
this would have to be placed in the metamodel also.
If I am not
totally misunderstanding this; always using "//" would make it impossble to
generate correct code for for instance Visual Basic where the tag for a comment
is '.
Regards
Topr
- The delimiters of the protected
area are not defined in the standard, they don't want to make a choice
So, We have to choose the way
to keep the user code...
We can use tags like : //Start
of user code //End of user code
I would like to dicuss about
the different points of views?
I
think leaving the delimiters to the implementation is an error in the spec,
because it will lead to interoperability problems. Note that the id of the text
parts should be unique (see example 3).
--------------------------------------
On Mon, May 26, 2008 at 3:02 PM, Jonathan MUSSET <
jonathan.musset@xxxxxxx> wrote:
Hi everybody
We've got a first version of the MTL parser
on the CVS
It means that we can create an abstract representation of the
templates. The AST is based on an EMF metamodel.
Here is an example of a
MTL template (for those who don't know the MTL syntax) :
[module
mymodule(http://www.eclipse.org/uml2/2.1.0/UML)/]
[template
public classToJava(a:Property, c:Class)]
[if (1 = (1 +
c.ownedAttribute->size() + a->type->size() +
c->size()))]
[if
(c.attribute->size())]
aaa
[elseif (a->type.name)]
bbb
[else]
ccc
[/if]
[/if]
[for (p :
Operation | c ->ownedOperation.type)]
ddd[p.name/]
[/for]
[/template]
The metamodel is also based on the OCL metamodel of
the MDT project.
According to the Model-To-Text specification, We have to
use the classes ocl.OCLExpression and ocl.Variable...
Now, Laurent is
working more actively on the generation engine.
The architecture of this
standalone engine will probably be a combination of this MTL AST, the m2t
backend, and the MDT-OCL execution environnement...
We had a lot of
problems with the specification...
Arjan and Me have worked a long time on
the ambiguities of the specification.
Arjan, Do you have any feedbacks from
the OMG guys?
I would like to dicuss more about these ambiguities with
those who know the specification...
I think that this mailing list is a
good place to make choice for the eclipse implementation of this
specification
Don't hesitate to share your experiences and your point of
view
Here are some examples of ambiguities that We have detected :
-
When an invocation creates an empty line :
Does it mean that we have
to generate "\n" or ""?
- For the abstract syntax, there are a lot of
namings and multiplicities issues : "arguments" mustn't end with 's'
- Can
we use MANIFEST.MF files to declare dependencies between generation
modules?
I would like to use the eclipse mecanism for dependencies
but it is not compatible with the specification
- There is a confusion for
the "escape" character, the specification defines a way to change the
delimiters using an annotation (@delimiter=)
but sometimes I would
like to use a simple escape character like in java ('\'), more usefull and
readable
For example, I want to generate : String[] tab =
"";
I think that the following template is quite simple to write :
String\[] tab [subTemplate/];
- The delimiters of the protected area are
not defined in the standard, they don't want to make a choice
So, We
have to choose the way to keep the user code...
We can use tags like
: //Start of user code //End of user code
I would like to
dicuss about the different points of views?
- TemplateInvocation : The
specification is ambiguous if the result is not a string... Is it an error? Do
We have to call the toString by default?
- String libraries are different
between the QVT and the MTL specifications : for example firstUpper() !=
upperFirst()
The priority for us is to be as near as possible of the
QVT library
- Module.import reference is missing in the metamodel... We
decided to create an import link in the metamodel...
- We need the position
of the template element during the generation (for the debugger)
So,
We defined a new element to store the position information
I'll be
really happy to have more points of view ;-)
Thank you
Cheers,
Jonathan
_______________________________________________
m2t-dev
mailing list
m2t-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2t-dev