Lecture Programming languages (2/e): Chapter 12c - Tucker, Noonan

Chapter 12c - Ada. Ada was developed in the late 1970s by the Department of Defense for both large command and control systems, as weB as embedded, real-time systems. In the sections that follow, we use the name Ada to refer to the imperative subset of Ada. | Programming Languages 2nd edition Tucker and Noonan Chapter 12 Imperative Programming I really hate this darn machine; I wish they would sell it; It won’t do what I want it to, but only what I tell it. Programmer’s lament (anonymous) Contents What Makes a Language Imperative? Procedural Abstraction Expressions and Assignment Library Support for Data Structures C Ada Perl Ada developed in late 1970’s by DoD DoD spending billions of dollars on software over 450 languages in use solution: standardize on one language Higher Order Language Working Group Ada 83 problem: size of language/compiler no subsets rule hard times during 1990s use of COTS renewed interest COTS proved problematic development of Spark Ada NYU GNAT (Ada) compiler General Characteristics influencs: Algol, Pascal large language; case insensitive unlike C, array indexing errors trapped type safe generics exception handling -- strictly control type union = record case b : boolean of true : (i : integer); false : (r : real); end; var tagged : union; begin tagged := (b => false, r => ); put(); -- error generic type element is private; type list is array(natural range ) of element; with function ">"(a, b : element) return boolean; package sort_pck is procedure sort (in out a : list); end sort_pck; package sort_pck is procedure sort (in out a : list) is begin for i in a'first a'last - 1 loop for j in i+1 a'last loop if a(i) > a(j) then declare t : element; begin t := a(i); a(i) := a(j); a(j) := t; end; end if; Ex: Average comparable to C infinite loop; exit on end of file via exception inner loop to catch errors caused by non-numeric data wordy than C Ex: Matrix Multiplication overloaded * raises exception if the number of columns of A not equal to the number of rows of B a’first(2), a’last(2), a’range(2) compiler can verify at compile time that an indexing error cannot occur type Matrix is array (Positive range of Float, Positive range of . | Programming Languages 2nd edition Tucker and Noonan Chapter 12 Imperative Programming I really hate this darn machine; I wish they would sell it; It won’t do what I want it to, but only what I tell it. Programmer’s lament (anonymous) Contents What Makes a Language Imperative? Procedural Abstraction Expressions and Assignment Library Support for Data Structures C Ada Perl Ada developed in late 1970’s by DoD DoD spending billions of dollars on software over 450 languages in use solution: standardize on one language Higher Order Language Working Group Ada 83 problem: size of language/compiler no subsets rule hard times during 1990s use of COTS renewed interest COTS proved problematic development of Spark Ada NYU GNAT (Ada) compiler General Characteristics influencs: Algol, Pascal large language; case insensitive unlike C, array indexing errors trapped type safe generics exception handling -- strictly control type union = record case b : boolean of

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.