90 likes | 155 Views
ADA Langage Report. Ligia Nitu. Introduction. Ada is the most extensive and expensive computer language ever developed. It was developed for the Department of Defense, so their computing environment determined its original form – real-time embedded systems.
E N D
ADA Langage Report Ligia Nitu
Introduction • Ada is the most extensive and expensive computer language ever developed. • It was developed for the Department of Defense, so their computing environment determined its original form – real-time embedded systems. • The first version of the language was released in 1980, after a period of about six years of design processing, requirements documentation, and international reviews. • First ANSI standardized in 1983, it became ISO standard without any changes in 1987. • Ada represents most of the concepts of software engineering and language design from late 1970’s. This complexity made it very difficult to write usable compilers until about four years after the language design was completed.
Usage • Ada is a general-purpose language, used in a diverse number of applications – missile control, payroll, air control, etc. It is strong typed, modular, portable, reusable and readable. All of these are features that help reduce the cost of software development, and maintenance. • Ada is designed to support the construction of highly reliable, long-lived software systems. • Ada 95 added support for object-oriented programming as well as improved support for systems, numerical, and financial programming. • Ada 95 Reference Manual (contains the full definition of the language syntax) http://www.adahome.com/rm95/rm9x-toc.html
Compiler requirement example • Logically, Ada programs are composed of a set of program units. • Ada compilers compile compilation units. A compilation unit is either a program unit's declaration or body, preceded by a context clause. • A context clause is a set of with clauses (that state what other program units are needed) and/or use clauses (the program units to search by default). • Ada compilers must support lines and identifier lengths of at least 200 (!) characters. • Here's a simplified BNF syntax for a compilation unit. compilation_unit ::= context_clause library_item context_clause ::= {context_item} context_item ::= with_clause | use_clause with_clause ::= "with" library_unit_name { "," library_unit_name} ";" use_clause ::= "use" library_unit_name { "," library_unit_name} ";" library_item ::= package_declaration | package_body | subprogram_declaration | subprogram_body
Unusual fact about Numeric Literals • To make long numbers easier to read, underscores are permitted inside a numeric literal. Example: "1_000_000" is legal. • Underscores don't change the value of a number.
Exception Handling • Ada has built in exception handling capabilities which allow the program to handle its own run-time errors to protect against access to unallocated memory, buffer overflow errors, array access errors, and other avoidable bugs. These checks can be disabled in the interest of efficiency, but can often be compiled efficiently. • A key difference between Ada and some other languages (such as C and C++) is what happens when an evaluation cannot be completed. If a division by zero is attempted, or an expression result is too large, Ada will normally raise an exception. Exceptions can be handled, but if they’re not, the program will stop its execution with a debugging output to help identify the problem. • Instead of silently giving wrong answers, Ada programs normally will halt when a computation cannot be completed.
Ada case statement • It functions identical to C's "switch" statement, but unlike C, Ada supports ranges of values and does not require a "break" statement at the end of each sequence (a common C error). EX: case A is -- Execute something depending on A's value: when 1 => Fly; -- if A=1, execute Fly. when 3 .. 10 => Put(A); -- if A is 3 through 10, put it to the screen. when 11 | 14 => null; -- if A is 11 or 14, do nothing. when 2 | 20..30 => Swim; -- if A is 2 or 20 through 30, execute Swim. when others => Complain; -- if A is anything else, execute Complain. end case;
Notable Features • Portable – it can easily be recompiled and ported to other systems. • Packages – reusability - Separate compilation. • Generic Program Units – possible to write a procedure which does not require a data type to be specified. • Parallel / Concurrent Processing – modularity - Ada supports parallel and concurrent execution of tasks. • Memory Management – like Java. • System Programming - access to system-dependent properties and precise control over representation of data.
Conclusion • The Department of Defense no longer requires the use of Ada language only, so its popularity is decreasing. • Another factor that influenced its popularity was that before Ada 95 release, there was a wide acceptance of the C++ language for object oriented programming. • Work continues on improving and updating the technical content of the Ada programming language, following the once-a-decade major update schedule. The new version is expected in 2007.