How To Install re2c on Ubuntu 18.04

In this tutorial we learn how to install re2c on Ubuntu 18.04. re2c is tool for generating fast C-based recognizers

Introduction

In this tutorial we learn how to install re2c on Ubuntu 18.04.

What is re2c

re2c is:

re2c is a great tool for writing fast and flexible lexers. Unlike other such tools, re2c concentrates solely on generating efficient code for matching regular expressions. Not only does this singleness make re2c more suitable for a wider variety of applications, it allows one to generate scanners which approach hand-crafted ones in terms of size and speed.

There are three methods to install re2c on Ubuntu 18.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 re2c Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install re2c

Install re2c Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install re2c

Install re2c 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 re2c using aptitude by running the following command:

sudo aptitude -y install re2c

How To Uninstall re2c on Ubuntu 18.04

To uninstall only the re2c package we can use the following command:

sudo apt-get remove re2c

Uninstall re2c And Its Dependencies

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

sudo apt-get -y autoremove re2c

Remove re2c Configurations and Data

To remove re2c configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge re2c

Remove re2c configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge re2c

References

Summary

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