As an ArgoUML contributor I'm going to blog my activities here, so that they may draw interest by other developers or help other developers when doing tasks similar to what I've done. AND(!) the grand vision that makes an Argonaut what he is, TO THRIVE IN THE BIG DANGEROUS WORLD, TAKING THE Argo TO A GOOD SHORE ;-))

Thursday, February 24, 2005

C++ reveng drop 1 replanning

The grammar has problems. To be able to debug it I need to build ANTLR for debugging. How will I do this? Well, it isn't obvious from the docs...

One thing is obvious, this wrecked my initial plan... Now I must re-plan taking this new challenge into account.

2nd plan for C++ reveng drop 1

  1. Learn how to make the ANTLR parser for debugging and build one. – Estimated Effort (EE) 4 Mh; Short Name (SN) ANTLR parser 4 debugging
  2. Debug the C++ grammar and make it pass the tests. – EE 20 Mh; SN Fix the C++ grammar
  3. Commit the result of this work and send it to Yolanda. Update the issue. – EE 3 Mh; SN Commit, Yolanda and issue
  4. Send a working vanilla version of the grammar to the ANTLR list and announce its use within the ArgoUML project. Provide feedback as appropriate. Automate the adaption of the files in the module build script. – EE 5 Mh; SN Send grammar 2 ANTLR list
  5. Update the model to reflect the new package and the grammar use and design a bit on the C++ reveng module. Generate the realization of the designed classes. – EE 8 Mh; SN Module model update and realization of interface
  6. Close the circle, by making the module support reveng of preprocessed C++ files. – EE 5 Mh; SN Finish module support of reveng
  7. Enjoy and celebrate the achievement! Go back to planning next steps. – EE 4 Mh; SN Plan next steps

The drop 1 plan is now inserted into Process Dashboard, as a sub-task of the issue work.

Wednesday, February 23, 2005

C++ grammar for java programs and new contributor


The grammar has problems... It doesn't work and therefore I must try to fix it... For this the ANTLR supports some debug mode, which requires a debug jar, which the one included in ArgoUML isn't...


I'm currently moving forward the implementation, even before plain testing of the grammar! The build is already changed to include generation of the parser. Now I must make a unit test for the grammar to parse the basic pre-processed files that come with the ANTLR C++ grammar.


Started working in the grammar integration within the module. Instead of going first to proving that the grammar works, I'm simply doing first the grammar integration within the build system and I'll make a test case class just for the grammar to prove it works. This way, even these simple tests that were made for proving the working of the grammar will be reused.

To enable possible reuse of the grammar to be distributed to the ANTLR users list I've included in the files a special pair of tags surrounding parts that will need to be removed when the grammar is delivered. These are:

package org.argouml.language.cpp.reveng;

There was some activity both in the users and in the developers lists in the last days. First Linus questioned me if I would like to make the C++ module into a sub-project. I declined because it is just too small and too non-functional to have such difference from the other language modules. It would make me loose focus from putting reveng to work.


ArgoUML C++ module is going forward. Daniele Tamino is working with C++ generation and he already fixed a lot of problems. Even some which I didn't knew about.

Now some very good news: Yolanda sent me the ported C++ grammar for java output! I'm now going to try it out... Ok, it works fine with ANTLR 2.7.2, which is the version in use in ArgoUML.

Now I must plan the next steps for reveng work...

  • Develop the grammar to be usable both for ArgoUML and for other ANTLR users. This poses several alternatives:
    • 1. Start working in a stand-alone version of the grammar supposed to be reused within ArgoUML, but, which focus is to have parsing work done in stand-alone programs. This grammar would then be an option for ANTLR general users.
    • 2. Go directly to ArgoUML focused use. Just make simple tests to check that the grammar actually works and go!
    • 3. Go directly to ArgoUML focused use, but, consider one of the requirements for it to be usable outside of ArgoUML context.

    Either option first step is to prove the grammar actually works. This is therefore the first thing to do, to feed some files to the parser and watch it do its magic!

  • The grammar works with preprocessed files. Therefore I must somehow circumvent this problem without causing users to always do manual work of making intermediate versions of the files, which then are processed by ArgoUML. To fix this, it would be helpfully to have on-the-fly preprocessing of the source files. So, a java powered C preprocessor is the tool that would fix this problem.

    The preprocessor, on its side, must know from where to include files. This information is found in makefiles, which, from a user's perspective should also be processed by the tool. So, I must take some decision here. My first thought is to create reveng module for makefiles, which at least extracts the include information. It would have to be modular since you have many different options for makefile formats. Firstly it must support the plain make compatible files.

  • I still miss another important part of the module. Its infrastructure, being the actual implementation of the org.argouml.application.api.PluggableImport interface. This is also a nice place to start with, and it will provide early visibility of the C++ reveng future promises. Also, I would start early to think on how it would adapt to the above preprocessing and makefile specific C++ requirements. It is also something that would provide two places where work may occur concurrently.

So, a nice plan would be:

  1. Prove that the grammar works, by making it parse the example provided with the C++ grammar that exists in the ANTLR site, and with some simple generated files by ArgoUML.
  2. Checkin the result of this work and send it to Yolanda, thanking, and asking if she desires to put some info about her or her company in the files.
  3. Send a working vanilla version of the grammar to the ANTLR list and announce its use within the ArgoUML project.
  4. Make the needed changes to the files and put the grammar into the appropriate package, i.e., org.argouml.language.cpp.reveng. Make the ant script changes for the parser to be generated automatically before compilation and add some tests that prove the grammar works for some simple examples.
  5. Update the model to reflect the new package and the grammar use and design a bit on the C++ reveng module. Generate the realization of the designed classes.
  6. Close the circle, by making the module support reveng of preprocessed C++ files.
  7. Enjoy and celebrate the achievement! Go back to planning next steps.


Daniele Tamino is helping me with the C++ module. He reported several issues today: 3055, 3056, 3057 and 3060.

Tuesday, February 01, 2005

Analysis of the solution - continued

Looking for an ANTLR C++ grammar for java output

As previously referred, in the ANTLR site there exists a grammar for C++, but, it is for C++ output, so, it isn't directly usable in Java programs. As always when I don't get exactly what I want, I googled a bit on this and found a question by Yolanda Jargudo in the ANTLR interest list about this. Well I contacted her and she had no luck [ :-( ], so, she made a version for java output and now, she will give it to me (I think) so that I won't need to make this work again [ :-)) ].

Different alternative for C++ parsing and more!

While I'm waiting for the grammar, I realized that there could be alternate paths for C++ parsing. There are several environments where this is needed also, like in IDEs that support C++. So I looked at the Eclipse CDT project and to the NetBeans cpplite project. cpplite development stopped and what exists supports very basic syntax highlighting, so, it isn't attractive. The CDT is active and it seams to be very well supported, with persons from IBM and QNX actively working on it.

Within CDT, the CDTCore contains almost every thing I could think off, in the functionality needed for the ArgoUML C++ module reverse engineering. Even better, it could be a new different way to look into how to solve many of the problems of the C++ module, since this project contains things such as refactoring support, makefile generation and import, multi-platform support, etc!

Andrew Birkett's parsing C++ notes

I found this resource on parsing C++ by Andrew Birkett.

ArgoUML and AndroMDA grand vision

I have a vision and in that vision ArgoUML will support full C++ round-trip engineering (RTE). In that vision you'll feed a makefile for a C++ application and you'll get a nice model in ArgoUML, with code docs included. It will be possible for you to modify the model make some nice refactoring and even add some classes for the realization of a new use case and them, with RTE you'll have the C++ application updated, with only the deep details of algorithms to be filled. - These will be marked as TODOs, though! It will also support generation of unit tests, based on the CppUnit framework.

ArgoUML will support out-of-the-box generation of simple applications, like an "Hello World!" example. You only need to setup the C++ compiler path in your particular application and it will create even simple makefiles.

Some well known C++ libraries and frameworks will have models (TAO, ACE, Qt, boost, GTK, WxWindows, etc), being these created by reverse engineering them with the C++ module. Of course STL and std library through STLPort will be available for modeling also. These models will be given hiding the details of the frameworks, in order for the users to not get annoyed with their weight and also internal details. Full models are of interest only to the respective projects.

ArgoUML will support aspect oriented programming (AOP). It will do it in a way that is independent of the respective implementation. The C++ module will be capable of generating AspectC++ code from models with aspects.

Python and C++ will integrate nicely and mixed applications will be supported with the – to be created – python module. The needed bridging will be done by boost::python library. It will be possible to make the model and using a given C++ and python profile, to generate the application from the model.

AndroMDA will sport transformations between platform independent models (PIMs) and platform specific models (PSMs). Included is the opposite possibility, of reversing entire PSMs (e.g., the ArgoUML model that was reversed using ArgoUML java reveng) to PIMs. This might not be out-of-the-box, but, it will be possible, by supporting the required transformations. It will also support merging of models like explained in AOP and MDA, metamodel mapping transformations, etc. Common open source frameworks will have already defined mappings and transformations, being possible to generate either for CCM, for COM+ or for Web Services implementations.

ArgoUML and AndroMDA will be integrated to support model navigation in ArgoUML between related models, like PIMs and PSMs. ArgoUML must also be capable of saving links to outer resources, like recorded project meetings where a particular discussion toke place and where part of the architecture was established.

Reader Shared items