Ada

出自Local Chinese Wikipedia
跳至導覽 跳至搜尋

Template:NoteTA 腳本錯誤:沒有「Infobox」這個模塊。腳本錯誤:沒有「Check for unknown parameters」這個模塊。

File:Ada Mascot with slogan.svg
Ada吉祥物

Ada,是一種程序設計語言。它源於美國國防部在二十世紀七十年代的計劃,旨在整合美軍系統程序設計語言,而當時美軍系統運行着上百種不同的程序設計語言,並提高除錯能力和效率,由Pascal及其他語言擴展而成,接近自然語言和數學表達式,用「Ada」命名以紀念愛達·勒芙蕾絲腳本錯誤:沒有「Lang」這個模塊。)。

重要特徵[編輯]

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種。

Template:Sister工作組開發出了語言要求文檔—文檔。許多現存的語言都被仔細地檢查,但是1977年這個團隊聲稱沒有任何現存語言符合他們的條件。

應用[編輯]

1994年,中國已將Ada作為軍事領域的標準語言,並將使用Ada構建北京空中交通管制系統。[1]

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;

參見[編輯]

參考書目[編輯]

國際標準[編輯]

  • 腳本錯誤:沒有「ilh」這個模塊。:Information technology — Programming languages — Ada
  • 腳本錯誤:沒有「ilh」這個模塊。:Information technology — Programming languages — Ada Semantic Interface Specification(ASIS
  • 腳本錯誤:沒有「ilh」這個模塊。:Information technology — Programming languages — Ada: Conformity assessment of a language processor(ACATS
  • IEEE Standard 1003.5b-1996,the POSIX Ada binding
  • Ada Language Mapping Specification,the CORBA IDL to Ada mapping

書目[編輯]

Template:Sister

  • Jan SkansholmAda 95 From the Beginning, Addison-Wesley, ISBN 0-201-40376-5
  • 腳本錯誤:沒有「ilh」這個模塊。Programming in Ada plus Language Reference Manual, Addison-Wesley, ISBN 0-201-56539-0
  • 腳本錯誤:沒有「ilh」這個模塊。Programming in Ada 95, Addison-Wesley, ISBN 0-201-34293-6
  • 腳本錯誤:沒有「ilh」這個模塊。High Integrity Ada: The SPARK Approach, Addison-Wesley, ISBN 0-201-17517-7
  • 腳本錯誤:沒有「ilh」這個模塊。High Integrity Software: The SPARK Approach to Safety and Security, Addison-Wesley, ISBN 0-321-13616-0
  • 腳本錯誤:沒有「ilh」這個模塊。Ada Programmer's Handbook, Benjamin-Cummings Publishing Company, ISBN 0-8053-2529-8
  • 腳本錯誤:沒有「ilh」這個模塊。Ada for Software Engineers, John Wiley & Sons, ISBN 0-471-97912-0
  • 腳本錯誤:沒有「ilh」這個模塊。Ada as a Second Language, McGraw-Hill Science/Engineering/Math, ISBN 0-07-011607-5
  • 腳本錯誤:沒有「ilh」這個模塊。腳本錯誤:沒有「ilh」這個模塊。Real-Time Systems and Programming Languages. Ada 95, Real-Time Java and Real-Time POSIX., Addison-Wesley, ISBN 0-201-72988-1
  • 腳本錯誤:沒有「ilh」這個模塊。腳本錯誤:沒有「ilh」這個模塊。Concurrency in Ada, Cambridge University Press, ISBN 0-521-62911-X
  • 腳本錯誤:沒有「ilh」這個模塊。Object-Oriented Reuse, Concurrency and Distribution: An Ada-Based Approach, Addison-Wesley, ISBN 0-201-56527-7
  • Grady BoochDoug BryanSoftware Engineering with Ada, Addison-Wesley, ISBN 0-8053-0608-0
  • 腳本錯誤:沒有「ilh」這個模塊。Neil W. WebreData Structures with Abstract Data Types and Ada, Brooks Cole, ISBN 0-534-14448-9
  • Pascal LedruDistributed Programming in Ada with Protected Objects, Dissertation.com, ISBN 1-58112-034-6
  • Fintan CulwinAda, a Developmental Approach, Prentice Hall, ISBN 0-13-264680-3
  • 腳本錯誤:沒有「ilh」這個模塊。Fintan CulwinAda 95 the Craft of Object Oriented Programming, Prentice Hall, ISBN 0-13-230350-7
  • 腳本錯誤:沒有「ilh」這個模塊。Ada 95, Springer-Verlag, ISBN 0-387-94801-5
  • David R. Musser腳本錯誤:沒有「ilh」這個模塊。The Ada Generic Library: Linear List Processing Packages, Springer-Verlag, ISBN 0-387-97133-5
  • Michael B. FeldmanSoftware Construction and Data Structures with Ada 95, Addison-Wesley, ISBN 0-201-88795-9
  • 腳本錯誤:沒有「ilh」這個模塊。Ada95 for C and C++ Programmers, Addison-Wesley, ISBN 0-201-40363-3
  • Michael B. Feldman腳本錯誤:沒有「ilh」這個模塊。Ada 95, Addison-Wesley, ISBN 0-201-36123-X
  • Nell DaleChip Weems腳本錯誤:沒有「ilh」這個模塊。Programming and Problem Solving with Ada 95, Jones & Bartlett Publishers, ISBN 0-7637-0293-5
  • Nell DaleSusan Lilly腳本錯誤:沒有「ilh」這個模塊。Ada Plus Data Structures: An Object-Based Approach, Jones & Bartlett Publishers, ISBN 0-669-41676-2
  • Bruce C. KrellDeveloping With Ada: Life-Cycle Methods, Bantam Dell Pub Group, ISBN 0-553-09102-6
  • Judy BishopDistributed Ada: Developments and Experiences, Cambridge University Press, ISBN 0-521-39251-9
  • Bo SandenSoftware Systems Construction With Examples in Ada, Prentice Hall, ISBN 0-13-030834-X
  • Bruce HillamIntroduction to Abstract Data Types Using Ada, Prentice Hall, ISBN 0-13-045949-6
  • 腳本錯誤:沒有「ilh」這個模塊。Introduction to Software Design and Development With Ada, Brooks Cole, ISBN 0-314-02829-3
  • Ian C. PyleDeveloping Safety Systems: A Guide Using Ada, Prentice Hall, ISBN 0-13-204298-3
  • Louis BakerArtificial Intelligence With Ada, McGraw-Hill, ISBN 0-07-003350-1
  • 腳本錯誤:沒有「ilh」這個模塊。腳本錯誤:沒有「ilh」這個模塊。HRT-HOOD: A Structured Design Method for Hard Real-Time Ada Systems, North-Holland, ISBN 0-444-82164-3
  • Walter Savitch, Charles PetersonAda: An Introduction to the Art and Science of Programming, Benjamin-Cummings Publishing Company, ISBN 0-8053-7070-6
  • Mark Allen WeissData Structures and Algorithm Analysis in Ada, Benjamin-Cummings Publishing Company, ISBN 0-8053-9055-3

Ada的百科[編輯]

總體信息[編輯]

輔助工具書[編輯]

工程[編輯]

參考文獻[編輯]

外部連結[編輯]

腳本錯誤:沒有「Navbox」這個模塊。

腳本錯誤:沒有「Authority control」這個模塊。腳本錯誤:沒有「Check for unknown parameters」這個模塊。