How to download and install Bison (GNU Parser Generator) on Ubuntu Linux
This short tutorial shows you how to download and install Bison (GNU Parser Generator) on Ubuntu Linux Server. The process is very simple. For this tutorial, I'll be downloading and installing Bison version 2.3. Linux kernel is 2.6.15-26-powerpc. I have used a Mac Mini (powerpc/ppc architecture). GCC version number is 4.0.3. Your configuration may be different from mine but the installation steps below should work fine for most configurations with little or no change at all (including other Linux distributions and even unixes e.g. MacOS X).
Bison (GNU Parser Generator):
According to gnu.org,
"Bison is a general-purpose parser generator that converts an annotated context-free grammar into an LALR or GLR parser for that grammar. Once you are proficient with Bison, you can use it to develop a wide range of language parsers, from those used in simple desk calculators to complex programming languages."
Before starting, please check to see if there is a latest version available to download. Visit http://www.gnu.org/software/bison/ to find out about the available versions. IMPORTANT: See "Configuring Ubuntu Linux After Installation" to install the development tools required to compile and install bison from source code.
Steps to download, compile, and install are as follows. Note: Replace 2.3 with your version number:
- Download Bison (GNU Parser Generator)
- Extract files from the downloaded Bison package
- Configure downloaded Bison (GNU Parser Generator) package
- Compile Bison
- Install Bison
Download Bison (GNU Parser Generator):Run the command below,
Extract files from the downloaded Bison package:
tar -xvzf bison-2.3.tar.gzNow, enter the directory where the download bison package is extracted.
Configure downloaded Bison (GNU Parser Generator) package:
If you haven't installed m4 yet then please do so. Click here to read about the installation instructions for m4. Run the commands below to include m4 in your PATH variable.
NOTE: Replace '/usr/local/m4/bin' with the location of m4 binary. Now, configure the source code before installation. You can also install bison with libiconv.
./configure --prefix=/usr/local/bison --with-libiconv-prefix=/usr/local/libiconv/Replace "/usr/local/bison" above with the directory path where you want to copy the files and folders. Remove '--with-libiconv-prefix=/usr/local/libiconv/' from the command above if you don't want to install bison with libiconv. Note: check for any error message.
Note: check for any error message.
As root (for privileges on destination directory), run the following.With sudo,
sudo make installWithout sudo,
Note: check for any error messages.
That’s it! Bison (GNU Parser Generator) has been successfully downloaded, configured, compiled, and installed on Linux.
Please feel free to use the comments form below if you have any questions or need more explanation on anything. Use the icons below to share this tutorial with your friends.