How To Install gocc on Debian 12

Learn how to install gocc on Debian 12 with this tutorial. gocc is Go lexer and parser generator

Introduction

In this tutorial we learn how to install gocc on Debian 12.

What is gocc

gocc is:

Gocc generates lexer-parser pairs or stand-alone DFAs or parsers from a Backus-Naur form (BNF). The generated lexers are deterministic finite automata (DFAs), recognising regular languages. The generated parsers are pushdown automata (PDAs), recognising LR(1) languages. Optional LR(1) conflict handling automatically resolves shift/reduce and reduce/reduce conflicts.

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

Install gocc Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install gocc

Install gocc Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install gocc

Install gocc 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 Debian. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install gocc

How To Uninstall gocc on Debian 12

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

sudo apt-get remove gocc

Uninstall gocc And Its Dependencies

To uninstall gocc and its dependencies that are no longer needed by Debian 12, we can use the command below:

sudo apt-get -y autoremove gocc

Remove gocc Configurations and Data

To remove gocc configuration and data from Debian 12 we can use the following command:

sudo apt-get -y purge gocc

Remove gocc configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge gocc

Dependencies

gocc have the following dependencies:

References

Summary

In this tutorial we learn how to install gocc package on Debian 12 using different package management tools: apt, apt-get and aptitude.