Login | Register
My pages Projects Community openCollabNet

Discussions > modules-dev > Re: [argouml-modules-dev] Code generation

argouml
Discussion topic

Back to topic list

Re: [argouml-modules-dev] Code generation

Author Frank Raiser <frank dot raiser at uni-ulm dot de>
Full name Frank Raiser <frank dot raiser at uni-ulm dot de>
Date 2005-07-30 05:27:37 PDT
Message On Wed, Jul 27, 2005 at 11:42:21PM +0100, Luis Sergio Oliveira wrote:
> I'm interested in your interest in working with the java RTE modules.
> Java 5
> features support is one big must that we (ArgoUML) must do. One
> big thing for this is the support of parameterized classes in ArgoUML.
> After finishing
> some things in the C++ module I must tackle this
> (http://argouml.tigri​s.org/issues/show_bu​g.cgi?id=1446) for being used
> in the
> C++ module. It is reused without effort in the java module.
> Upgrading to ANTLR 2.7.5 and aligning the java grammar with the latest
> found in
> the ANTLR sharing zone is another. This is java specific.
>
> That said, this work, if it is done the way others did it isn't very
> interesting for
> a thesis. One thing that could be different is to make reverse
> engineering by
> AST (Abstract Syntax Tree) processing instead of callbacks from the
> parser. Much more decoupled and
> gets you more flexibility in handling the context. The context is
> something that
> could be taken care using AOP (Aspect Oriented Programming). This is a
> production
> use of AOP instead of the common trace, logging or simple debugging uses.

Ok. So let me get into some more details about what I had in mind.
For about the past 2 years I've been working on the SrcML library
( http://www.srcml.de ) which is - as a short summary - a library for
converting source code into a XML representation and it helps out on
writing programs to modify this code (or creating new code).
Of course it also provides a mean to recreate original source code from
the XML version (which if I understood you correctly would come close to
what a Notation is?)

However the interesting bit is that it should be possible to generate the
source code using SrcML without knowing too much about the target language.
SrcML is a language independent markup and the actual language is only relevant
when outputting or reading source code directly. I do have to point out though,
that this is more of an experiment, as right now it's still very java centric,
as we still lack other parsers.
So in my imagination the code generation looks like: instance.addClass("MyClass");
which would work for Java just as well as for other languages. The tricky part is
of course working with language elements the target doesn't support (like interfaces
and C++) in which case the idea behind SrcML is to have the ability of querying the
capabilities of your target language (something like language.hasInterfaces().)

One substantial difference to the existing RTE from what you described would
however be the loss of whitespace. Our XML representation is concentrating on
the semantics of source code as syntax is not influencing the program behavior
(unless of course you have a language like python where whitespace is significant.)
The actual source code produced looks different depending on the plugin chosen to
output it. The overall idea behind this is: store source code on semantic level,
but work with it in exactly the formatting you prefer. If someone else needs to
read your code it'll get reformatted to their preferred kind of syntax again.

I don't know what is involved in upgrading the java grammar for ArgoUML, but
for SrcML the switch from the 1.3 to 1.5 ANTLR grammar went rather painless.

> The above isn't certainly something really new, many people have done it...
> You may also play around with MDA concepts and development.
> In my blog I describe this idea of
> MDA specification and development of programming languages. It might be
> overkill
> as a diploma thesis, but, it is certainly something new! (See
> http://argonauts-lif​e.blogspot.com/index​.html#2005-05-04).
>
> Well, don't know if this line of discourse helps or confuses ;-))...
> Just take them as
> proposes of a person who wished to have more time to explore his crazy
> ideas and
> is trying to push them to a poor victim that was just inquiring about
> some module
> workings!

I'll check it out anyways, but I can't promise you that I'm going to
tackle these issues.. as you said.. there's so many ideas and so little
time :)

--
Raiser, Frank
Student @ University of Ulm (www.uni-ulm.de)

Thud. Thud. Thud. Splat.
        -- (Terry Pratchett & Neil Gaiman, Good Omens)

« Previous message in topic | 7 of 9 | Next message in topic »

Messages

Show all messages in topic

Code generation Frank Raiser <frank dot raiser at uni-ulm dot de> Frank Raiser <frank dot raiser at uni-ulm dot de> 2005-07-25 16:06:38 PDT
     Re: [argouml-modules-dev] Code generation Luis Sergio Oliveira <euluis at zmail dot pt> Luis Sergio Oliveira <euluis at zmail dot pt> 2005-07-26 15:34:17 PDT
         Re: [argouml-modules-dev] Code generation Frank Raiser <frank dot raiser at uni-ulm dot de> Frank Raiser <frank dot raiser at uni-ulm dot de> 2005-07-27 02:30:47 PDT
             RE: [argouml-modules-dev] Code generation linus Linus Tolke 2005-07-27 13:38:10 PDT
                 Re: [argouml-modules-dev] Code generation Frank Raiser <frank dot raiser at uni-ulm dot de> Frank Raiser <frank dot raiser at uni-ulm dot de> 2005-07-30 05:02:38 PDT
             Re: [argouml-modules-dev] Code generation Luis Sergio Oliveira <euluis at zmail dot pt> Luis Sergio Oliveira <euluis at zmail dot pt> 2005-07-27 15:42:21 PDT
                 Re: [argouml-modules-dev] Code generation Frank Raiser <frank dot raiser at uni-ulm dot de> Frank Raiser <frank dot raiser at uni-ulm dot de> 2005-07-30 05:27:37 PDT
     RE: [argouml-modules-dev] Code generation linus Linus Tolke 2005-07-26 21:46:48 PDT
         Re: [argouml-modules-dev] Code generation Frank Raiser <frank dot raiser at uni-ulm dot de> Frank Raiser <frank dot raiser at uni-ulm dot de> 2005-07-27 01:55:10 PDT
Messages per page: