Programming Languages
1
Language Design Issues
Chapter 1
2
Why study Programming Language Concepts?
• To improve your ability to develop effective
algorithms
• To improve your use of your existing programming
language
• To increase your vocabulary of useful programming
constructs
• To allow a better choice of programming language
• To make it easier to learn a new language
• To make it easier to design a new language
3
A Short History Of Programming Languages
Development of Early Languages
– Numerically based languages
– Business languages
– Artificial-intelligence languages
– Systems languages
4
A Short History Of Programming Languages
Evolution of Software Architectures
– Mainframe Era (1940s -1970s)
• Batch environments
• Interactive environments
• Effects on language design
– Personal Computer Era
• Personal computers
• Embedded-system environments
• Effects on language design
5
A Short History Of Programming Languages
Evolution of Software Architectures
– Networking Era
• Distributed computing
• Internet
• Effects on language design
6
A Short History Of Programming Languages
Application Domains
– Applications of the 1960s
• Business processing
– Storage, retrieval, and formatting of data, reporting (COBOL)
• Scientific
– Heavily based on numerical algorithms (Fortran, C)
• System
– Fast, Low level features (C)
• Artificial Intelligence
– Symbolic computing, List directed processing (LISP, Prolog)
7
A Short History Of Programming Languages
Application Domains
– Applications of the 21st Century
• Business processing
• Scientific
• System
• Artificial Intelligence
• Publishing: TeX, Postscript
• Process: Perl, Javascript
• New paradigms: Python, R
8
Role Of Programming Languages
Older languages have been periodically revised
over time, influenced by the following factors:
• Computer capabilities
• Applications
• Programming methods
• Implementation methods
• Theoretical studies
• Standardization
9
Role Of Programming Languages
Attributes of a Good Language
• Clarity, simplicity, and unity
• Orthogonality
• Naturalness for the application
• Support for abstraction
• Ease of program verification
• Programming environment
• Portability of programs
• Cost of use
– Cost of program execution
– Cost of program translation
– Cost of program creation, testing
– Cost of program maintenance 10
Role Of Programming Languages
Syntax and Semantics
• The syntax of a programming language is what the program
looks like.
• The semantics of a programming language is the meaning
given to the various syntactic constructs.
• Declare a 10-element vector, V, of integers
• in C int V[10];
• in Pascal V: array[0 .. 9] of integer;
11
Role Of Programming Languages
Language Paradigms
➢ Imperative languages
• Statement oriented languages
• Every statement changes the machine state
• Computation is expressed by a sequence of actions.
• Heavily based on von Neumann architecture
• Provides variables, assignments, and iterative repetitions.
• Examples: Fortran, C
➢ Applicative languages (Functional programming)
• Problem specification using functions.
• Applying functions to given parameters.
• Examples: LISP, ML
functionn(... function2(function1(data)) ... ) 12
Role Of Programming Languages
Language Paradigms
➢ Rule-based languages
• Problem specification using relations: execute by checking for the
presence of a certain enabling condition and, when present,
executing an appropriate action.
• Logic programming (deductive reasoning, rule based)
• Examples: Haskell, Prolog
enabling condition1 → action1
enabling condition2 → action2
enabling conditionn → actionn
13
Role Of Programming Languages
Language Paradigms
➢ Object-oriented programming
• Based on the concept of data abstraction.
• Uses encapsulation (data hiding)
• Supports inheritance (software reuse)
• Suitable for programming in the large.
• Examples: C++, Java
14
Role Of Programming Languages
Language Paradigms
15
Role Of Programming Languages
Language Standardization
Three approaches when the meaning of a statement is
not clear:
➢ Read the definition in the language reference manual to decide what the
statement means.
➢ Write a program on your local computer system to see what happens.
➢ Read the definition in the language standard.
Standards generally come in two flavors:
• Proprietary standards:
– These are definitions by the company that developed and owns the language
• Consensus standards (standards):
– These are documents produced by organizations based on an agreement by the
16
relevant participants
Role Of Programming Languages
Language Standardization
Three issues that should be considered for using
standards effectively:
➢ Timeliness: When do we standardize a language?
➢ Conformance: What does it mean for a program to adhere to a standard
and for a compiler to compile a standard?
➢ Obsolescence: When does a standard age, and how does it get
modified?.
17
Role Of Programming Languages
Internationalization
Collating sequences: In what collating sequence should the characters
be ordered?
• The position of non-Roman characters, such as Ä, Ö, Ñ
Country-specific date formats: 11/26/02 in the United States is
26/11/02 in England.
Country-specific time formats: 5:40 p.m. in the United States is
17:40 in Japan
Time zones
Ideographic systems
Currency
18
Programming Environments
Effects on Language Design
Separate compilation: When developing large programs, it's likely
that various programmers or programming groups will individually design,
code, and test different components of the program.
Testing and debugging: Features to aid program testing and
debugging
➢ Execution trace features
➢ Breakpoints
19
Programming Environments
Environment Frameworks
• Collection of tools used in the development of
software.
• Consists of a text editor, linker, compiler, debugger,
and development tools.
20