How VivaCore library appearedAuthor: Andrey KarpovDate: 10.08.2008AbstractThe article describes the main preconditions and...
Picture 1. How we imagined Viva64 projects structure to look.As seen from the picture there was the code of Viva64 project...
Picture 2. Implementation of functionality relating to C/C++ code parsing in Viva64.It became evident that some functional...
Picture 4. Viva64s new structure.Now VivaCore library can be used not only within the framework of OOO "Program Verificati...
Picture 5. Open library VivaCore for developing projects dealing with source C/C++ code.Besides VivaCore library itself de...
Picture 6. Parse tree for expression "const bool is64bitInt = sizeof(int) == 8;".Peculiarities of the library relating to ...
ConclusionI hope this article will help you to decide whether you should use VivaCore library in your projects. If youare ...
Upcoming SlideShare
Loading in...5
×

How VivaCore library appeared

149

Published on

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.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
149
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

How VivaCore library appeared

  1. 1. How VivaCore library appearedAuthor: Andrey KarpovDate: 10.08.2008AbstractThe article describes the main preconditions and stages of development of open VivaCore libraryintended for code analysis and creation of metaprogramming systems. VivaCore project is adevelopment of OpenC++ library in which support of C and C++ language peculiarities specific for VisualStudio 2005/2008 is implemented.IntroductionThis article is intended for software developers who use or plan to use VivaCore library in theirdevelopments. The article touches upon the history of creating VivaCore library and relating peculiaritiesof the librarys 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/2008environment.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 mentionthat 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 isperformed. 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 andpossible ways to use it see article "The essence of the code analysis library VivaCore" [1].VivaCore library as part of Viva64 productCreation of VivaCore has never been planned purposely but it appeared in an absolutely natural waywhile 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 [2]. Viva64 is a typical static codeanalyzer 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 forfurther analysis. OpenC++ (OpenCxx) was used as a library for code parsing. On the initial stage ofViva64 products development its inner structure was as shown on Picture 1.
  2. 2. Picture 1. How we imagined Viva64 projects 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 doesnt implementthe whole necessary functionality, contains some disappointing errors and doesnt support fully keywords used in Visual C++ compiler. This was the stimulus to develop new functionality and improveOpenC++ library.Lets give some examples of improvements. C language support was implemented (OpenC++ works onlywith 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 itsmeaning, but it was implemented in Viva64s code. Because of it Viva64s architecture looked as shownon Picture 2.
  3. 3. 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 separatemodule. Thus VivaCore library appeared. Although its code was still inside Viva64 project, it wasseparated logically. Viva64s 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 subsystemVivaCore was convenient for us. But we decided to go further.VivaCore librarys independent lifeWe decided to provide other developers with an opportunity to use new abilities implemented withinthe framework of VivaCore. It turned out to be too difficult a task to update OpenC++ library up to thenecessary level. Thats 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 VivaCorelibrary here: http://www.viva64.com/vivacore-library/download/.
  4. 4. Picture 4. Viva64s new structure.Now VivaCore library can be used not only within the framework of OOO "Program VerificationSystems" projects such as Viva64, VivaMP, but in projects of third-party developers as well (Picture 5).
  5. 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 [3]. It showssome abilities of VivaCore library by an example of graphic representation of a parse tree. An example ofsuch a tree is shown on Picture 6.
  6. 6. Picture 6. Parse tree for expression "const bool is64bitInt = sizeof(int) == 8;".Peculiarities of the library relating to the history of its developmentAs VivaCore library has been developed as part of Viva64 project it was reflected in some peculiarities ofits implementation. These peculiarities are: 1. Accurate diagnosis of syntax errors in program text was sacrificed to the ability of processing as much code as possible. In case of parsing of code with the purpose to perform its static analysis or some other processing (for example, coloring) it is more important to process as much text as possible ignoring errors met. To detect syntax errors a compiler is used. VivaCore library supposes that the code is correct. If it is not, it tries to ignore an incorrect section and starts parsing at the next correct construction. It is useful if the code is incomplete or contains new unknown key words or too complex constructions based on generic classes. However, nothing prevents the user from inserting corresponding processors of incorrect input data. 2. Garbage Collector mechanism is not implemented in OpenC++. VivaCore library has the same problem. As the result, while working VivaCore is constantly allocating memory without returning it. It is not critically for Viva64 analyzer because it is launched for each file separately. If a developer needs to work with the library for a long time, he will have to implement the missing functionality. 3. The library is optimized for working on 64-bit systems. 4. There is no integral documentation. However, it is absent in OpenC++ as well. Thats why developers must be ready to spend some time on mastering it. Contact us if you have any questions. Well try to help you. 5. The library contains some functions which dont take part in the very code parsing but are necessary for Viva64 and VivaMP projects.
  7. 7. ConclusionI hope this article will help you to decide whether you should use VivaCore library in your projects. If youare not sure - write. Well try to provide you with additional information and answer your questions.References 1. Andrey Karpov, Evgeniy Ryzhkov. The essence of the code analysis library VivaCore. http://www.viva64.com/art-2-2-449187005.html 2. Evgeniy Ryzhkov. Viva64: working up of 64-bit applications. 3. http://www.viva64.com/art-1-2-206176447.html 4. Andrey Karpov. Description of VivaVisualCode. http://www.viva64.com/art-2-2- 1281792295.html

×