Chapter 1 PL
Chapter 1 PL
Chapter 1 PL
Preliminaries
Jhune Hay L. Mitra
Instructor 1
Reason for Studying Concepts of
Programming Language
Increased ability to express ideas
Improved background for choosing appropriate languages
Increased ability to learn new languages
Better understanding of significance of implementation
Better use of languages that are already known
Overall advancement of computing
Programming Domains
Scientific Applications
Have a simple Data Structure like arrays and matrices.
Have control structures such as counting loops and selections.
Require large numbers of floating point arithmetic computations
Some languages designed for this were Fortran, Algol60.
Programming Domains
Business Application
Need Production of elaborate reports
Precise ways of describing and storing decimal numbers and
character data.
Have Ability to specify decimal arithmetic operations
Some of languages designed for this were COBOL and SAS
Programming Domains
Artificial Intelligence
Use of linked lists is preferred over arrays
Required more flexibility
A language designed specifically for this is LISP
Programming Domains
System Programming
Must have execution efficiency
Must have low-level features that allow software interface to external
devices to be written.
Some languages designed for this were PL/1, Bliss, and C
Programming Domains
Web Software
Eclectic collection of languages: markup (e.g., XHTML,
HTML), scripting (e.g., PHP), general-purpose (e.g., Java)
Language Criteria
Readabilityis the ease of which programs can read and understood
and can be directly related to:
The Overall simplicity, which can be determined by number of basic
components and whether is has one or more ways to accomplish a
particular operation.
The Orthogonality, which is the degree to which a set of primitive
constructs can be combined to build the control and data structures of
the language.
The number of control statements in a language.
Then number of data types and structures.
The Syntax or form of the elements of a language. Three types of syntax
after readability: Identifier forms, special words, and form and meaning
Language Criteria
Writability
is a measure of how easily a language can be
used to create programs for a chosen problem domain and
can be directly related to:
Simplicity and Orthogonality (Defined in readability)
Support Abstraction, which is the ability to define and use
complicated structures or operations in a way that allows many
details to be ignored
Expressivity, which is when a language has a convenient way
of specifying computations.
Language Criteria
Reliability
is when a language performs to its specifications
under all conditions and is directly related to:
Type Checking, which is simple testing for type errors in a
program either by the compiler or run-time.
Exception handling, which is the ability of a program to intercept
run-time errors, take corrective action, and then continue on
Aliasing, which is having two or more distinct referencing
methods or names for the same memory location
Influences on Language Design
Other factors may also influence the design of a
programming language
Computer Architecture
Programming Methodologies
Influences on Language Design
Other factors may also influence the design of a programming
language
Computer Architecture
Languages are developed around the prevalent computer architecture,
known as the von Neumann architecture
Programming Methodologies
New software development methodologies (e.g., object-oriented
software development) led to new programming paradigms and by
extension, new programming languages
Language Categories
Imperative
Central features are variables, assignment statements, and iteration
Include languages that support object-oriented programming
Include scripting languages
Include the visual languages
Examples: C, Java, Perl, JavaScript, Visual BASIC .NET, C++
Functional
Main means of making computations is by applying functions to given
parameters
Examples: LISP, Scheme
Logic
Rule-based (rules are specified in no particular order) Example:
Prolog
Markup/programming hybrid
Markup languages extended to support some programming. (HTML,
XML) Examples: JSTL, XSLT
Language Design Trade-Offs
Some of the criteria used to rate languages are themselves
conflicting; the increase of one generally means that the other
is degenerate, some of these conflicts are as follows:
Reliability
vs. Cost of Execution if the program is reliable it probably
executes slowly and vice versa.
Examples: Java demands all references to array elements
be checked for proper indexing, which leads to increased
execution costs
Language Design Trade-Offs
Readability vs. writability - if the program is readable it is
probably not as writable and vice versa.
Example: APL provides many powerful operators (and a large
number of new symbols), allowing complex computations to
be written in a compact program but at the cost of poor
readability
Writability (flexibility) vs. reliability - if the program is flexible it
is probably not as reliability and vice versa
Example: C++ pointers are powerful and very flexible but are unreliable
Language Design Trade-Offs
Readability vs. writability - if the program is readable it is
probably not as writable and vice versa.
Example: APL provides many powerful operators (and a large
number of new symbols), allowing complex computations to
be written in a compact program but at the cost of poor
readability
Writability (flexibility) vs. reliability - if the program is flexible it
is probably not as reliability and vice versa
Example: C++ pointers are powerful and very flexible but are unreliable
Implementation Methods
Compilation Programs are translated into Machine
language.