PZ's Apple IIGS Programming Software Pages

Complete Pascal (Formerly TML Pascal II)


Description - History - Downloads - Resources - Extensions

   *This document is taken from the Appendix of the original TML Pascal v1.0 manual. There have been several revisions to the language since, however most of these still apply to Complete Pascal v2.0. For additional clarification see Appendix E of the TML Pascal II Reference Manual.

Comparing TML Pascal with ANSI Pascal

This appendix compares TML Pascal with the American National Standard Institute (ANSI) Pascal as defined by ANSI/IEEE770X3.97-1983 in the book American National Standard Pascal Computer Programming Language (ISBN 0-471-88944-X, published by The Institute of Electrical and Electronics Engineers in New York).

Extensions to ANSI Pascal

The following TML Pascal features are extensions to Pascal as specified by ANSI/IEEE770X.97-1983.
  • Additional reserved words in TML Pascal:

    body    interface    unit       implementation
    uses    otherwise    strings

  • An identifier may contain underscore characters after the first character.

  • Integer constants may be written in hexadecimal notation. Such constants are prefixed by a $.

  • String constants are compatible with the TML Pascal string types.

  • Label , constant, type, variable, procedure, and function declarations may occur any number of times in any order in a block

  • A signed constant identifier may denote a value of type Integer, LongInt, or Extended.

  • TML Pascal implements the additional integer type LongInt, and the additional real types Single, Double, Comp, and Extended.

  • Arithmetic operations on Integer operands produce Integer results. Arithmetic on LongInt operands or mixed Integer and LongInt operands produce LongInt results. LongInt values are compatible with the Integer type provided they are in the Integer range.

  • Arithmetic operations on real type operands or mixed integer type and real type operands produce Extended values. Extended values are compatible with the Single, Real, Double, and Comp, types provided they are in the range of those types.

  • TML Pascal implements string types, which differ from the packaged string types defined by ANSI Pascal in that they include a dynamic length attribute that may vary during execution.

  • The type compatibility rules are extended to make char types and packaged sting types compatible with string types.

  • String type variables can be indexed as arrays to access individual characters in a string.

  • The type of a variable reference can be changed to another type though a variable type cast.

  • The relational operators can be used to compare stings.

  • TML Pascal implements the @ operator, which is used for obtaining the address of a variable or a procedure of function.

  • The type of an expression can be changed to another type though a value type cast.

  • The case statement allows an optional otherwise part.

  • TML Pascal implements Units, Unit Specifications and Unit Bodies to facilitate modular programming and separate compilation.

  • TML Pascal implements the following file handling procedures and functions, which are not available in ANSI Pascal:

    Close    Rename      Seek
    Erase    IOResult    File Pos

  • String type values may be input and output with the Read, ReadLn, Write, and WriteLn standard procedures.

  • TML Pascal implements the following standard procedures and functions, which are not found in ANSI Pascal:

    Exit    Length    Pointer     MoveRight   HiWord
    Halt    Cycle     Insert      MoveLeft    LoWord
    Ord4    Concat    SizeOf      ScanEQ      Inc
    Copy    Delete    FillChar    ScanNE      Dec
    Pos     Leave     IsToolError

Exceptions to ANSI Pascal Requirements

  • In ANSI Pascal, an identifier may be of any length and all characters are significant. In TML Pascal, an identifier may be of any length, but only the first 255 characters are significant. Note that most editors restrict line lengths to at least this length.

  • In ANSI Pascal, the @ symbol is an alternative for the ^ symbol. In TML Pascal, the @ symbol is an operator.

  • In ANSI Pascal, a comment may begin with { and end with *), or begin with (* and end with }. In TML Pascal, comments must begin and end with the same set of symbols.

  • In ANSI Pascal, a file variable has an associated buffer variable, which is referenced by writing the ^ symbol after the file variable. In TML Pascal, a file variable does not have an associated buffer variable, and writing the ^ symbol after a file variable is an error.

  • In ANSI Pascal, the statement past of a function must contain at least one assignment to the function identifier. In TML Pascal, this requirement is not enforced.
  • In ANSI Pascal, a field that is the selector of a variant part may not be an actual variable parameter. In TML Pascal, this requirement is not enforced.

  • In ANSI Pascal, procedures and functions allow procedural and functional parameters; these parameters are not implemented in TML Pascal.

  • In ANSI Pascal, the standard procedures Reset and Rewrite take only one parameter, a file variable. In TML Pascal, Reset and Rewrite allow an optional second parameter, a string type expression, which names an external file.

  • ANSI Pascal defines the standard procedures Get and Put, which are used to read from and write to files. These procedures are not defined in TML Pascal.

  • In ANSI Pascal, the standard procedures Read and Write are defined in terms of Get and Put and are references to buffer variables. In TML Pascal, Read and Write function as in ANSI Pascal, but they are automatic operations.

  • In ANSI Pascal, the syntax New(p,cl,...,cn) creates a dynamic variable with a specific active variant. In TML Pascal, this variation of the New procedure is not allowed.

  • In ANSI Pascal, the syntax Dispose(q,kl,...km> removes a dynamic variable with a specific active variant. In TML Pascal, this variation of the Dispose procedure is not allowed.

  • ANSI Pascal defines the standard procedures Pack and Unpack, which are used to "pack" and "unpack" packed variables. These procedures are not defined in TML Pascal.

  • In ANSI Pascal, a goto statement within a block may refer to a level in an enclosing block. In TML Pascal, this is an error.

  • In ANSI Pascal, it is an error if the value of the selector in a case statement is not equal to any of the case consonants. In TML Pascal, this is not an error; instead the case statement is ignored unless it contains an otherwise clause.

  • In ANSI Pascal, a Read from a text file with a char type variable assigns a blank to the variable if Eoln was True before the Read. In TML Pascal. a carriage return character (Chr(13) is assigned to the variable in this situation.

  • In ANSI Pascal, a Read from a text file with an integer tupe or a real type variable ceases as soon as the next character in the file is not part of a signed-integer or a signed-number. In TML Pascal, reading ceases when the next character in the file is a blank, a tab or an end of line character.

  • In ANSI Pascal, a Write to a text file with a packed string type causes the string to be truncated if the specified field width is less tan the length of the sting. In TML Pascal, the string is always written in full, even if it is longer than the specified field width.

Implementation Dependent Features

The effect of using an implementation dependent feature of Pascal, as defined by ANSI/IEEE770X3.97-1983, is unspecified. Programs should not depend on any specific path being taken in cases where an implementation dependent feature is being used. Implementation dependent features include:
  • The order of evaluation of index expressions in a variable reference.

  • The order of evaluation of expressions in a set constructor.

  • The order of evaluation of operands of binary operator.

  • The order of evaluation of actual parameters in a function call.

  • The order of evaluation of the left and right sides of an assignment.

  • The order of evaluation of actual parameters in a procedure statement.

  • The effect of reading a text file to which the procedure Page was applied during its creation.

  • The binding of variable denoted by the program parameters to entities external to the program.