To get a trial key
fill out the form below
Team License (standard version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Request our prices
New License
License Renewal
--Select currency--
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Message submitted.

Your message has been sent. We will email you at

If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

Description of VivaVisualCode

Description of VivaVisualCode

July 2, 2008

This article concerns the program VivaVisualCode, showing how to use VivaCore library. VivaVisualCode represents in a graphic form the parse tree of the input source code in C++.


Many libraries have a great disadvantage of absence of examples allowing you to consider the results of their work in a simple visual form. It is usual in the sphere of analysis and processing of programs' source code. Demo examples are made as programs accepting through the command line files' names, a lot of keys and generating other files at output. This user-unfriendly interface causes negative attitude to the library while using it for the first time, no matter whether the library is suitable for the task being solved.

We tried to use an approach that would allow the user to understand what he deals with as quickly as possible. Developing a program demonstrating the abilities of VivaCore library we decided to make it as a graphic application building a parse tree on the input C++ code. As the result a demo program VivaVisualCode appeared which you may download. You may download both source texts (Visual Studio 2005 project) and the executable module.

What is VivaCore

VivaCore is an open library for working with C and C++ code. The library is intended for implementing on its basis systems of code refactoring, static and dynamic analysis, code transformation or optimization systems, language extensions, subsystems of syntax highlighting, systems of building documentation on the code and other similar tools.

As a starting point for creation of VivaCore library another open library OpenC++ was taken:

To learn more about VivaCore library you may read the article "The essence of the code analysis library VivaCore" here:

License on VivaCore library allows you to use, copy and distribute it both in binary form and as source code both for commercial and non-commercial use without any payments to the authors of the library. You are only to mention the authors of the source libraries (OpenC++ and VivaCore).

You may download VivaCore library.

What is VivaVisualCore?

VivaVisualCode is a program demonstrating in a visual form the abilities of VivaCode library in building of parse trees for C++ code. VivaVisualCode implements graphic representation of a parse tree on the screen (see figure 1).


Figure 1. An example of a parse tree for code "float Value = 10.0 * 20.0;" built by VivaVisualCode.

The Parse Tree being created differs from the Abstract Syntax Tree (AST) in that it contains nodes for those syntax rules which don't influence the program's semantics. A typical example of such nodes is grouping parentheses while grouping of operands in AST is defined explicitly by the tree structure.

Implementation of VivaVisualCode

The demo program VivaVisualCode is very simple. One can say that it provides the user interface to some functions of VivaCore library. For example, it allows you to type the text of a program to be parsed, to represent the built parse tree in a graphic form, to get additional information about the tree's nodes.

You may consider the details of its implementation in the source code of VivaVisualCode itself. The source code is open and you may modify and use it for your own purposes free.

User interface

Let's briefly consider the menu-items in VivaVisualCode application:

  • File -> Open i-file... - allows you to load a preprocessed i-file. Note: The program serves for demonstration purposes and is not intended for working with large files.
  • File -> Export Image - allows you to export the built parse tree into BMP file.
  • File -> Exit - to exit the program.
  • Code -> Edit Code - editing of input C++ code.
  • View -> List Mode. In VivaCore library the data are represented as binary trees. But logically the work is carried out over the lists. As the result there are auxiliary nodes implementing the lists on the basis of the tree. This menu item allows you to hide or show these auxiliary nodes.
  • View -> Close All - to minimize all the nodes
  • View -> Open All - to extend all the nodes.

After the program is loaded through "File->Open i-file..." or "Code->Edit Code" the parse tree will be shown on the screen. The nodes of the tree are colored differently depending on its type. Terminal nodes (leaves) show information about lexemes they represent. Terminal blocks are colored pink for lexemes which are C++ key words. Otherwise they are colored green to show that the lexemes are final leaves. The nodes of the high level contain names and number of branches.

You can also:

  • Scroll the window when the tree doesn't fit into the screen.
  • Minimize and extend the nodes (left mouse button).
  • Scale the image (Ctrl + mouse scroll wheel).
  • You can get additional information concerning each node by clicking the right mouse button on it (see figure 2).

Figure 2. View of encoded type for declaration of the class constructor.


Of course, the program we offer you is not sufficient to demonstrate all the abilities of VivaCore library and to show its potential scopes of use. But we hope that it will help you to master main work principles of VivaCore library.

We are always ready to communicate. Write us!

Popular related articles
The Evil within the Comparison Functions

Date: 05.19.2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
PVS-Studio for Java

Date: 01.17.2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…
The way static analyzers fight against false positives, and why they do it

Date: 03.20.2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
Free PVS-Studio for those who develops open source projects

Date: 12.22.2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
PVS-Studio ROI

Date: 01.30.2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: 11.21.2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: 07.31.2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
Static analysis as part of the development process in Unreal Engine

Date: 06.27.2017

Author: Andrey Karpov

Unreal Engine continues to develop as new code is added and previously written code is changed. What is the inevitable consequence of ongoing development in a project? The emergence of new bugs in th…
Appreciate Static Code Analysis!

Date: 10.16.2017

Author: Andrey Karpov

I am really astonished by the capabilities of static code analysis even though I am one of the developers of PVS-Studio analyzer myself. The tool surprised me the other day as it turned out to be sma…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: 10.22.2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…

Comments (0)

Next comments

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →