TOPS-20 PASCAL Language Manual - Bitsavers
TOPS-20 PASCAL Language Manual - Bitsavers
TOPS-20 PASCAL Language Manual - Bitsavers
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
INTRODUCTION<br />
1.1 OVERVIEW OF <strong>PASCAL</strong><br />
A <strong>PASCAL</strong> program performs operations on data items known as constants,<br />
variables, and function designators. A constant is a quantity with an<br />
unchanging value. A constant to which you give a name is called a<br />
symbolic constant. A variable is a quantity whose value can change<br />
while the program executes. A function designator causes the<br />
execution of a group of statements that is associated with an<br />
identifier and returns a value. The function type is determined by<br />
the type of the value it returns.<br />
1.1.1 Data Types<br />
Every <strong>PASCAL</strong> data item is associated with a data type. A data type,<br />
which is usually indicated by a type identifier, determines both the<br />
range of values a data item can assume and the operations that can be<br />
performed upon it. In addition, the type implicitly indicates how<br />
much storage space is required for all possible values of the data<br />
item.<br />
<strong>PASCAL</strong> provides identifiers for many predefined types. Thus, a<br />
program's operations can involve integers, real numbers, Boolean and<br />
character data, arrays, records, sets, and pointers to dynamic<br />
variables. <strong>PASCAL</strong> also allows you to create your own types by<br />
defining an identifier of your choice to represent a range of values.<br />
The type of a constant is the type of its corresponding value. You<br />
establish variable and function types when you declare them. In<br />
general, they cannot change. Although variables and functions can<br />
change in value any number of times, all the values they assume must<br />
be within the range established by their type. A variable does not<br />
assume a value until the program assigns it one. A function is<br />
assigned a value during its execution.<br />
<strong>PASCAL</strong> associates types not only with data items, but also with<br />
expressions. An expression is the computation of a value resulting<br />
from a combination of variables, constants, function designators, and<br />
operators. In <strong>PASCAL</strong>, you can form expressions using arithmetic,<br />
relational, logical, string, and set operators. Arithmetic<br />
expressions produce integer or real number values. Relational,<br />
logical, string, and most set expressions yield Boolean results.<br />
Other set expressions form the union, intersection, and differences of<br />
two sets.<br />
1.1.2 Structure of a <strong>PASCAL</strong> Program<br />
A <strong>PASCAL</strong> program consists of a heading and a block. The heading<br />
specifies the name of the program and the names of any external files<br />
the program may use. The block is divided into two parts: the<br />
declaration section, which contains data declarations; and the<br />
executable section, which contains executable statements. Figure 1-1<br />
points out each part of a sample <strong>PASCAL</strong> program.<br />
1-2