Augustana University College

COMPUTING SCIENCE 370
Programming Languages


Fortran -- Data Structures and Name Structures



Data Structures


Abstract Data Type
A set of data values, together with a set of operations on those values, that is defined without reference to the representation of the data values

Mathematics: integers are a subset of reals, which are a subset of complex numbers.

Computer arithmetic (typical):


Arrays


ZERO-ONE-INFINITY PRINCIPLE
The only reasonable numbers in a programming language design are zero, one, and infinity.

Name Structures

Context (environment)
The set of declarations that are visible to a construct.
Scope of the binding of a name
The region of the program over which the binding is visible.
Aliasing
Binding more than one name to the same memory location.
  1. Implicit aliasing using a COMMON block.
    E.g.,
    SUBROUTINE ARRAY2 (N, L, C, D1, D2)
    COMMON /SYMTAB/ NAMES(100), LOC(100), TYPE(100), DIMS(100)
      :
    END
    
    SUBROUTINE VAR (N, L, C)
    COMMON /SYMTAB/ NM(100), WHERE(100), MODE(100), SIZE(100)
      :
    END
    
    or even
    COMMON /B/ M, A(100)
    
    and
    COMMON /B/ X, K, C(50), D(50)
    
    B
    M   X
    A(1)   K
    A(2)   C(1)
    :       :       :
    A(51)   C(50)
    A(52)   D(1)
    :       :       :
    A(100)   D(49)
        D(50)

  2. Explicit aliasing using EQUIVALENCE
    E.g.,
    DIMENSION A(100), B(50)
    EQUIVALENCE (A(40), B(1))
    

Copyright © 2000 Jonathan Mohr