Ada Fundamentals

Introduction

Ada (named after Ada Lovelace, a computer programmer (1815-1852)) is a computer language that can be used to write structured instructions that tell the computer what to do and when to do it.

Installing GNAT

To program in Ada, you need an Ada compiler. If you are involved in academics (student, teacher, etc), you can download it free from the GNAT programming studio that will provide you with an Ada compiler (you may have to create an account on the web site to be registered and activate the software). After downloading GNAT, you can install it. The default installation would be C:\GNAT\2009. The installation would create an icon for the GNAT programming studio. The icon is named GPS:

Creating a Project

After installing GNAT, you can start creating applications (you should first use a file utility, such as Windows Explorer, to create a folder that will contain the project; otherwise, the GPS can create the folder for you. For this project, we will use a folder named Exercise1 created in the C:\ drive).

To launch the GNAT programming studio, you can double-click the gps.exe icon. This would start with a splash screen:

After the GPS splash screen, the Welcome to GPS dialog box would display. To start a project, click the Create A New Project With Wizard radio button:

Click OK. This would display the first page of the Create New Project wizard.

Create the Single Project radio button:

Click Forward.

In the second page of the Create New Project wizard, you must enter a name for the project. After entering the name of the project, you must specify the folder where the project will be stored:

You can use one of the folders created by the installation of the GNAT programming language. Normally, a default folder will be suggested and entered in the second text box. Otherwise, you can type it, or you can click the Browse button to locate and select an existing folder under the Drive:\GNAT directory

If you had already created a folder, enter its path in the Enter the Directory Where the Project File Will Be Created

If you had already created the folder but can't remember its path, you can click the Browse button to locate and select it

If you didn't create a folder yet, you can just enter its path in the Enter the Directory Where the Project File Will Be Created. If the folder exists and can be found, it will be recognized and used. If the folder doesn't exist, later on, the wizard will let you know and offer to create it

When you are ready, click Forward.

In the third page of the wizard, make sure (only) the Ada check box is checked:

Click Forward.

In the fourth page of the wizard, click Forward.

In the fifth page of the wizard, click Forward.

In the sixth page of the wizard, you must specify a folder for the build. You can use the same path you specified in the second page of the wizard. Otherwise, you can enter another. the scenario would the the same we reviewed in the second page:

Once you are ready, click Forward.

In the seventh page of the wizard, if you had already created an Ada source file, you can click Add to locate, select, and add it. If not, you don't have to do anything: you will add the files later on:

Once you are ready, click Forward.

In the eighth page of the wizard, click Forward.

In the ninth page of the wizard, accept the defaults and click Apply. If the path you specified in the second (and the sixth) page of the wizard exists already, the wizard would end and the project would be created. If the path is wrong, the wizard would display a message and ask if you want it to create the directory:

In this case, you can click Yes. The wizard would complete the project creation. When the project has been created, the GPS - GNAT Programming Studio would come up, divided in various windows. The lower-right window would indicate that the project doesn't have a source file: