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:
/*REMOVE_BEGIN*/ package org.argouml.language.cpp.reveng; /*REMOVE_END*/
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.PluggableImportinterface. 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:
- 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.
- 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.
- Send a working vanilla version of the grammar to the ANTLR list and announce its use within the ArgoUML project.
- 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.
- 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.
- Close the circle, by making the module support reveng of preprocessed C++ files.
- Enjoy and celebrate the achievement! Go back to planning next steps.