How to: Install Ada compiler and edit Ada file in Ubuntu Linux

Ada programming language is one that I like the most. I now am struggling to learn this amazing language. Someone say that the first programming language your learn will affect so much on the future of how you learn another language. Yeah, that’s true. My first programming language is Visual Basic 6.0. And, every time I study new language, then I try to compare both the language: VB and the language I am learning.

Now it is time to Ada. Ada is more close to Pascal, but advanced version. For you who familiar with Pascal, I think there will be no problem for you to learn Ada, as well. This language is easy to read, reliable, and… fast, I think.

And now, I will share my experience on installing Ada compiler (GNAT) and how you can code Ada in Ubuntu Linux. 

Install Ada Compiler

To install Ada compiler. Open the terminal window, then write: sudo apt-get install gnat.

Edit Ada files using ViM

ViM is good enough for being the Ada editor. Even though you can use ViM for editing C as well. I will give a basic view of how to use Vim. 

Ada programming language on Vim

Ada programming language on Vim

  1. type “vim [file_name].adb”, by doing this, the ViM will set the syntax to Ada. Don’t worry, you can write the file name even though you don’t really have the physical file. You can save the file later.
  2. If you want to save. You have to write a command in vim. To activate a command, press Ctrl + C (Ctrl and C at the same time).
  3. Type “:w” to save/to write. Type “:q” to quit. Type “:wq” to save and then quit. Here is the VIM command cheat set 
  4. To compile. Type; gnat make [filename].adb
  5. Then, you can run/lunch the file also via the terminal.
Hope it helps, enjoy ada on ubuntu!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s