1 / 14

Research Project CSC 415 Programming Languages Fall 2013

Research Project CSC 415 Programming Languages Fall 2013. History. Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other language

rhian
Download Presentation

Research Project CSC 415 Programming Languages Fall 2013

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Research ProjectCSC 415Programming LanguagesFall 2013

  2. History • Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other language • created in the 1970 for the purpose of the US Department of defense • this decision because they had realized that there were many languages used by the US Department of Defense and created this program to supersede the many different languages they were using

  3. History Cont. • named after the first credited programmer Ada Lovelace • the US Department of Defense was concerned by the number of different programming languages being used for its embedded computer system projects, many of which were obsolete or hardware-dependent, and none of which supported safe modular programming

  4. Data Types • Data types of a programming language are the different types of input and symbols that a programming language can read and work with

  5. Data Types

  6. Expression & Assignment Statement • Character next_vowel := ‘o’; • Float delta_v_sq:= (v2-v1) **2; • Delta_sum := (delta_v_sq + delta_h_sq) * .10; • angle := 2.0 * pi * float(p) / 360.0; • integer i := i + 1; • natural new_value := abs(any_value) + mod(old_value, 10); • string my_string := “ “ & packname(j) & “-“;

  7. Statement-Level Control Structure • with Ada.Text_IO, ADa.Integer_Text_IO; • use Ada.Text_IO, Ada.Integer_Text_IO; • procedure Example is • Year : INTEGER; • begin • for Age in 0..21 loop • Put("In"); • Put(Age + 1938,5); • Put(", I was"); • Put(Age,3); • Put(" years old"); • case Age is • when 5 => Put(", and started school"); • when 17 => Put(", and graduated from high school"); • when others => null; • end case; • Put("."); • New_Line; • end loop; • end Example;

  8. Sub Programs

  9. Object-Oriented Programming • Although the Ada language primary use was for the US Department of Defense, it does support object oriented programming • It does have use interface with buttons, images, audio, and other source of input

  10. Concurrency • Concurrent computation makes programming much more complex • major feature of the Ada programming language is the facilities it provides for concurrent programming

  11. Exception & Event Handling • begin • ... • exception • whenBuffer_Full_Error => • Reset_Buffer; • when Error: others => • Put_Line("Unexpected exception raised:"); • Put_Line(Ada.Exceptions.Exception_Information(Error)); • end;

  12. Example Code • HELLO WORLD! • -- Ada Hello, World! program. • with Text_IO; use Text_IO; • procedure Hello is • Put_Line("Hello, World!"); • end Hello;

  13. Example Code • Function: • with Gnat.Io; use Gnat.Io; • procedure f1 is • -- A small function. • function Sumsqr(X, Y: Integer) return Integer is • begin • return X*X + Y*Y; end; • -- How 'bout a nice, tender variable? • I: Integer; • begin • I := Sumsqr(3, 14); • Put(I); • New_Line; • Put(Sumsqr(I, 4)); • New_Line; • end f1;

  14. Exception Handling Example: • with Ada.Text_IO; use Ada.Text_IO; • procedure ReadOut is • S: String(1..100); -- Input line (up to 100 chars) • N: Integer; -- Number of characters read. • Begin • -- Issue the lovely decoration. • Put_Line("-----------------------------------------------------" & "-----------");  -- Copy lines like there's no tomorrow. • loop • Get_Line(S, N); • Put_Line(S(1..N)); • end loop;  • exception • when End_Error => • -- When reaching end of file, issue the closing lovely decoration • and • -- return from the procedure. • Put_Line("-----------------------------------------------------" & "-----------"); • return; • end ReadOut;

More Related