Sunday, September 27, 2009

Principles of Programming Languages - Module 2

Module 2
Levels of Programming Languages, Programming Domains, Language Evaluation Criteria

Levels of Programming Languages

Programming languages were invented to make machines easier to use.  They thrive because they make problems easier to solve.

The informal term level  is useful for gross distinctions between languages.  Levels of readability for programs are analogous to levels of readability for English text.

Machine Language

Machine computations are low level, full of details that have more to do  with the inner workings of the machine than with what the computation is for.  A typical machine-level operation might add numbers or compare characters.

Machine language is the native language of a computer; it is the notation to which  the computer responds directly. The term code originally referred to machine language, although code is now used more broadly to refer to any program text.

Programs in machine language are usually unintelligible at the lowest level, the most detailed level, since they consist only of 0s and 1s.

Assembly language is a variant of machine language in which names and symbols take the place of the actual codes for machine operations, values, and storage locations, making individual instructions more readable.

High-level Language

A language is a high-level language if it is independent of the underlying machine.  They have replaced machine and assembly language in virtually all areas of programming, because they provide benefits like the following:

a. Readable familiar notations
b. Machine independence
c. Availability of program libraries
d. Consistency checks during implementation that can detect errors

Portability is another term for machine independence; a language is portable if programs in the language can be run on different machines with little or no change. (Sethi, R.)

Programming Domains

Computers have been applied to a myriad of different areas, from controlling nuclear power plants to storing the records of personal checkbooks.  Because of this great diversity in computer use, programming languages with very different goals have been developed.

Scientific Applications

Typically, scientific applications have simple data structures but require large numbers of floating-point arithmetic computations.  The most common data structures are arrays and matrices; the most common control structures are counting loops and selections.  Examples of these languages are FORTRAN and ALGOL 60.

Business Applications

Business languages are characterized by facilities for producing elaborate reports, precise ways of describing and storing decimal numbers and character data, and the ability to specify decimal arithmetic operations.

With the advent of microcomputers came new ways for businesses, especially small businesses, to use computers.  Two specific tools that can be used on small computers, spreadsheet systems and database systems, were developed for business and now are widely used.  The COBOL language belongs to this category.

Artificial Intelligence

This is a broad area of computer applications characterized by the use of symbolic rather than numeric computations. Symbolic computation means that symbols, consisting of names rather than numbers, are manipulated.  Also, symbolic computation is more conveniently done with linked lists of data rather than arrays.  This kind of programming sometimes requires more flexibility  than other programming domains.  The functional language LISP and the ProLog which supports logic programming belong to this group.

Systems Programming

The OS and all of the programming support tools of a computer system are collectively known as its systems software.  Systems s/w is used almost continuously and therefore must have execution efficiency.  A language for this domain must provide fast execution.  It should have low-level features that allow the s/w interfaces to external devices to be written.  Examples of this softwares are PL/1, BLISS, Extended ALGOL, and UNIX.


Scripting Languages

A scripting language is used by putting a list of commands, called a script, in a file to be executed.  sh (for shell) was the first of these languages.  It began as a small collection of commands that were interpreted as calls to system subprograms that performed utility functions, such as file management and simple file filtering.    To these basis were added variables, control flow statements, functions, and various other capabilities, and the result is a complete programming language.  As a result, ksh was developed by David Korn at Bell Laboratories.

awk is another scripting language, developed by Al Aho, Brian Kernighan, and Peter Wienberger at Bell Laboratories.  It began as a report-generation language but later became a more general purpose language.

tcl is an extensible scripting language developed by John Outsterhout at the University of California at Berkeley.  Today, tcl is combined with tk,  a language that provides a method of building X Window application. 

The Perl  language, developed by Larry Wall, was originally a combination of sh and awk.  Since the advent of the WWW, the popularity of Perl has risen dramatically, primarily because it is a nearly  ideal language for CGI(Common Gateway Interface) programming.

Special-Purpose Languages

They range from RPG, which is used to produce business reports, to APT, which is used for instructing programmable machine tools, to GPSS, which is used for systems simulation.

Language Evaluation Criteria

A.  Readability

One of the most important criteria for judging a programming language is the ease with which the programs can be read and understood. Readability must be considered in the context of the problem domain. For example, if a program that describe a computation was written in a language not desired for use, the program may be unnatural and convoluted, making it unusually difficult to read.

B.  Writability. 
Is a measure of how easily a langaueg can be used to create programs for a chosen problem domain.

C.  Reliability. 
A program is said to be reliable if it performs to its specifications under all conditions.
   
D.  Cost . 
The ultimate total cost of a programming language is a function of many of this characteristics.  First, there is the cost of training programmers to use the language.  Second is the cost of writing programs in language. Third is the cost of compiling programs in the language. Fourth, the cost of executing programs written in language is greatly influenced by that language's design.

No comments:

Post a Comment

Related Posts with Thumbnails