{{infobox programming language
| name = Ada
| logo = Ada horizon green logo with slogan.svg
| paradigm = 多范式
| year = 1980年
| designer = -{}-
- MIL-STD-1815/Ada 83:
- Ada 95: Tucker Taft
- Ada 2005: Tucker Taft
- Ada 2012: Tucker Taft
| developer =
| latest_release_version = Ada 2012 TC1
| latest_release_date =
| latest_preview_version = Ada 2012 TC1
| latest_preview_date =
| turing-complete = Yes
| typing = 静态、强类型、安全、
| implementations = AdaCore GNAT,
Optimising Ada 95 compiler,
Score
| influenced_by = ALGOL 68, Pascal, C++(Ada 95), Smalltalk(Ada 95), Modula-2 (Ada 95) , Java(Ada 2005),Eiffel(Ada 2012)
| influenced = C++, Eiffel, PL/SQL, VHDL, Ruby, Java
| operating_system = 跨平台
| license =
| website = http://www.adaic.org/
| dialects = SPARK、
| wikibooks = Ada Programming
}}
]]
Ada,是一种程序设计语言。它源于美国国防部在二十世纪七十年代的计划,旨在整合美军系统程序设计语言,而当时美军系统运行着上百种不同的程序设计语言,并提高除錯能力和效率,由Pascal及其他语言扩展而成,接近自然語言和数学表达式,用「Ada」命名以纪念埃达·洛夫莱斯;}-()。
重要特征
Ada语言最早针对嵌入式和即時運算}-设计,至今依然在这些领域广泛使用。Ada95版,是由INTERMETRICS公司的塔克·塔夫特于1992到1995年间设计的,旨在改进对于系统、数字、财务软件编程的支持。
Ada语言的重要特征就是其嵌入式风格,模块化编程,编译检查,平行处理,异常处理及泛型编程。Ada在1995年加入了对面向对象设计的支持,包括动态分配等。
Ada的编译检查主要是针对没有分配的内存读写的保护,堆栈溢出错误,单个错误空闲,队列读写错误以及其他可以避免的小问题。这些检查可以在为增加效率的情况下被取消,但是在编译的时候他们却能带来很高的效率。同样它也包括对程序的严正的设置。因为这些原因,它被广泛应用于一些非常重要的系统中,例如航空电子学,武器及航天飞行器的操作系统中。
同样它支持很多的编译时间检查,这些检查被用来避免一些错误的发生。这种错误往往是在其他语言中运行之前难以被察觉到的,需要在源码中加入特殊的检查设置才能被发现。
Ada的动态内存管理非常安全和高规格,类似于Java语言却不同于C语言的。这种特殊功能并不需要特殊的运行设置。尽管这种语言的语意结构允许对于不能读写的目标进行自动的碎片搜集,但是大多数运行时都不支持该特性。Ada却支持有限形式基于区域的存储管理。无效的读写常在运行时候被检查出来(除非这种检测被人为关闭)并且有时候在编译期就被发现。
Ada语言的定义同國際標準化組織的标准有很大不同,是一个自由内容形式的。这种做法的后果是被广大程序员只能从它的标准化文档(一般是Ada的参考使用手册)寻找细节性的技术问题,但是普遍情况是一本标准教科书却可以在其他不同语言上使用。
Ada语言由严格的巴斯特范式定义,不适合一般人阅读。它是第一种同时拥有IEC/ISO/美国军用标准认证的语言,其编译器经过严格的审查,以确保同样的代码在任一编译器上产生同样的可执行效果,并且保证并行性在代码级可以在无操作系统下同样运行。
历史
在1970年代,美国国防部(DoD)所属的嵌入式计算机系统项目中使用的编程语言数量逐日增多,其中的很多语言十分陈旧或者依赖于硬件,而且没有一个支持安全的模块化编程,对此DoD感到十分担心。基于这个原因,在1975年成立了高级语言工作组(HOLWG),它的使命是就是寻找或者创造某种适合国防部需要的编程语言,以便减少现有编程语言数量。该小组最终的工作成果就是Ada语言。由此,类似项目中使用的高级编程语言的数量大大减少了,1983年的450种编程语言,到1996年只剩下37种。
工作组开发出了语言要求文档—文档。许多现存的语言都被仔细地检查,但是1977年这个团队声称没有任何现存语言符合他们的条件。
应用
1994年,中国已将Ada作为军事领域的标准语言,并将使用Ada构建北京空中交通管制系统。
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 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;
参见
*SPARK
参考书目
国际标准
- :Information technology — Programming languages — Ada
- :Information technology — Programming languages — Ada Semantic Interface Specification(ASIS)
- :Information technology — Programming languages — Ada: Conformity assessment of a language processor(ACATS)
- IEEE Standard 1003.5b-1996,the POSIX Ada binding
- [https://web.archive.org/web/20041209184612/http://www.omg.org/technology/documents/formal/ada_language_mapping.htm Ada Language Mapping Specification],the CORBA IDL to Ada mapping
书目
- Jan Skansholm:Ada 95 From the Beginning, Addison-Wesley, ISBN 0-201-40376-5
- :Programming in Ada plus Language Reference Manual, Addison-Wesley, ISBN 0-201-56539-0
- :Programming in Ada 95, Addison-Wesley, ISBN 0-201-34293-6
- :High Integrity Ada: The SPARK Approach, Addison-Wesley, ISBN 0-201-17517-7
- :High Integrity Software: The SPARK Approach to Safety and Security, Addison-Wesley, ISBN 0-321-13616-0
- :Ada Programmer's Handbook, Benjamin-Cummings Publishing Company, ISBN 0-8053-2529-8
- :Ada for Software Engineers, John Wiley & Sons, ISBN 0-471-97912-0
- :Ada as a Second Language, McGraw-Hill Science/Engineering/Math, ISBN 0-07-011607-5
- ,:Real-Time Systems and Programming Languages. Ada 95, Real-Time Java and Real-Time POSIX., Addison-Wesley, ISBN 0-201-72988-1
- ,:Concurrency in Ada, Cambridge University Press, ISBN 0-521-62911-X
- :Object-Oriented Reuse, Concurrency and Distribution: An Ada-Based Approach, Addison-Wesley, ISBN 0-201-56527-7
- Grady Booch,Doug Bryan:Software Engineering with Ada, Addison-Wesley, ISBN 0-8053-0608-0
- ,Neil W. Webre:Data Structures with Abstract Data Types and Ada, Brooks Cole, ISBN 0-534-14448-9
- Pascal Ledru:Distributed Programming in Ada with Protected Objects, Dissertation.com, ISBN 1-58112-034-6
- Fintan Culwin:Ada, a Developmental Approach, Prentice Hall, ISBN 0-13-264680-3
- ,Fintan Culwin:Ada 95 the Craft of Object Oriented Programming, Prentice Hall, ISBN 0-13-230350-7
- :Ada 95, Springer-Verlag, ISBN 0-387-94801-5
- David R. Musser,:The Ada Generic Library: Linear List Processing Packages, Springer-Verlag, ISBN 0-387-97133-5
- Michael B. Feldman:Software Construction and Data Structures with Ada 95, Addison-Wesley, ISBN 0-201-88795-9
- :Ada95 for C and C++ Programmers, Addison-Wesley, ISBN 0-201-40363-3
- Michael B. Feldman,:Ada 95, Addison-Wesley, ISBN 0-201-36123-X
- Nell Dale,Chip Weems,:Programming and Problem Solving with Ada 95, Jones & Bartlett Publishers, ISBN 0-7637-0293-5
- Nell Dale,Susan Lilly,:Ada Plus Data Structures: An Object-Based Approach, Jones & Bartlett Publishers, ISBN 0-669-41676-2
- Bruce C. Krell:Developing With Ada: Life-Cycle Methods, Bantam Dell Pub Group, ISBN 0-553-09102-6
- Judy Bishop:Distributed Ada: Developments and Experiences, Cambridge University Press, ISBN 0-521-39251-9
- Bo Sanden:Software Systems Construction With Examples in Ada, Prentice Hall, ISBN 0-13-030834-X
- Bruce Hillam:Introduction to Abstract Data Types Using Ada, Prentice Hall, ISBN 0-13-045949-6
- :Introduction to Software Design and Development With Ada, Brooks Cole, ISBN 0-314-02829-3
- Ian C. Pyle:Developing Safety Systems: A Guide Using Ada, Prentice Hall, ISBN 0-13-204298-3
- Louis Baker:Artificial Intelligence With Ada, McGraw-Hill, ISBN 0-07-003350-1
- ,:HRT-HOOD: A Structured Design Method for Hard Real-Time Ada Systems, North-Holland, ISBN 0-444-82164-3
- Walter Savitch, Charles Peterson:Ada: An Introduction to the Art and Science of Programming, Benjamin-Cummings Publishing Company, ISBN 0-8053-7070-6
- Mark Allen Weiss:Data Structures and Algorithm Analysis in Ada, Benjamin-Cummings Publishing Company, ISBN 0-8053-9055-3
Ada的百科
总体信息
- [http://ada.krischik.com Ada@Krischik]
辅助工具书
- [http://en.wikibooks.org/wiki/Ada_Programming Ada Programming]
- [http://es.wikibooks.org/wiki/Programación_en_Ada Programación en Ada]
- [http://fr.wikibooks.org/wiki/Programmation_Ada Programmation Ada]
工程
- [http://adacl.sourceforge.net/index.php AdaCL]
- [http://wikibook-ada.sourceforge.net wikibook-ada]
- [http://gnat-asis.sourceforge.net ASIS]
- [http://gnat-glade.sourceforge.net GLADE]
- [http://gnat-florist.sourceforge.net Florist]
参考文献
外部链接
- [https://web.archive.org/web/20050828151449/http://adaworld.com/ Ada World]
- [http://adapower.com/ AdaPower]
- [http://www.adahome.com/ The Web Site for Ada]
- [http://www.sigada.org/ ACM SIGAda]
- [http://www.ada-europe.org/ Ada-Europe Organization]
- [http://www.adaic.com/ Ada Information Clearinghouse]
- [http://www.open-std.org/jtc1/sc22/wg9/ ISO Home of Ada Standards]
- [http://www.computer-books.us/ada95.php Ada 95 Books Available Online]
- [http://www.ada-auth.org/ Ada Rapporteur Group (evolution of standard)]
- [http://www.ada-answers.com/ Ada Answers - Building better software with Ada]
- [https://web.archive.org/web/20051026114218/http://www.adacore.com/academic.php Ada Academic Initiative]
- [http://libre.adacore.com/ "Libre" Ada Software]
- [http://www.gnuada.org/ GNU Ada Homepage]
- [http://www.gnavi.org/ GNAVI Ada Visual RAD]
- [http://citeseer.org/cs?q=%22Ada%22 Citations from CiteSeer]
- [http://www.gnat.com/ GNAT]
- [https://web.archive.org/web/20051123020015/http://www.usafa.af.mil/df/dfcs/bios/mcc_html/adagide.cfm AdaGIDE, the Ada GNAT Integrated Development Environment for Windows]
- [news:comp.lang.ada Forum]
- [https://web.archive.org/web/20041019114231/http://oopweb.com/Ada/Documents/Lovelace/Volume.html Ada Tutorial]
- [http://www.seas.gwu.edu/~mfeldman/ada-project-summary.html Projects Using Ada]
- [http://www.martincarlisle.com/a_sharp.html A#: Ada on .NET]
- [http://www.cs.kuleuven.ac.be/~dirk/ada-belgium/events/ Conference announcements for the international Ada community]
评论 (0)