Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Program construction consideration principles.doc
Скачиваний:
3
Добавлен:
04.11.2018
Размер:
72.19 Кб
Скачать

Predefined denotations

The predefined denotations are determined by the standard language environment. Program writer must know them.

The set of predefined denotations consists of reserved denotations, standard denotations and images (fig).

Reserved denotations

The reserved denotations are ones, which have strong connection with their values. The connection is defined by standard environment.

For example: “if”, “begin”, “const”, ”module” is reserved denotations.

Standard denotations

The standard denotations are those having strong connection with their values. However, the language grammar has redenotation rules for standard denotations.

For example, “integer”, “+”,” –“ are standard denotations.

The standard denotations are divided into predefined type indicators, predefined operation denotations, and predefined separator denotations.

The predefined type indicators are denotations of predefined types, for example, “int”, and “integer”, “char”.

The predefined operation denotations are characters, pair of characters and longer chains, which have interpretation inside the standard language environment.

There are the following groups of the predefined operation denotations:

- the denotations of scalar operations;

- the denotations of relation operations ( more, less, egual);

- the logic operation denotations (logical AND, OR, NOT);

- the bits operation denotations (shift, AND, OR).

There are unary and binary operations.

Unary operations use one value. For example, “- 5”, here “-” is the unary operation denotation, “5” is the operand one.

Binary operations use two values. For example “2 + 5”, here “+” is the binary operation denotation, “2” and “5” are operands.

The predefined separator denotations are denotations used in high level designs, for example, a parenthesis “(“, “)”.

Images

Predefined images are denotations, familiar to everybody.

For example, they are denotations of reference values “NULL”, “NIL”, or denotations of logical values “TRUE” and “FALSE”.

Defined denotations

Defined denotations are ones, which defined by a programmer.

He uses grammar rules for it.

There are two types of defined denotations:

- identifiers;

- images.

Identifiers and images

Identifiers are defined denotations satisfying the requirements of syntactical and pragmatically rules.

For example, “nVal”, “cChar” are identifiers.

The pragmatically rules are rules or agreements which are used inside the software developing organization (Hungarian notation: “nVal”, “pPointer”; SmallTalk notation: “Input_Value”)

Image or standard denotation is the denotation denoting the value familiar to everybody. For example, “13”, “5.2”, “C” are defined images.

Lexical analysis

Program, which provides analysis of lexemes, is called lexical analysis. The part of translator is called lexical analyzer or scanner. The scanner provides coding lexemes, deletes blank characters and comments. The coded text of the program is later used during parse process.

text text (coding)

blank comment delete

character statements

Fig. Scanner scheme

Types

The type is a value set and an operation set, which can be fulfilled with these values.

The type has the following features:

- denotation (the indicator) of the type. There are predefined and defined denotations of the types;

- set of type values;

- set of type operations;

- memory size, in which the type value is placed inside the computer storage.

Type operations

There are predefined and defined type operations.

Fig. Predefined operations

Predefined operations

Base operations are realized in the programming language environment and cannot be redefined.

Literal, generator, reference, attribute, type cast and dereference operations are base operations.

Standard operations are realized in standard language environment and can be redefined.

Logical, arithmetic, bit and relation operations are standard operations.

Types

All types are divided into two groups: predefined and defined.

Denotation, range, set operations, and value design of the first group types are predefined by standard language environment and cannot be changed.

The programmer defines denotation, range, operation set, and value design for defined types.

The predefined type’s classification

Predefined types

scalar machine-dependent special

discrete real word address untyped

pointing

integer enumerated fixed float

character boolean

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]