bnfc command not found

In this troubleshooting guide we learn how to fix bnfc command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

bnfc: command not found

or when using sudo you get the following error message

sudo: bnfc: command not found

Solutions to bnfc: command not found

How To Fix bnfc: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu bnfc is provided by bnfc package.

bnfc is:

The BNF Converter is a compiler construction tool that generates a compiler front-end and a readable syntax description document from a Labelled BNF grammar. It was originally written to generate Haskell, but it can now also be used for generating Java, C++, and C.

To process Haskell output, you need the Glorious Glasgow Haskell Compiler (virtual package ghc), the Happy parser generator (package happy) and the Alex scanner generator (package alex).

To process Java output, you need a Java compiler and virtual machine, the CUP parser generator (package cup) and the JLex scanner generator (package jlex).

To process C or C++ output, you need a C or C++ compiler, respectively, the Bison parser generator (package bison) and the flex scanner generator (package flex).

To process the generated documents, you need LaTeX (packages tetex-base, tetex-bin, etc.).

To fix this problem, we can install more using the command below.

sudo apt-get -y install bnfc

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install bnfc.

sudo apt -y install bnfc

Or if you have aptitude installed you can use the following command.

sudo aptitude install bnfc

Summary

In this tutorial we learn how to fix bnfc command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.