Page 139 - Standard Handbook Of Petroleum & Natural Gas Engineering
P. 139

124   Mathematics

                                              Pascal Language

                      Pascal names (of units, variables, array elements, etc.), consisting of  an initial
                    letter followed by  letters or digits,  may be as long as needed in standard Pascal;
                    however,  in  practice,  most  compilers require  that  a  name  be  unique  within  a
                    certain number of characters.  (See Table  1-28 for reserved words which may  not
                    be  used  as  names.)

                    Data Types  (Data  structures  of  all  types,  predefined  and  user-defined, must
                    be  declared; see “Statements” for  type  declaration form.)

                      Integer-Predefined,  scalar (ordered) type  with  a  machine-dependent  limit,
                    predeclared  as  a constant MAXINT.
                      Real-Predefined  scalar type,  decimal, or scientific  notation  may  be  used.
                      Boolean-Predefined  logical  type,  ordered  so  that  false  <  true.
                      Char-Predefined  character type,  ordered  by  code.  (See  Table  1-22 for  two
                    common code sets.)
                      User-defined-See  “Statements.”
                    Data Structures

                      Constant-Type  and value assigned  at declaration, and once defined, neither
                    type  nor value  may  be  changed.
                      Variable-Type  assigned at declaration  and may not be changed; value assigned
                    by  a numerical  or character  constant, by  input  or by  an expression.
                      Array-May  have  more than one dimension; number of  dimensions and type
                    are assigned at declaration and may  not be changed; values are assigned to array
                    elements (which must  be  of  same type) as  they  are  to variables.
                      Packed  array-Produces  more  efficient use  of  memory, but  slower  program
                    execution than  a  regular array.
                      Record-The  elements (fields) may be of different types and may be  accessed
                    at  random; fields and  their  types  are  assigned  at  declaration  and  may  not  be
                    changed; field values  are  assigned as  are variable  values.
                      File-Composed  of  elements (which may  be records or other data structures)
                    of  the  same  type;  sequential  files  only  in  standard  Wirth  Pascal;  external
                    (physical) files  (for input  and  output)  must  be  declared  with  the  program
                    heading (see “Statements”) and internal (temporary) files may  be added for use
                    within  the program; all  files except INPUT and OUTPUT  must  be declared in
                    TYPE  and/or  VAR  sections.
                      Set-Type  must  be  ordinal; must  be  processed  as  whole  (cannot be  broken
                    down  into elements).

                                                 Table  1-28
                                           Pascal Reserved Words
                    and           array          begin          case             const
                    div           do            downto          else             end
                    file          for           function        got0             if
                    in            label          mod            nil              not
                    of            or             packed         procedure        program
                    record        repeat         set            then             to
                    type          until         var             while            with
   134   135   136   137   138   139   140   141   142   143   144