This covers material from Chapter 1, with
- 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?
- Functional (Applicative)
- Logic (Rule-based; Declarative)
- Programming Language History.
- Fig. 1.2.
- The Patriarchs.
- FORmula TRANslator: Expressions.
- Rest of language reflects hardware.
- No block control constructs: Conditional GOTOs.
- Early-Style Fortran Program'
- Fixed format: Designed for punched cards.
- Record data structure.
- Verbose assembly language.
- Also fixed format for punched cards.
- Simple Example
(off-site, U. of Limerick).
- Record Example
(off-site, U. of Limerick).
- 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.
- Something like exceptions.
- Example (off-site, IBM).
- Pascal - Less is more.
- Data structures to fit problem.
- Day of the week,
- Ada - No, its not. Another kitchen sink language.
- Modular programming.
- Rational Mod,
- The Black Sheep
- C — For OS.
- C++ Kitchen sink again.
- Java — C++ minus the crud.
- And many more.
- 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.
- Too early: Not based on experience.
- Too late: Too much divergence.
- Corporation (e.g., Java).
- Voluntary Committee (e.g., C++). Herding cats
- Government as buyer (Ada).
- 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.
- 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.
- Orthogonality —
Every combination of features is meaningful.
- Execution (most important).
- Avoid arbitrary limits.
MacLennan: The only reasonable numbers are zero, one and infinity.
- 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
- 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.
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
- Notably Lisp.
- Many interpreted languages allow you to construct code in a
string and execute it.