Date: Tue, 10 Dec 1996 03:29:33 GMT Server: NCSA/1.4.2 Content-type: text/html Recent ZPL Language Changes

Recent ZPL Language Changes


The changes below are effective July 25, 1996.

The newly installed version of ZPL is improved in two ways: A multitude of small language changes have been incorporated to make the language more convenient/powerful, and many bugs have been fixed. The resulting compiler is considerably more stable, and the language is more convenient. However...

MOST EXISTING ZPL PROGRAMS WILL HAVE TO CHANGE SOMEWHAT.

Though possibly causing some inconvenience for the moment, this is a one-time change. ZPL is essentially stable, with all subsequent research being applied to a new language.

The following language feature changes will likely require modifications to existing programs:

  1. Some data type have been introduced, eliminated, or renamed. Signed and unsigned byte data types are now supported (sbyte and ubyte), and unsigned char no longer exists. The unsigned data types have been renamed as summarized below.
            unsigned shortint ---> ushortint
            unsigned integer  ---> uinteger
            unsigned longint  ---> ulongint
    
  2. Exponentiation added. The binary operator ^ has been added. The expression a^b raises a to the b power. The compiler generates a direct evaluation when b is an integer constant 2, 3 or 4. All other cases compile to a call on pow(). The functions sqr() and cube() have been removed.

  3. Bit operations have been changed.
            &  --->  band(a,b)     bitwise and of integers a, b
            |  --->  bor(a,b)      bitwise or of integers a, b
            ~  --->  bnot(a)       bitwise negation of integer a
            ^  --->  bxor(a,b)     bitwise exclusive or of integers a, b
            << --->  bsl(a,b)      integer a left shifted b bit positions
            >> --->  bsr(a,b)      integer a right shifted b bit positions
    
  4. Logical operations have been changed.
            and ---> &
            or  ---> |
            (! continues to be correct for logical negation)
    
  5. Compound assignments <<= and >>= have been removed.

  6. Double brackets may optionally be removed in most instances. Dynamic region specifiers not involving prepositions do not require double brackets. Thus
            [[1..m, i..n]]  --->  [1..m, i..n]
            [[1..m, *]]     --->  [1..m, *]
    
    but
            [[1..m,i..n] at west]
            [[1..m, 1..n] with M]
    
    require both sets of brackets. This is not yet implemented.

  7. Rank-defined arrays in procedure specifications have been replaced with dynamic regions that inherit their dimension information from the call site. Thus
            procedure Example (X, Y:[2] float);
    
    becomes
            procedure Example (X, Y:[,] float);
    
    The inheritance capability is available with all region specifications -- empty dimensions are inherited from the enclosing scopes.

  8. Reduce, scan and flood operators have changed
            Reduce   +\  --->  +<<
            Scan     +\\ --->  +||
            Flood    \\\ --->  >>
    
    The heuristic here is that the result of reduce (<<) is "smaller" than the operand, the result of scan (||) is the same size as the operand, and the result of flood (>>) is "larger" than the operand.

  9. Region change removed. The region change construct, used to specify the regions for partial reduce and flood, has been removed. Thus, the "left arrow" construct
            [R <- S]  A := ...;
    
    is no longer legal. Accordingly, the partial reduce and flood operators have changed in that both specify a region following the operator which describes the operand. This region, together with the region "on the statement" which describes the result, supply the needed region information for these operations.

    Thus, for example in the partial reduction

    	[1..n, 1]  A := +<<[1..n,1..m] B;  --Sum B's rows, store in A's col 1
    
    the region following the operator is the region of the operand, i.e. the region to be reduced. The region on the statement specifies the result region, which since relative to the operand region it has the second as a collapsed dimension, the elements of each row are added, and the result is stored into the first column of A.

    Similarly, for the flood

    	[*,1..m]  Fl := >>[3,1..m] A; -- Replicate A's 3rd row into Fl
    
    the region following the operand specifies the array to be replicated, and the region on the statement specifies the region of the result. So, relative to the result region the first dimension is collapsed.


    [ ZPL | UW CSE | UW ]
    zpl-info@cs.washington.edu