Chapter One Opl

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

CHAPTER ONE

Reason for studying concept of programming language


The following is what we believe to be a compelling list of potential benefits of studying concepts of
programming languages:

• Increased capacity to express ideas

• Improved background for choosing appropriate languages

• Increased ability to learn new languages

• Better understanding of the significance of implementation

• Better use of languages that are already known

• Overall advancement of computing

Programming Domain
"Programming domain" in computer science and computer programming is a general term that
refers to the field or problem that a program, programming language or language syntax
is designed to operate within or solve.

In this section, we briefly discuss a few of the areas of computer applications and their associated
languages:

Scientific Applications:

 The first digital computers, which appeared in the late 1940s and early 1950s, were invented
and used for scientific applications
 They used simple data structure but require large number of floating point arithmetic
computation
 The most common data structures were arrays and matrices, ; the most common control
structures were counting loops and selections
 The first language for scientific applications was Fortran. ALGOL 60

Business Application

 The first language for scientific applications was Fortran. ALGOL 60


 The first successful high-level language for business was COBOL (ISO/IEC, 2002)
 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.
Artificial Intelligence

 Artificial intelligence (AI) is a broad area of computer applications characterized by the use of
symbolic rather than numeric computations.
 The first widely used programming language developed for AI applications was the functional
language Lisp (McCarthy et al., 1965), which appeared in 1959
 Most AI applications developed prior to 1990 were written in Lisp

Web Software

 The World Wide Web is supported by an eclectic collection of languages, ranging from markup
languages, such as HTML, which is not a programming language, to general-purpose
programming languages, such as Java

Language Evaluation Criteria


 Readability
 Writability
 Reliability
 Cost

Readability
 One of the most important criteria for judging a programming language is the ease with which
programs can be read and understood.
 The following subsections describe characteristics that contribute to the readability of a
programming language.
Overall Simplicity
 The overall simplicity of a programming language strongly affects its readability.
A language with a large number of basic constructs is more difficult to learn
than one with a smaller number.
 Readability problems occur whenever the program’s author has learned a
different subset from that subset with which the reader is familiar.

feature multiplicity

 having more than one way to accomplish a particular operation.


 For example, in Java, a user can increment a simple integer variable in four
different ways:
count = count + 1
count += 1
count++
++count
operator overloading
 In which a single operator symbol has more than one meaning.

Orthogonality
 Orthogonality in a programming language means that a relatively small set
of primitive constructs can be combined in a relatively small number of
ways to build the control and data structures of the language.
 (The word orthogonal comes from the mathematical concept of orthogonal
vectors
 A lack of orthogonality leads to exceptions to the rules of the language. For
example, in a programming language that supports pointers, it should be
possible to define a pointer to point to any specific type defined in the
language. However, if pointers are not allowed to point to arrays, many
potentially useful user-defined data structures cannot be defined.
 We can illustrate the use of orthogonality as a design concept by comparing
one aspect of the assembly languages of the IBM mainframe computers and
the VAX series of minicomputers.
 The VAX addition instruction for 32-bit integer values is
ADDL operand_1, operand_2
whose semantics is
operand_2 d contents(operand_1) + contents(operand_2)
 The VAX instruction design is orthogonal in that a single instruction can use
either registers or memory cells as the operands.

Writability
 Writability is a measure of how easily a language can be used to create programs for a chosen
problem domain.
 As is the case with readability, writability must be considered in the context of the target
problem domain of a language.
 For example, the writabilities of Visual BASIC (VB) (Halvorson, 2013) and C are dramatically
different for creating a program that has a graphical user interface (GUI), for which VB is ideal.
 The following subsections describe the most important characteristics influencing the writability
of a language.
Simplicity and Orthogonality
Expressivity

Reliability
 A program is said to be reliable if it performs to its specifications under all conditions.
 The following subsections describe several language features that have a significant effect on
the reliability of programs in a given language.
Type Checking
 Type checking is simply testing for type errors in a given program, either by
the compiler or during program execution.
 One example of how failure to type check, at either compile time or run
time, has led to countless program errors is the use of subprogram
parameters in the original C language (Kernighan and Ritchie, 1978).

Exception Handling

 The ability of a program to intercept run- time errors (as well as other
unusual conditions detectable by the program), take corrective
measures, and then continue is an obvious aid to reliability
Aliasing
 aliasing is having two or more distinct names in a program that can be
used to access the same memory cell.

Readability and Writability

 Both readability and writability influence reliability. A program written


in a language that does not support natural ways to express the
required algorithms will necessarily use unnatural approaches.

Cost
 The total cost of a programming language is a function of many of its characteristics.
 First, there is the cost of training programmers to use the language
 Second, there is the cost of writing programs in the language.
 Third, there is the cost of compiling programs in the language
 Fourth, the cost of executing programs written in a language is greatly influenced by that
language’s design.
 The fifth factor in the cost of a language is the cost of the language implementation system
 Sixth, there is the cost of poor reliability
 The final consideration is the cost of maintaining programs

Influences on Language Design


The most important of these are computer architecture and programming design
methodologies.
Computer Architecture
 The basic architecture of computers has had a profound effect on language design.
 Most of the popular languages of the past 60 years have been designed around the prevalent
computer architecture, called the von Neumann architecture
 These languages are called imperative languages
 In a von Neumann computer, both data and programs are stored in the same memory.
 Nearly all digital computers built since the 1940s have been based on the von Neumann
architecture
 The execution of a machine code program on a von Neumann architecture computer occurs in a
process called the fetch-execute cycle

Programming Design Methodologies

 The late 1960s and early 1970s brought an intense analysis, begun in large part by the
structured-programming movement, of both the software development process and
programming language design
 An important reason for this research was the shift in the major cost of computing from
hardware to software, as hardware costs decreased and programmer costs increased
 The new software development methodologies that emerged as a result of the research of
the 1970s were called top-down design and stepwise refinement.
 In the late 1970s, a shift from procedure- oriented to data- oriented program design
methodologies began.
 The first language to provide even limited support for data abstraction was SIMULA 67

Language Categories
Programming languages are often categorized into four bins:

 Imperative
 Functional
 Logic
 and object oriented

Language design Trade-off


 Two criteria that conflict are reliability and cost of execution. For example, the Java language
definition demands that all references to array elements be checked to ensure that the index or
indices are in their legal ranges.
 As another example of conflicting criteria that leads directly to design trade-offs, consider the
case of APL. APL includes a powerful set of operators for array operands.

Implementation Method
Compilation

 Programming languages can be implemented by any of three general methods. At one extreme,
programs can be translated into machine language, which can be executed directly on the
computer. This method is called a compiler implementation and has the advantage of very fast
program execution
 Most production implementations of languages, such as C, COBOL, and C++, are by compilers.
 The language that a compiler translates is called the source language
 The lexical analyzer gathers the characters of the source program into lexical units
 The syntax analyzer takes the lexical units from the lexical analyzer and uses them to construct
hierarchical structures called parse trees

Pure Interpretation

 Pure interpretation lies at the opposite end (from compilation) among implementation
methods.
 The interpreter program acts as a software simulation of a machine whose fetch-execute cycle
deals with high- level language program statements rather than machine instructions.
 Pure interpretation has the advantage of allowing easy implementation of many source-level
debugging operations, because all run-time error messages can refer to source- level units

Hybrid Implementation Systems

 Some language implementation systems are a compromise between compilers and pure
interpreters; they translate high-level language programs to an intermediate language
designed to allow easy interpretation. This method is faster than pure interpretation
because the source language statements are decoded only once. Such implementations are
called hybrid implementation systems.

Preprocessors

 A preprocessor is a program that processes a program just before the program is compiled.
 Preprocessor instructions are commonly used to specify that the code from another file is to
be included. For example, the C preprocessor instruction
#include "myLib.h"
causes the preprocessor to copy the contents of myLib.h into the program at the position of
the #include.

Programming Environment
 A programming environment is the collection of tools used in the development of software.
 . This collection may consist of only a file system, a text editor, a linker, and a compiler. Or it
may include a large collection of integrated tools, each accessed through a uniform user
interface.
several programming environments
UNIX
 UNIX is an older programming environment, first distributed in the
middle 1970s, built around a portable multiprogramming operating
system.
 It provides a wide array of powerful support tools for software
production and maintenance in a variety of languages.
BORLAND JBUILDER

 Borland JBuilder is a programming environment that provides an


integrated compiler, editor, debugger, and file system for Java
development, where all four are accessed through a graphical
interface. JBuilder is a complex and powerful system for creating
Java software.

MICROSOFT VISUAL STUDIO

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy