180 likes | 274 Views
Reasons to study concepts of PL. Increased capacity to express programming concepts Improved background for choosing appropriate languages Increased ability to learn new languages Understanding the significance of implementation Increased ability to design new languages
E N D
Reasons to study concepts of PL • Increased capacity to express programming concepts • Improved background for choosing appropriate languages • Increased ability to learn new languages • Understanding the significance of implementation • Increased ability to design new languages • Overall advancement of computing
Programming Domains • Scientific applications • Business applications • Artificial intelligence • Systems programming • Scripting languages • Special purpose languages
Language Evaluation Criteria 1. 2. Writability - Factors: - 3. Reliability - Factors: - • Readability • Writability • Reliability • Cost • others
Readability • The most important criteria • Factors: • Overall simplicity • Too many features is bad • Multiplicity of features is bad • Orthogonality • Control statements • Data type and structures • Syntax considerations
Orthogonality • Makes the language easy to learn and read • Meaning is context independent • Small number of constructs for generating many structures. • int, float, double, arrays and pointers ==> ? • Few exceptions to rules: e.g. why can function return a struct, but not an array? Why are all parameters pass-by-value, except arrays?
Writability • Simplicity and orthogonality • No duplication • Avoid too much complexity; so many constructs, most users don’t know what to use • Support for abstraction • Subprograms, structures • Expressivity • for vs. while, ++ vs. + 1
Reliability • Program should perform to specs under all conditions • Type checking of parameters, out-of-range errors • Exception handling • Aliasing • Generally bad, but can be useful for pass-by-reference • Readability and writability • Contorting the language to achieve an end can lead to errors.
Cost • Programmer training • Software creation • Compilation speed • Execution speed • Compiler cost (Java vs. Pascal) • Poor reliability • Maintenance
Other Evaluation Criteria • Portability • Generality • Well-definedness
Influences on language design • Computer architecture • We use imperative languages, at least in part, because we use von Neumann machines • Programming methodologies • 1950s and early 1960s: Simple applications; worry about machine efficiency • Late 1960s: People efficiency became important; readability, better control structures • Late 1970s: Data abstraction • Middle 1980s: Object-oriented programming • Early 1990s: Code re-use and libraries
Language Categories Language Design Trade-offs 1. Implementation Methods 1. • Imperative • Functional • Logic • Object-oriented (closely related to imperative) • Mark-up languages (html) don’t describe computations, so don’t count
Language Design Tradeoffs • Reliability versus cost of execution • Writability versus readability • E.g: APL • Flexibility versus safety • E.g: PASCAL allows pointers and integers to be treated identically. Good for pointer calculations, but dangerous.
Implementation Methods • Compilation • Interpretation • Hybrid
Compiled languages • Translate high-level program to machine code • Slow translation • Fast execution
Pure interpretation • No translation • Slow execution • Becoming rare • Though, see Python and Java!
Hybrid implementation systems • Small translation cost • Medium execution speed
Programming Environments • The collection of tools used in software development • UNIX • An old operating system and tool collection • Borland C++ • A PC environment for C and C++ • Smalltalk & Lisp • A language processor/environment • Microsoft Visual C++ • A large, complex visual environment
2. Chapter 1