EEN519 Study Guide (19th November 1998)
- Traditional Fortran:
- General syntax
- Primitive design decisions and the problems they cause:
- automatic declarations, ignoring spaces, no reserved words, etc.
- Basic Statements and Data types: how to write programs
- Memory management
- static activation records allocated by compiler
- impossibility of recursion
- impossibility of global variables
- common blocks
- mechanism of subroutine and function call
- call by reference vs. Call by value
- Characteristics of variables:
- Static vs. Dynamic / Stack vs. Heap Allocation
- Free vs. Bound
- Contents of an activation record
- Static link and Dynamic link
- Problems with Dynamic Free variables
- Stack Frame as implementation of Activation Records
- Local variable access relative to Frame Pointer
- Scope and Extent
- Dangling References (problems of, and how to avoid them by sensible language design)
- Caused by function-type variables and nested functions in the same language
- Caused by generating pointer to local variable
- Parameter passing methods:
- call by Value
- call by Reference
- call by Result
- call by Value-Result
- call by Constant
- and their main features:
- efficiency, simplicity, potential for aliassing
==================== First Test, 1st October ==============================
- Grammars and Syntax
- BNF meta-language for describing the syntax of languages
- Ambiguity
- Exactly what it means
- Common examples of ambiguous programming language definitions
- The "Dangling Else" problem, and the various ways it is fixed
- Grammars for expressions that specify order of evaluation
- The power of a programming language
- Proving that every structured program can be written in an unstructured language
- Proving that every unstructured program can be written in a structured language
- i.e. as far as expressing algorithm structure is concerned, C and Fortran are equal
- Implementing recursion in languages that do not support it
- Implementing data structures in languages that do not support them.
- What the real differences between Fortran and C are:
- (technical): no dynamic allocation in Fortran,
- so recursion/data structure schemes will fail for large inputs
- (practical): C is a higher level, more abstract language,
- so programming is easier and therefore more reliable
- Prolog - A very high level language
- General idea: just express your design as logical rules, no algorithm needed
- Be able to write Prolog definitions for simple-ish logical rules,
- Be able to understand Prolog definitions written by others.
- Strengths and limitations: The problem of negation.
- Co-routines
- The general idea:
- functions that can return control without exiting
- (recall the enumeration/operation in charge example)
- The need to maintain a separate stack space for each coroutine
- How they are programmed:
- start and resume as fundamental operations
- co-routines almost act as parallel/concurrent threads of execution
==================== Second Test, 24th November ==============================
- Compilers
- General structure
- Design of principal parts
- Lisp (possibly, just the very basics)
=============== Final Examination, 2pm Thursday 10th December ================