The article describes the main preconditions and stages of development of open VivaCore library intended for code analysis and creation of metaprogramming systems. VivaCore project is a development of OpenC++ library in which support of C and C++ language peculiarities specific for Visual Studio 2005/2008 is implemented.
This article is intended for software developers who use or plan to use VivaCore library in their developments. The article touches upon the history of creating VivaCore library and relating peculiarities of the library's implementation.
VivaCore library is a project with open program code built on the basis of an older library OpenC++ (OpenCxx). VivaCore library is implemented in C++ and meant to be used in VisualStudio 2005/2008 environment.
VivaCore library was created and continues to develop thanks to OOO "Program Verification Systems". VivaCore code analysis library has a State Computer program certificate N 2008610480.
You can use VivaCore library free. The only license limitation concerning it is the necessity to mention that your project has been developed on the basis of OpenC++ library and its development VivaCore.
The library is used to develop projects in which analysis of source code of C and C++ programs is performed. Such an example is systems of language syntax extension, code editing and coloring systems, static analyzers, systems of building documentation on the code. To learn more about the library and possible ways to use it see article "The essence of the code analysis library VivaCore" .
Creation of VivaCore has never been planned purposely but it appeared in an absolutely natural way while working on Viva64 project. Viva64 product is a specialized tool for testing source code of C/C++ programs to establish if they are compatible with 64-bit platforms . Viva64 is a typical static code analyzer meant to help programmers while developing 64-bit applications.
Of course, an essential part of Viva64 project is the system of parsing source code of programs for further analysis. OpenC++ (OpenCxx) was used as a library for code parsing. On the initial stage of Viva64 product's development its inner structure was as shown on Picture 1.
Picture 1. How we imagined Viva64 project's structure to look.
As seen from the picture there was the code of Viva64 project which used functionality of OpenC++ library inside it.
But it became clear already at early stages of implementation that OpenC++ library doesn't implement the whole necessary functionality, contains some disappointing errors and doesn't support fully key words used in Visual C++ compiler. This was the stimulus to develop new functionality and improve OpenC++ library.
Let's give some examples of improvements. C language support was implemented (OpenC++ works only with C++ code) as well as calculation of values of literal constants. Specific key words __noop, __if_exists, __ptr32 became supported too. And so on.
As the result of these changes, large code has been written which related to a code analysis library in its meaning, but it was implemented in Viva64's code. Because of it Viva64's architecture looked as shown on Picture 2.
Picture 2. Implementation of functionality relating to C/C++ code parsing in Viva64.
It became evident that some functionality relating to code parsing should be enclosed into a separate module. Thus VivaCore library appeared. Although its code was still inside Viva64 project, it was separated logically. Viva64's structure became as shown on Picture 3.
Picture 3. A decision is made to enclose functionality relating to C/C++ code parsing into a separate library VivaCore.
The new architecture where code parsing functionality was enclosed into a separate subsystem VivaCore was convenient for us. But we decided to go further.
We decided to provide other developers with an opportunity to use new abilities implemented within the framework of VivaCore. It turned out to be too difficult a task to update OpenC++ library up to the necessary level. That's why we decided simply to make VivaCore library a separate project (Picture 4) and put it on OOO "Program Verification Systems" site. You can download source code of VivaCore library here.
Picture 4. Viva64's new structure.
Now VivaCore library can be used not only within the framework of OOO "Program Verification Systems" projects such as Viva64, VivaMP, but in projects of third-party developers as well (Picture 5).
Picture 5. Open library VivaCore for developing projects dealing with source C/C++ code.
Besides VivaCore library itself developers can download a demo program VivaVisualCode . It shows some abilities of VivaCore library by an example of graphic representation of a parse tree. An example of such a tree is shown on Picture 6.
Picture 6. Parse tree for expression "const bool is64bitInt = sizeof(int) == 8;".
As VivaCore library has been developed as part of Viva64 project it was reflected in some peculiarities of its implementation. These peculiarities are:
I hope this article will help you to decide whether you should use VivaCore library in your projects. If you are not sure - write. We'll try to provide you with additional information and answer your questions.