01 Chapter 01
01 Chapter 01
Preliminaries
ISBN 0-321-19362-8
Introduction
Learning Outcomes:
By the end of this module you will be able to:
1. describe the reasons for studying programming languages
2. recognize and compare programming languages evaluation
criteria
3. identify some trade-offs in language design
4. explain the relative merits and demerits of compiled and
interpreted languages
• Motivation
• Programming Domains
• Language Evaluation Criteria
• Influences on Language Design
• Language Categories
• Language Design Trade-Offs
• Implementation Methods
• Programming Environments
/* Program in Language A */
c = 0;
for(int i=0; i<n; i++)
c = c + V[i] * W[i];
System.out.println(c);
/* Program in Language B */
INNERPROD <- + / V x W
• Portability
– Ease of moving programs from one implementation to
another
• Generality
– Applicability to a wide-range of applications
• Well-definedness
– Completeness and precision of the language’s defining
document
Memory Variables
Load Variable evaluation
Store Assignment
Conditional goto Control structure
3. Logic
– Rule-based
– Rules are specified in no special order
– Example: Prolog
4. Object-oriented
– Encapsulate data objects with processing
– Inheritance and dynamic type binding
– Grew out of imperative languages
– Examples: C++, Java, C#
• Compilation
– Translate high-level
program to machine code
– Slower translation
– Faster execution
– Lack of portability
• Pure interpretation
– No translation
– Slow execution (10-100
time slower than
compilation)
– Becoming rare
– Requires more space since
the symbol table must be
available during
interpretation
– Examples: APL, LISP,
JavaScript, PHP
• Hybrid implementation
systems
– Small translation cost
– Medium execution speed
– Faster than pure
interpretations because
high level language
statements are decoded
only once
– Examples: Perl, Java