How To Install peg-go on Ubuntu 18.04

In this tutorial we learn how to install peg-go on Ubuntu 18.04. peg-go is implementation of a Packrat parser generator in Go

Introduction

In this tutorial we learn how to install peg-go on Ubuntu 18.04.

What is peg-go

peg-go is:

Peg, Parsing Expression Grammar, is an implementation of a Packrat parser generator. A Packrat parser is a descent recursive parser capable of backtracking. The generated parser searches for the correct parsing of the input.

This is the main package used to generate code.

There are three methods to install peg-go 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 peg-go Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install peg-go

Install peg-go Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install peg-go

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

sudo aptitude -y install peg-go

How To Uninstall peg-go on Ubuntu 18.04

To uninstall only the peg-go package we can use the following command:

sudo apt-get remove peg-go

Uninstall peg-go And Its Dependencies

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

sudo apt-get -y autoremove peg-go

Remove peg-go Configurations and Data

To remove peg-go configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge peg-go

Remove peg-go configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge peg-go

References

Summary

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