MAINSAIL Language Manual, Chapter 1

previous   next   top   complete contents   complete index   framed top   this page unframed


1. Introduction

This document is the definitive reference on MAINSAIL, a computer programming language supported and marketed by XIDAK, Inc. This manual is intended not to teach the MAINSAIL language, but rather to answer the questions of programmers who already have some knowledge of MAINSAIL. New users of MAINSAIL should consult the
MAINSAIL Documentation Set, which lists documents available from XIDAK on MAINSAIL and the MAINSAIL environment.

MAINSAIL system procedures, macros, and variables are described starting in Chapter 30, which should be consulted for information on unfamiliar identifiers in this manual.

1.1. Version

This version of the MAINSAIL Language Manual is current as of the proposed Version 16.30.1 of MAINSAIL (which has not yet been released).

1.2. The History of MAINSAIL and XIDAK

In the late 1960s, SAIL, an ALGOL-like programming language, was developed at the Stanford Artificial Intelligence Laboratory. In the 1970s, Clark Wilcox, then a graduate student at Stanford University, undertook a project to port SAIL to the DEC PDP-11. It soon became clear to Clark that the machine dependencies in the original SAIL would preclude porting the language without significant changes. Accordingly, he designed an entirely new language, MAINSAIL, with easy portability among many different platforms as a major design goal. MAINSAIL was similar to SAIL in many ways, but Clark removed all machine dependencies and added many new features.

In 1980, the original authors of MAINSAIL decided to commercialize the language. They founded XIDAK, Inc., in order to sell MAINSAIL. The name XIDAK is derived from the final consonants of the last names of the three original authors of MAINSAIL (Clark Wilcox, Greg Jirak, and Mary Dageforde). The founders selected two vowels (“I” and “A”) that are common to more than one of the last names, and arranged the letters into something pronounceable (“ZIE dack”).

1.3. The Design of MAINSAIL

MAINSAIL is a programming system designed for the development of portable software, i.e., programs that can be transported in source form with no alterations (unless implied by the nature of the program) among all implementations. The programmer is not prevented from writing programs that are machine-dependent, but the language design is based on constructs that can be implemented on a variety of machines, so that the need for machine-dependent constructs is minimized. To provide a basis for portability was necessary to develop facilities not commonly provided by general-pupose programming languages (at least until the advent of Java); for example, MAINSAIL provides its own intermodule linkage and module loading.

MAINSAIL is a large language. It provides a number of data types, data structuring mechanisms, and system procedures. Efficient execution and the capability to develop large software products quickly were more important considerations in the development of the language than keeping the language small.

XIDAK reserves the right to upgrade MAINSAIL from release to release. New data types, data structures, keywords, system procedures, system macros, and system variables may be introduced at each MAINSAIL release. Insofar as XIDAK deems feasible, such enhancements will be compatible with previous versions of MAINSAIL.

Sizes and layouts of data types and data structures, values of system macro constants, and other system-dependent information may change from release to release and vary from system to system. For portability (both among different releases and different computers), these quantities should be specified symbolically using the features provided in the MAINSAIL language, and never hardwired into a program.

1.4. Terminology and Symbols

The data type abbreviations of Table 1–1 are used throughout the manual. These abbreviations are often used to stand for variables of the data type being abbreviated.

Table 1–1. Data Type Abbreviations
boBOOLEAN
iINTEGER
liLONG INTEGER
rREAL
lrLONG REAL
bBITS
lbLONG BITS
sSTRING
aADDRESS
cCHARADR (c sometimes abbreviates “character” instead)
pPOINTER
nNumeric (INTEGER, LONG INTEGER, REAL, LONG REAL)
v,v0,...Variables
e,e0,...Expressions
c,c0,...Constant expressions
s,s0,...Statements

In descriptions, the forms (LONG) INTEGER, (LONG) BITS, and (LONG) REAL mean “INTEGER and/or LONG INTEGER”, “BITS and/or LONG BITS”, and “REAL and/or LONG REAL”, respectively.

MAINSAIL keywords (e.g., BEGIN, END) are written in all upper case in this manual, though this is not necessary in MAINSAIL programs. MAINSAIL does not distinguish identifiers or keywords on the basis of case.

Compiletime refers to actions that take place while a program is being compiled. Runtime refers to actions that take place while a program is being executed.

MAINSAIL implementations are categorized according to processor, operating system, and platform. A processor is characterized by a particular instruction set; one or more operating systems may run on computers containing a given processor. In XIDAK terminology, two implementations of MAINSAIL run on different operating systems if code for the two systems must be compiled differently (even if the instruction sets are the same, operating-system-dependent logic may have to be different). Platform is a narrower category than operating system; i.e., every operating system includes one or more platforms. Although identical code is generated for all MODULEs compiled for the same operating system, two different platforms within the same operating system may require different installation procedures or bootstraps, or may make slightly different operating system calls at runtime. The current lists of processors, operating systems, and platforms are given in Appendix B.

The target system (or target processor, target operating system, or target platform) is the computer system for which a MAINSAIL program is compiled, i.e., the system on which it is to run. In referring to compilations, the host system is the system on which a MAINSAIL program is compiled, which is not necessarily the same as the target system.

Error refers to a situation or language construct that by default generates an error message (either at compiletime or at runtime). Illegal refers to some language constructs that generate errors at compiletime. Undefined refers to a situation or language construct that is unsafe or not logically correct, but that may or may not generate an error message. Programs making use of an undefined construct or situation may not work the same way from one MAINSAIL version or implementation to another. Unspecified refers to the result of a situation or operation that does not generate an error and is not logically incorrect, but that may vary from situation to situation or from implementation to implementation. For example, in operations that round numbers, the direction of rounding is often unspecified.

MAINSAIL often chooses to leave a construct undefined or unspecified for efficiency considerations. On MAINSAIL implementations, the fastest form of an operation provided by the underlying hardware or operating system is usually used, regardless of whether it provides error condition checks or high precision.

Some error messages can be suppressed; e.g., the NOCHECK compiler directive prevents certain situations from generating error messages. Suppressing error messages with the NOCHECK directive transforms the affected error situations into undefined situations.

1.5. Conventions Used in This Document

1.5.1. User Interaction

Throughout the examples in this document, characters typed by the user are underlined. <eol> symbolizes the end-of-line key on a terminal keyboard; this key is marked RETURN or ENTER on most keyboards. In the following example,
Prompt: is written by the computer; the user types response and then presses the end-of-line key:

Promptresponse<eol>

1.5.2. Syntax Descriptions

Specifications of syntax often contain descriptions in this typeface, or sometimes enclosed in angle brackets (< and >). Such descriptions are not typed literally, but are replaced with instances of the things they describe. For example, a specification of the syntax of the address on an envelope might appear as:

name of addressee
street number  street name
town or city namestate abbreviation  zip code

or as:

<name of addressee>
<street number> <street name>
<town or city name>, <state abbreviation>  <zip code>

Optional elements in command or syntax descriptions are often enclosed in curly brackets ({ and }). For example, a string of characters specified as {A}B{C} could have any one of the forms B, BC, AB, and ABC. Optional arguments followed by an asterisk (*) may be repeated zero or more times, so that {A}* can mean nothing, or A, or AA, or AAA, etc.

Alternatives may be enclosed in square brackets (or curly brackets, if all alternatives are optional) and separated by vertical bars (|); [A|B|C] means A, B, or C; {A|B} means A, B, or nothing.

1.5.3. Temporary Features

Temporary features that have not acquired a final form are marked as follows:

Temporary feature: subject to change

Temporary features are subject to change or removal without notice. Programmers who make use of temporary features must be prepared to modify their code to accommodate the changes in them on each release of MAINSAIL. It is recommended that code that makes use of temporary features be as isolated from normal code as possible and thoroughly documented.


previous   next   top   complete contents   complete index   framed top   this page unframed

MAINSAIL Language Manual, Chapter 1