Ch. 1: Overview and History
This covers material from Chapter 1, with
various additions.
- Principles
- Syntax: What is a legal program?
- What symbols are used?
- How must they be arranged?
- Names and types.
- What names can we use?
- What type of data can we store?
- How do we decide all that?
- Semantics: What does a program mean?
- Paradigms
- Imperative.
- Object-Oriented
- Functional (Applicative)
- Logic (Rule-based; Declarative)
- Programming Language History.
- Fig. 1.2.
- The Patriarchs.
- FORTRAN
- FORmula TRANslator: Expressions.
- Rest of language reflects hardware.
- No block control constructs: Conditional GOTOs.
- Early-Style Fortran Program
- Fixed format: Designed for punched cards.
- COBOL
- Record data structure.
- Verbose assembly language.
- Also fixed format for punched cards.
- Simple Example (off-site).
- Record Example (off-site).
- Algol
- Fluid format.
- Block structure.
- An Algol Program
- More popular to swipe ideas from than actually use.
- Algol's Children
- PL/I. Everything but the kitchen sink.
- Pointers.
- Something like exceptions.
- Pascal - Less is more.
- Data structures to fit problem.
- Some Pascal Programs
- Ada - No, its not. Another kitchen sink language.
- Modular programming.
- Generics
- Some
Examples
- The Black Sheep
- C — For OS.
- C++ Kitchen sink again.
- Classes.
- Generics.
- Java — C++ minus the crud.
- Design Constraints.
- Hardware archtecture.
- Programming languages need to run on a computer.
- Took a while for languages to escape being ruled by architecture.
- Then they took over.
- CISC machines to represent high-level constructs in hardware.
- Stack machines to model Algol-style scope.
- Lisp machines to run Lisp.
- RISC machines considered best.
- Technical setting.
- Operating system environment.
- Purpose
- General
- Special
- Standards.
- When?
- Too early: Not based on experience.
- Too late: Too much divergence.
- Who?
- Corporation (e.g., Java).
- Voluntary Committee (e.g., C++). Herding cats
- Government as buyer (Ada).
- Legacy.
- Re-writing a working program is very expensive.
- Old languages tend to live forever.
- Attributes of a Good Language. (Some listed beyond what's in your book.)
- Simplicity and Readability.
- Can tell what a construct means.
- Easy to tell what a data are effected.
- Similar-looking things have similar operations.
- Reliability.
- Learnability.
- Access to compilers.
- Access to tutorial information.
- Abstraction Support. Collect code to perform a specific task which
can be used as a single object.
- Compound data structures.
- Functions and procedures.
- Modules.
- Objects.
- Orthogonality —
Every combination of features is meaningful.
- Efficiency
- Translation.
- Execution (most important).
- Avoid arbitrary limits.
MacLennan: The only reasonable numbers are zero, one and infinity.
- Portability.
- Binding.
- Binding: The fixing of some property for some feature of the language.
- Binding time: When binding is done.
- Execution time (run time).
- At start of execution.
- At function entry.
- At any point during execution.
- Translation time (compile time).
- Chosen by the programmer (“Program writing time.”)
- Chosen by the translation system.
- Implementation time: Chosen by the compiler writer.
- Language definition time: Chosen by the language designer.
- Binding Time Examples
- Machines
- Real hardware.
- Virtual machine (e.g., JVM).
- Language system must get the source program to execute on the machine.
- Translation and Interpretation.
- Translate from source to machine language.
- Interpret the program: Read it and do likewise.
- Practical systems are a mix.
↓ C
↓ Java
Python ↓
TranslationInterpretation
↑ C++
Shell Scripts/BAT files ↑
- Interpreted programs typically have later binding.
- Equivalence of Program and Data.
- Your program is data to the machine that runs it, or the compiler
that translates it.
- Any program that takes input is an interpreter for its input language.
- In some languages, you can build a program as a data structure, then
run it.
- Notably Lisp.
- Many interpreted languages allow you to construct code in a
string and execute it.