Use intermediate models [message #468671] |
Fri, 25 July 2008 13:46  |
Eclipse User |
|
|
|
Hi
If, rather than transforming direct from Java to C-sharp, you
transform in multiple stages
JavaText->JavaModel->GenericObjectOrientedModel->C-sharpModel- >C-sharpText
there will be more opportunities for re-use:
e.g.
GenericObjectOrientedModel->C++Model->C++Text
GenericObjectOrientedModel->CModel->CText
and of course
GenericObjectOrientedModel->JavaModel->JavaText
C-sharpText->C-sharpModel->->GenericObjectOrientedModel
Regards
Ed Willink
|
|
|
|
Re: Use intermediate models [message #468688 is a reply to message #468677] |
Sun, 03 August 2008 08:59   |
Eclipse User |
|
|
|
Originally posted by: jose.chillan_eclipse.polytechnique.org
Hi,
I think for my part that the pivot model is key for an efficient and
flexible resolution of the conversion.
Although I think the actual implementation is great and provide very good
value, I think I need this pivot model that is not the Java AST, neither
the
C# AST, but rather something out of the languages : a description of the
business and algorithms implemented.
I my view, the Java and C# source code are just "projections" of
this "knowledge" in different languages, and this allow to implement
several
other projections in the future when needed.
As an exemple, a toString() method in Java has to be renamed "ToString()"
in
C#. But I would represent it as a "method that gives a string
representation
of the object" for which we have additional attribute that are the Java
name (toString) and C# name (ToString), and that could be enriched with
information
upon needs.
In addition, I want to be able to recognize code patterns in the code
differents than those necessary to the refactoring in order to apply other
types of transformations in the code for a special purpose conversion,
directly
on the "pivot AST".
One way to achieve this without too much work would be to enrich the Java
code
during the transformation with special comments generated after each phase
that would represent the "pivot AST" serialization. This would allow the
actual refactoring process as comments are kept during most refactor
operations and thus, at any point of the process,it would be possible to
add
custom transformation in addition.
Last, the final source code generation would be performed on the pivot AST
basis.
Jose
|
|
|
Re: Use intermediate models [message #468701 is a reply to message #468688] |
Mon, 04 August 2008 04:29  |
Eclipse User |
|
|
|
Hello Jose,
Thanks for your support and ideas.
As you propose in order to have a "Java to OtherLanguage translation
tools" the common/pivot model is the key. The first part of the
translation do a similar job (but with less information that your
describe).
We need to look your ideas and the academic side too (in order to not
re-inventing the wheel :-)).
I also like to have a transformation language much more powerful than the
current. For example I want to express that new MyClass(new OtherClass())
have a different mapping than new MyClass() [really useful for IO mappings
...] which is not possible right now.
@lex
|
|
|
Re: Use intermediate models [message #565002 is a reply to message #468671] |
Sat, 26 July 2008 13:29  |
Eclipse User |
|
|
|
Hello,
> If, rather than transforming direct from Java to C-sharp, you
> transform in multiple stages
> JavaText->JavaModel->GenericObjectOrientedModel->C-sharpModel- >C-sharpText
Is more or less what the translator already does.
I start with a java buffer and I slowly transform it into a java
compatible generic object oriented buffer (no nested class, ...). Then I
start hardest modifications (not java compatible) to obtain a c-sharp
buffer.
I always use the JDT model to build the AST, I do not have any
intermediate model (but I agree with you it could be an option).
Thanks.
Alexandre.
|
|
|
Re: Use intermediate models [message #565093 is a reply to message #468677] |
Sun, 03 August 2008 08:59  |
Eclipse User |
|
|
|
Originally posted by: jose.chillan_eclipse.polytechnique.org
Hi,
I think for my part that the pivot model is key for an efficient and
flexible resolution of the conversion.
Although I think the actual implementation is great and provide very good
value, I think I need this pivot model that is not the Java AST, neither
the
C# AST, but rather something out of the languages : a description of the
business and algorithms implemented.
I my view, the Java and C# source code are just "projections" of
this "knowledge" in different languages, and this allow to implement
several
other projections in the future when needed.
As an exemple, a toString() method in Java has to be renamed "ToString()"
in
C#. But I would represent it as a "method that gives a string
representation
of the object" for which we have additional attribute that are the Java
name (toString) and C# name (ToString), and that could be enriched with
information
upon needs.
In addition, I want to be able to recognize code patterns in the code
differents than those necessary to the refactoring in order to apply other
types of transformations in the code for a special purpose conversion,
directly
on the "pivot AST".
One way to achieve this without too much work would be to enrich the Java
code
during the transformation with special comments generated after each phase
that would represent the "pivot AST" serialization. This would allow the
actual refactoring process as comments are kept during most refactor
operations and thus, at any point of the process,it would be possible to
add
custom transformation in addition.
Last, the final source code generation would be performed on the pivot AST
basis.
Jose
|
|
|
Re: Use intermediate models [message #565134 is a reply to message #468688] |
Mon, 04 August 2008 04:29  |
Eclipse User |
|
|
|
Hello Jose,
Thanks for your support and ideas.
As you propose in order to have a "Java to OtherLanguage translation
tools" the common/pivot model is the key. The first part of the
translation do a similar job (but with less information that your
describe).
We need to look your ideas and the academic side too (in order to not
re-inventing the wheel :-)).
I also like to have a transformation language much more powerful than the
current. For example I want to express that new MyClass(new OtherClass())
have a different mapping than new MyClass() [really useful for IO mappings
...] which is not possible right now.
@lex
|
|
|
Powered by
FUDForum. Page generated in 0.38417 seconds