Hi,
I think, now, I got a hang of it.
The existing reverse code is more messy than it needs to be IMHO. I am rewriting the code using a visitor pattern, similar to what has been done for the code generator. I tried refactoring but it seems to be harder than starting from scratch. However, I am a bit concerned that I might be missing something, and this something is what made the existing code messy.
Is the rewrite acceptable?
In the future I think it will be a good idea to integrate the code generator and the reverser. One advantage would be: updates to one would be easier to reflect on the other.
Awesome would be to declare (e.g., using a model) the "correspondence" between the two models and to automatically generate the code generator / reverser based on that. But then, this is not an easy problem. I am checking some papers on this.
My current test plan is:
(Having one or more test models.)
- Generate the code using the test models
- Reverse the generated code into a reverse model
- The reverse model should be equivalent (not necessarily equal, e.g., IDs may be different) to the test model.
The first stage of development could end when code coverage is 100% for the code generator and the reverser. This would try to show that all the features of the code generator are supported by the reverser (at least).
In a second stage, we would add to the reverser support for code which doesn't follow the code generator patterns but which can be found in the wild. The test plan could be: pick several C/C++ applications or libraries; reverse; code generate; compile and run their test suites; if all is ok I think we are good to go.
NOTE: I am currently focused on reverse but not roundtrip. My plan is to rewrite the reverse first and then tackle roundtrip. I hope that with a new reverse architecture, roundtrip will be "easier" and the code can be kept clean.
Seen this, can you see this being integrated?
Is there something missing?
I also would like to know: How strict is the Cpp profile? Can it be changed? (IMHO, there are some things that could be added or changed.)
Thanks in advance.
Happy new year!
Best regards,
Adriano Carvalho