Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Тексты(все).docx
Скачиваний:
4
Добавлен:
01.07.2025
Размер:
1 Мб
Скачать
☆

1. Introduction

This manual describes the C++ programming language. Where implementation-dependent details exist it tries to point them out. With few exceptions, such dependencies follow directly from the properties of the hardware. They are summarized in #2.6. C++ is "old C" as described in the C book extended with classes, inline functions, operator overloading, function name overloading, constant types, references, free store management, function argument check­ing, and a new function declaration syntax. The differ­ences between C++ and "old C" are summarized in #19.

Упражнение 20. Read text II carefully and say what is a token, a comment, an identifier, a keyword, a constant.

Прочтите Текст II внимательно и скажите по-английски, что такое лексема, коментарий, идентификатор, ключевое слово, константа.

Text II

2. Lexical conventions

There are six classes of tokens: identifiers, key­

words, constants, strings, operators, and other separa­tors. Blanks, tabs, new-lines, and comments (collec­tively, "white space") as described below are ignored except as they serve to separate tokens. Some white space is required to separate otherwise adjacent identi­fiers, keywords, and constants.

If the input stream has been parsed into tokens up to a given character, the next token is taken to include the longest string of characters.

2.1 Comments

The characters /* introduce a comment, which termi­nates with the characters */. Comments do not nest.

2-2 Identifiers (Names)

An identifier is an arbitrarily long sequence of let­ters and digits; the first character must be a letter; the underscore counts as a letter; upper- and lower­case letters are different.

2.3 Keywords

The following identifiers are reserved for use as

keywords

, and may

not be

used otherwise:

Asm

Continue

■ extern

Int

Return

typedef

Auto

Default

float

Long

Short

union

Break

Delete

for

New

Sizeof

unsigned

Case

Do

friend

Operator

Static

virtual

char

Double

goto

Overload

Struct

void

Class

Else

if

Public

Switch

while

Const

Enum

inline

Register

This

Упражнение 21. Translate the questions and answer them:

Переведите вопросы и ответьте на них:

Что такое C++ по сравнению со старым С?

Сколько существует классов лексем?

Каковы эти классы?

Является ли символ новой строки «пустым символом»?

Как организуются комментарии?

Могут ли комментарии быть вложенными один в другой?

Должен ли первый символ идентификатора быть буквой? Различаются ли в этом случае большие и маленькие буквы?

Любое ли слово, начинающееся с буквы, может быть идентификатором?

Упражнение 22. Translate:

Как идентификаторы, так и ключевые слова относятся к лексемам. Как старый, так и новый С являются языком высокого уровня. Мы можем использовать или маленькую, или большую букву «I». Десятичная, восьмеричная или шестнадцатиричная целочисленная константа, за которой сразу же следует или маленькая, или большая буква «I», является длинной константой. В этом случае игнорируются как \, так и новая строка. Могут опускаться или целая часть, или дробная (но не обе). Опускается либо десятичная точка, либо буква «е» и экспонента (но не обе).

Грамматика

Прилагательные

Прилагательные — это характеристики объекта, поэтому употребляются они с существительными. Как и в русском, обычно стоят перед сущест­вительными, но не меняют свою форму в зависимости от него.