For faster navigation, this Iframe is preloading the Wikiwand page for Ada.

Ada

Ada
编程范型多范式
设计者
发行时间1980年
类型系统静态强类型安全标明英语Nominal type system
操作系统跨平台
网站http://www.adaic.org/
主要实现产品
AdaCore GNAT,

Green Hills Software英语Green Hills Software Optimising Ada 95 compiler,

DDC-I英语DDC-I Score
派生副语言
SPARKRavenscar profile
启发语言
ALGOL 68, Pascal, C++(Ada 95), Smalltalk(Ada 95), Modula-2 (Ada 95) , Java(Ada 2005),Eiffel(Ada 2012)
影响语言
C++, Eiffel, PL/SQL, VHDL, Ruby, Java
Ada吉祥物

Ada,是一种程式设计语言。它源于美国国防部在二十世纪七十年代的计划,旨在集成美军系统程式设计语言,而当时美军系统运行着上百种不同的程式设计语言,并提高调试能力和效率,由Pascal及其他语言扩展而成,接近自然语言和数学表达式,用“Ada”命名以纪念埃达·洛夫莱斯Ada Lovelace)。

重要特征

Ada语言最早针对嵌入式实时计算设计,至今依然在这些领域广泛使用。Ada95版,是由INTERMETRICS公司的塔克·塔夫特于1992到1995年间设计的,旨在改进对于系统、数字、财务软件编程的支持。

Ada语言的重要特征就是其嵌入式风格,模块化编程,编译检查,平行处理异常处理泛型编程。Ada在1995年加入了对面向对象设计的支持,包括动态分配等。

Ada的编译检查主要是针对没有分配的内存读写的保护,堆栈溢出错误,单个错误空闲,队列读写错误以及其他可以避免的小问题。这些检查可以在为增加效率的情况下被取消,但是在编译的时候他们却能带来很高的效率。同样它也包括对程序的严正的设置。因为这些原因,它被广泛应用于一些非常重要的系统中,例如航空电子学武器及航天飞行器的操作系统中。

同样它支持很多的编译时间检查,这些检查被用来避免一些错误的发生。这种错误往往是在其他语言中运行之前难以被察觉到的,需要在原始码中加入特殊的检查设置才能被发现。

Ada的动态内存管理非常安全和高规格,它类似于JAVA语言却不同于C语言的。这种特殊功能并不需要特殊的运行设置。尽管这种语言的语意结构允许对于不能读写的目标进行自动的碎片搜集,但是大多数运行时都不支持该特性。Ada却支持有限形式基于区域的存储管理。无效的读写常在运行时候被检查出来(除非这种检测被人为关闭)并且有时候在编译时候就被发现。

Ada语言的定义同国际标准化组织(ISO)的标准有很大不同,因为他是一个自由内容形式的。这种做法的后果是被广大程序员只能从它的标准化文档(普遍认为是Ada的参考使用手册(ARM))寻找细节性的技术问题,但是普遍情况是一本标准教科书却可以在其他不同语言上使用。

Ada语言由严格的巴斯特范式定义,不适合一般人阅读。它是第一种同时拥有IEC/ISO/美国军用标准认证的语言,其编译器经过严格的审查,以确保同样的代码在任一编译器上产生同样的可执行效果,并且保证并行性在代码级可以在无操作系统下同样运行。

历史

在1970年代,美国国防部(DoD)所属的嵌入式电脑系统项目中使用的编程语言数量逐日增多,其中的很多语言十分陈旧或者依赖于硬件,而且没有一个支持安全的模块化编程,对此DoD感到十分担心。基于这个原因,在1975年成立了高级语言工作组(HOLWG),它的使命是就是寻找或者创造某种适合国防部需要的编程语言,以便减少现有编程语言数量。该小组最终的工作成果就是Ada语言。由此,类似项目中使用的高级编程语言的数量大大减少了,1983年的450种编程语言,到1996年只剩下37种。

工作组开发出了语言要求文档—文档。许多现存的语言都被仔细地检查,但是1977年这个团队声称没有任何现存语言符合他们的条件。

Ada语言的示例程序

Hello, World!程序

with Ada.Text_IO; use Ada.Text_IO;

procedure Hello is
begin
    Put_Line("Hello, world!");
end Hello;

Ada.Text_IO.Put_Line处有一些捷径,不需要很多的文字输入,但是对于这里的理解来讲并没有多大意义。细节性的问题请参考Ada Programming/Basic

判定一个字符串是否为回文的函数(递归):

-- 判定一个字符串是否是回文
function is_palindrome(str : in String) return Boolean is
    len : Natural := str'Length;
begin
    if len <= 1 then
        return True;
    elsif Element(To_Unbounded_String(str), 1) = Element(To_Unbounded_String(str), len) then
        declare
            new_str : String(1..len-2);
        begin
            new_str := Slice(Source => To_Unbounded_String(str),
                             Low    => 2,
                             High   => len - 1);
            return is_palindrome(str => new_str);
        end;
    else
        return False;
    end if;
end is_palindrome;

定义一个函数用来判定一字符串是否为回文

-- 判定一个字符串是否是回文
function is_palindrome(str : in String) return Boolean is
    len : Natural := str'Length;
begin
    for i in 1 .. len / 2 loop
        if Element(To_Unbounded_String(str), i) /= Element(To_Unbounded_String(str), len - i + 1) 
        then
            return False;
        end if;
    end loop;
    return True;
end is_palindrome;

参见

参考书目

国际标准

书目

Ada的百科

总体资讯

辅助工具书

工程

参考文献

  1. ^ Technical Corrigendum for Ada 2012 published by ISO. Ada Resource Association. 2016-01-29 [2016-02-23]. (原始内容存档于2016-03-04). 
  2. ^ Consolidated Ada 2012 Language Reference Manual. Ada Conformity Assessment Authority. [2016-02-23]. (原始内容存档于2016-03-03).  |url-status=|dead-url=只需其一 (帮助)
  3. ^ Technical Corrigendum 1 for Ada 2012. Ada Conformity Assessment Authority. [2016-02-23]. (原始内容存档于2016-03-02).  |url-status=|dead-url=只需其一 (帮助)

外部链接

{{bottomLinkPreText}} {{bottomLinkText}}
Ada
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?