0K - views

Research Project CSC 415

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

Embed :
Download Link

Download - The PPT/PDF document "Research Project CSC 415" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.

Research Project CSC 415






Presentation on theme: "Research Project CSC 415"— Presentation transcript:

Slide1

Research ProjectCSC 415Programming LanguagesFall 2013

Slide2

Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other languagecreated in the 1970 for the purpose of the US Department of defensethis 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

History

Slide3

named after the first credited programmer Ada Lovelacethe 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 History Cont.

Slide4

Data types of a programming language are the different types of input and symbols that a programming language can read and work withData Types

Slide5

TypeRange

Integer

-2,147,483,648 to 2,147,483,647

Natural

0 to Integer'last

Positive

1 to Integer'last

Long_Integer

-2**63 to (2**63)-1Short_Integer -128 to 127Float,Short_FloatReal numbers with anapproximate range of 8.43E-37 to 3.37E+38 and an accuracy of about 6 decimal digitsLong_FloatReal numbers with anapproximate range of 4.19E-307 to 1.67E+308 and an accuracy of about 15 decimal digitsBooleanAn enumeration type with the values (False, True)CharacterA character in the ANSI (8-bit) character set.Wide_CharacterA character in the UNICODE (16-bit) character setUnsigned_Integer 0 to 4,294,967,295Byte_Integer Integer values in the range of -128 to 127Unsigned_Byte_IntegerInteger values in the range of 0 to 255Word_Integer Integer values in the range of -32768 to 32767Unsigned_Word_Integer Integer values in the range of 0 to 65535Dword_Integer Integer values in the range of -2,147,483,648 to 2,147,483,647Unsigned_Dword_IntegerInteger values in the range of 0 to 4,294,967,295Qword_Integer-2**63 to (2**63)-1Byte_BooleanAn enumeration type with the values (False, True)Word_BooleanAn enumeration type with the values (False, True)Dword_BooleanAn enumeration type with the values (False, True). Useful when interfacing with C code.

Data Types

Slide6

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) & “-“;Expression & Assignment Statement

Slide7

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;Statement-Level Control Structure

Slide8

Parameter Mode

Functions

Procedure

Description

IN

Yes

Yes

Passed into the subprogram, are constants in the subprogram, and may not be changed in the subprogram

OUTNoYesPassed out of the subprogram, a parameters value is defined inside the subprogramINOUTNoYesPassed into the subprogram, and may be changed by the subprogram, and the parameters value is passed out of the subprogramSub Programs

Slide9

Although the Ada language primary use was for the US Department of Defense, it does support object oriented programmingIt does have use interface with buttons, images, audio, and other source of inputObject-Oriented Programming

Slide10

Concurrent computation makes programming much more complexmajor feature of the Ada programming language is the facilities it provides for concurrent programmingConcurrency

Slide11

begin ...exception when Buffer_Full_Error => Reset_Buffer; when Error: others =>

Put_Line

("Unexpected exception raised:");

Put_Line

(

Ada.Exceptions.Exception_Information

(Error));end;Exception & Event Handling

Slide12

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

Hello;

Example Code

Slide13

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;Example Code

Slide14

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;Exception Handling Example: