How To Install bisonc++ on Ubuntu 20.04

In this tutorial we learn how to install bisonc++ on Ubuntu 20.04. bisonc++ is Bison-style parser generator for C++

Introduction

In this tutorial we learn how to install bisonc++ on Ubuntu 20.04.

What is bisonc++

bisonc++ is:

Bisonc++ was designed after `bison++’, created by Alain Coetmeur. Bisonc++ adds to bison++ a cleaner class-design, using a base-class to communicate lexical tokens to a lexical scanner.

Since bisonc++ generates the parser class as well as the parsing function. The class can easily be provided with additional members without needing polymorphic functions. Consequently, classes generated by bisonc++ have no virtual members and actually have but one public member: parse(), replacing the old-style bison and bison++ yyparse() function.

Bisonc++ offers many options, among which an option to define classes generated by bisonc++ in a separate namespace. This allows developers to define additional symbols, even outside of the class generated by bisonc++, without encountering name-collision problems. With bisonc++, artificial means to prevent name-collisions, like bison and bison++’s yy-convention are not required anymore when using bisonc++. Bisonc++ merely generates C++ code. If C code is required, bison should be used. Bisonc++’s grammar requirements are highly compatible with bison’s requirements, so converting a bison grammar into a bisonc++ grammar should be fairly simple.

In addition to the bisonc++ parser generator itself and several skeleton files, the package contains an extensive man-page, a full manual rewritten after the original bison manual, and several examples.

Some history: Bisonc++ versions 0.98 is a complete rewrite of an LALR(1) parser generator, as described in Aho, Sethi and Ullman’s (1986) book Compilers' (a.k.a. the Dragon Book’). Version 0.98 was completed in May 2005. Another major rewrite was completed one year later, May 2006, resulting in version 1.00.

There are three methods to install bisonc++ on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install bisonc++ Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install bisonc++ using apt-get by running the following command:

sudo apt-get -y install bisonc++

Install bisonc++ Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install bisonc++ using apt by running the following command:

sudo apt -y install bisonc++

Install bisonc++ Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install bisonc++ using aptitude by running the following command:

sudo aptitude -y install bisonc++

How To Uninstall bisonc++ on Ubuntu 20.04

To uninstall only the bisonc++ package we can use the following command:

sudo apt-get remove bisonc++

Uninstall bisonc++ And Its Dependencies

To uninstall bisonc++ and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove bisonc++

Remove bisonc++ Configurations and Data

To remove bisonc++ configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge bisonc++

Remove bisonc++ configuration, data, and all of its dependencies

We can use the following command to remove bisonc++ configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge bisonc++

References

Summary

In this tutorial we learn how to install bisonc++ package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.