aspose.info
EN

ADS File - Ada Specification File Format

Updated

What is an ADS file?

An ADS file is a specification file used in the Ada programming language. It contains the interface or specification of an Ada package - similar to a Java class definition or the header file (.h) in C/C++. The ADS file typically defines public and private declarations, such as types, constants, variables, and procedure signatures.

In contrast, the corresponding .adb (Ada Body) file contains the implementation of those declarations. This separation aligns with Ada’s support for strong modularity and encapsulation, even outside of object-oriented paradigms.

ADS File Format

ADS files are plain text files, meaning they can be opened and edited using any text editor such as:

  • Microsoft Notepad
  • Notepad++
  • Atom
  • Visual Studio Code
  • GNAT Studio (Ada-specific IDE)

File Structure Example

Here’s a basic example of how an Ada package is structured using .ads and .adb files:

root-child.ads

package Root.Child is
   -- Package specification goes here
   procedure Say_Hello;
end Root.Child;

root-child.adb

package body Root.Child is
   procedure Say_Hello is
   begin
      Put_Line("Hello from Root.Child!");
   end Say_Hello;
end Root.Child;

Note: Put_Line is part of the Ada.Text_IO package used for output.

How to Open an ADS File

ADS files do not require specialized software to be opened. However, for compilation and development, it’s best to use:

  • GNAT (GNU NYU Ada Translator)
  • GPS (GNAT Programming Studio)
  • AdaCore tools

These tools provide syntax highlighting, code navigation, and compiler integration.

When Are ADS Files Used?

ADS files are essential in large-scale Ada projects where clear separation of interface and implementation is needed. This helps in:

  • Code reuse
  • Modular development
  • Easier maintenance
  • Clear APIs for package use

They are commonly seen in embedded systems, aerospace software, and safety-critical applications where Ada is widely adopted.

References