Basic constructions of Pascal language

Basic constructions of Pascal language


Content
  1. What include the basic constructions of Pascal?
  2. What forms the alphabet of Pascal?
  3. What main symbols are included to set of Pascal language?
  4. What is the name in Pascal? What are the requirements put to the definition of names in Pascal? Examples of names.
  5. What words must not be used as names in Pascal?
  6. What is called the elements of the language?
  7. Examples of recording the integers in decimal and hexadecimal systems.
  8. How the character values are represented in Pascal?

1. What include the basic constructions of Pascal?

Answer: A basic constructions of Pascal contain the names, numbers and strings.


2. What forms the alphabet of Pascal?

The alphabet form the main symbols of Pascal. The main symbols are letters, numbers and special characters.


3. What main symbols are included to set of Pascal language?

Standard Pascal includes the following set of main symbols:

1. 26 Latin lowercase (a – z) and 26 Latin uppercase letters (AZ).

2. The ‘_‘ underscore.

3. 10 numbers from ‘0‘ to ‘9‘.

4. Signs of operations:

+ - * / = <>   < > <= >= := @

5. Limiters:

. , ' ( ) [ ] (. .) { } (* *) .. : ;

6. The specifiers:

^ # $

7. Reserved words:

ABSOLUTE     EXPORTS          LIBRARY     SET
ASSEMBLER    EXTERNAL         MOD         SHL
AND          FAR              NAME        SHR
ARRAY        FILE             NIL         STRING
ASM          FOR              NEAR        THEN
ASSEMBLER    FORWARD          NOT         TO
BEGIN        FUNCTION         OBJECT      TYPE
CASE         GOTO             OF          UNIT
CONST        IF               OR          UNTIL
CONSTRUCTOR  IMPLEMENTATION   PACKED      USES
DESTRUCTOR   IN               PRIVATE     VAR
DIV          INDEX            PROCEDURE    VIRTUAL
DO           INHERITED        PROGRAM     WHILE
DOWNTO       INLINE           PUBLIC      WITH
ELSE         INTERFACE        RECORD      XOR
END          INTERRUPT        REPEAT
EXPORT       LABEL            RESIDENT

In addition to these, a set of basic characters includes a space. Space can not be used inside the dual characters and reserved words.


4. What is the name in Pascal? What are the requirements put to the definition of names in Pascal? Examples of names.

Name – this is a sequence of letters and numbers, that is begun from letter. In the names can be used the underline symbol.

The name can contain any number of characters, but meaningful have the first 63 characters.

An examples of names in Pascal:

A
b12
r1m
SIGMA
gamma
I80_86

The program can not include two identical names of variables, constants, functions and so on..


5. What words must not be used as names in Pascal?

Answer. You can not use as names the functional words and standard names, for which are named the standard constants, types, procedures, functions and files.

For example: begin, and, label, for, repeat, integer, real, implementation and others (see p.3).


6. What is called the elements of the language?

Answer: this is a constants, labels, types, variables, procedures, functions, modules, objects and so on.


7. Examples of recording the integers in decimal and hexadecimal systems.

In most cases the numbers in Pascal is written in the decimal system. However, you can also write the integers in hexadecimal system. To write the number in hexadecimal system, you need to use the character ‘$’ before the number.

An examples of using the numbers in decimal system:

217
-45
8954
+483

An examples of using the numbers in hexadecimal system:

$7F
$40
$ABCD


8. How the character values are represented in Pascal?

The separate character constant – this is a symbol of the allowable character set specific computer.

A character constant can be written in the program in two ways:

1. As one character disposed between apostrophes, for example:

'A'
'a'
'5'

2. With the help of construction of type #K, where K – the corresponding symbol code, while the value of K should be between 0..255. For example, the character constant ‘R‘ you can write as #82.