Programming Language Design Issues Programming Languages – Principles and Practice by Kenneth C Louden
Programming Language Generations First Generation: Assembly language Second Generation: Unstructured high-level Languages e.g. Fortran Third Generation: Structured high-level languages e.g. Pascal, C, C++, Ada Fourth Generation: Application-specific languages for building database-oriented systems Fifth Generation: Very high-level languages, especially logic programming languages and other declarative languages. e.g. Prolog
Imperative versus Declarative Languages Imperative programming ◦ Comprises a sequence of commands imperatives Declarative programming ◦ Declare what results we want and leave the programming language to figure out how to produce them Declarative = “What” Imperative = “How”
Computational Paradigms Imperative/procedural Object-oriented Functional Logic
What Makes a Good language? Page 57 Louden Human criteria ◦ Learnability: Is language easy to learn and remember ◦ Writable: Easy to write correct programs ◦ Readable: Easy to understand programs ◦ Maintainable: Easy to change programs
What Makes a Good Language… Computer Criteria ◦ Implementable: Can language be implemented ◦ Efficient: Are programs translated and executed fast enough ◦ Portable: Is language available on most computers?
Learnability Simplicity. ◦ Simple syntax and semantics. Familiarity. ◦ Should use standard notations whenever possible. Uniformity. ◦ Language constructs that are similar should look and behave similarly. ◦ Constructs that are different should look different. Design goals for making languages easier to learn and remember:
Learnability… Orthogonality ◦ Language constructs can be combined in any meaningful way and should not interact in unexpected ways. Generality ◦ Have one general construct rather than several specific ones. Avoid restricting the ways constructs can be used. Preciseness ◦ Is the language precisely defined? ◦ ANSI/ISO. ◦ Does it have a formal semantics? Validation suites?
Writability Expressiveness ◦ Allows programs to be written in the most natural way. E.g. Build up high-level abstractions Error prevention ◦ Language makes some kinds of errors impossible Error Detection ◦ Language allows errors to be found and reported. E.g. array bounds checking, arithmetic overflow Language design goals for writability include:
Readability/Understandability Expressiveness ◦ Can also improve readability if the programmer has used it wisely Document support ◦ Essential for understanding large programs Language Environment ◦ e.g. browsers, cross-reference tools, pretty printers, debuggers Most of the learnability design goals help readabilty:
Maintainability Machine Independence ◦ Ban or isolate machine-specific features Modularity ◦ Good modularity constructs allow one part of a program to be changed without impacting other parts In addition to the readability and writability design goals, design goals that improve readability include: