Oberon (на английском языке)

PDF-файл Oberon (на английском языке) Языки программирования (53747): Другое - 7 семестрOberon (на английском языке): Языки программирования - PDF (53747) - СтудИзба2019-09-19СтудИзба

Описание файла

PDF-файл из архива "Oberon (на английском языке)", который расположен в категории "". Всё это находится в предмете "языки программирования" из 7 семестр, которые можно найти в файловом архиве МГУ им. Ломоносова. Не смотря на прямую связь этого архива с МГУ им. Ломоносова, его также можно найти и в других разделах. .

Просмотр PDF-файла онлайн

Текст из PDF

1The Programming Language Oberon(Revision 1. 10. 90)N.WirthMake it as simple as possible, but not simpler. (A. Einstein)1. IntroductionOberon is a general-purpose programming language that evolved from Modula-2. Its principalnew feature is the concept of type extension. It permits the construction of new data types on thebasis of existing ones and to relate them.This report is not intended as a programmer's tutorial.

It is intentionally kept concise. Its functionis to serve as a reference for programmers, implementors, and manual writers. What remainsunsaid is mostly left so intentionally, either because it is derivable from stated rules of thelanguage, or because it would require to commit the definition when a general commitmentappears as unwise.2. SyntaxA language is an infinite set of sentences, namely the sentences well formed according to itssyntax. In Oberon, these sentences are called compilation units. Each unit is a finite sequence ofsymbols from a finite vocabulary. The vocabulary of Oberon consists of identifiers, numbers,strings, operators, delimiters, and comments. They are called lexical symbols and are composedof sequences of characters.

(Note the distinction between symbols and characters.)To describe the syntax, an extended Backus-Naur Formalism called EBNF is used. Brackets [and ] denote optionality of the enclosed sentential form, and braces { and } denote its repetition(possibly 0 times). Syntactic entities (non-terminal symbols) are denoted by English wordsexpressing their intuitive meaning.

Symbols of the language vocabulary (terminal symbols) aredenoted by strings enclosed in quote marks or words written in capital letters, so-called reservedwords.3. Vocabulary and representationThe representation of symbols in terms of characters is defined using the ASCII set. Symbols areidentifiers, numbers, strings, operators, delimiters, and comments. The following lexical rulesmust be observed.

Blanks and line breaks must not occur within symbols (except in comments,and blanks in strings). They are ignored unless they are essential to separate two consecutivesymbols. Capital and lower-case letters are considered as being distinct.1. Identifiers are sequences of letters and digits. The first character must be a letter.ident = letter {letter | digit}.Examples:x scan Oberon GetSymbol firstLetter2. Numbers are (unsigned) integers or real numbers. Integers are sequences of digits and maybe followed by a suffix letter.

The type is the minimal type to which the number belongs (see 6.1.).If no suffix is specified, the representation is decimal. The suffix H indicates hexadecimalrepresentation.A real number always contains a decimal point. Optionally it may also contain a decimal scalefactor. The letter E (or D) is pronounced as "times ten to the power of". A real number is of typeREAL, unless it has a scale factor containing the letter D; in this case it is of type LONGREAL.2number = integer | real.integer = digit {digit} | digit {hexDigit} "H" .real = digit {digit} "." {digit} [ScaleFactor].ScaleFactor = ("E" | "D") ["+" | "-"] digit {digit}.hexDigit = digit | "A" | "B" | "C" | "D" | "E" | "F".digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9".Examples:1987100H12.34.567E80.57712566D-6= 256= 456700000= 0.000000577125663.

Character constants are either denoted by a single character enclosed in quote marks or bythe ordinal number of the character in hexadecimal notation followed by the letter X.CharConstant = """ character """ | digit {hexDigit} "X".4. Strings are sequences of characters enclosed in quote marks ("). A string cannot contain aquote mark. The number of characters in a string is called the length of the string. Strings can beassigned to and compared with arrays of characters (see 9.1 and 8.2.4).string = """ {character} """ .Examples:"OBERON""Don't worry!"5.

Operators and delimiters are the special characters, character pairs, or reserved words listedbelow. These reserved words consist exclusively of capital letters and cannot be used in the roleof identifiers.+:=ARRAYISTO^BEGINLOOPTYPE*=CASEMODUNTIL/#CONSTMODULEVAR~<DIVNILWHILE&>DOOFWITH.<=ELSEOR,>=ELSIFPOINTER;..ENDPROCEDURE|:EXITRECORD()IFREPEAT[]IMPORTRETURN{}INTHEN6. Comments may be inserted between any two symbols in a program.

They are arbitrarycharacter sequences opened by the bracket (* and closed by *). Comments do not affect themeaning of a program.34. Declarations and scope rulesEvery identifier occurring in a program must be introduced by a declaration, unless it is apredefined identifier. Declarations also serve to specify certain permanent properties of an object,such as whether it is a constant, a type, a variable, or a procedure.The identifier is then used to refer to the associated object. This is possible in those parts of aprogram only which are within the scope of the declaration. No identifier may denote more thanone object within a given scope.

The scope extends textually from the point of the declaration tothe end of the block (procedure or module) to which the declaration belongs and hence to whichthe object is local. The scope rule has the following amendments:1. If a type T is defined as POINTER TO T1 (see 6.4), the identifier T1 can be declared textuallyfollowing the declaration of T, but it must lie within the same scope.2. Field identifiers of a record declaration (see 6.3) are valid in field designators only.In its declaration, an identifier in the global scope may be followed by an export mark (*) toindicate that it be exported from its declaring module. In this case, the identifier may be used inother modules, if they import the declaring module.

The identifier is then prefixed by the identifierdesignating its module (see Ch. 11). The prefix and the identifier are separated by a period andtogether are called a qualified identifier.qualident = [ident "."] ident.identdef = ident ["*"].The following identifiers are predefined; their meaning is defined in the indicated sections:ABSASHBOOLEANBYTECAPCHARCHRDECENTIEREXCLFALSEHALTINCINCLINTEGER(10.2)(10.2)(6.1)(6.1)(10.2)(6.1)(10.2)(10.2)(10.2)(10.2)(6.1)(10.2)(10.2)(10.2)(6.1)LENLONGLONGINTLONGREALMAXMINNEWODDORDREALSETSHORTSHORTINTSIZETRUE(10.2)(10.2)(6.1)(6.1)(10.2)(10.2)(6.4)(10.2)(10.2)(6.1)(6.1)(10.2)(6.1)(10.2)(6.1)5. Constant declarationsA constant declaration associates an identifier with a constant value.ConstantDeclaration = identdef "=" ConstExpression.ConstExpression = expression.A constant expression can be evaluated by a mere textual scan without actually executing theprogram.

Its operands are constants (see Ch. 8). Examples of constant declarations are:N= 100limit= 2*N -1all= {0 .. WordSize-1}46. Type declarationsA data type determines the set of values which variables of that type may assume, and theoperators that are applicable. A type declaration is used to associate an identifier with the type.Such association may be with unstructured (basic) types, or it may be with structured types, inwhich case it defines the structure of variables of this type and, by implication, the operators thatare applicable to the components. There are two different structures, namely arrays and records,with different component selectors.TypeDeclaration = identdef "=" type.type = qualident | ArrayType | RecordType | PointerType | ProcedureType.Examples:TableTreeNode===ARRAY N OF REALPOINTER TO NodeRECORD key: INTEGER;left, right: TreeENDCenterNode =RECORD (Node)name: ARRAY 32 OF CHAR;subnode: TreeENDFunctionPROCEDURE (x: INTEGER): INTEGER=6.1.

Basic typesThe following basic types are denoted by predeclared identifiers. The associated operators aredefined in 8.2, and the predeclared function procedures in 10.2. The values of a given basic typeare the following:1. BOOLEANthe truth values TRUE and FALSE.2. CHARthe characters of the extended ASCII set (0X ... 0FFX).3. SHORTINTthe integers between -128 and 127.4. INTEGERthe integers between MIN(INTEGER) and MAX(INTEGER).5. LONGINTthe integers between MIN(LONGINT) and MAX(LONGINT).6. REALreal numbers between MIN(REAL) and MAX(REAL).7. LONGREAL real numbers between MIN(LONGREAL) and MAX(LONGREAL).8. SETthe sets of integers between 0 and MAX(SET).Types 3 to 5 are integer types, 6 and 7 are real types, and together they are called numeric types.They form a hierarchy; the larger type includes (the values of) the smaller type:LONGREAL ⊇ REAL ⊇ LONGINT ⊇ INTEGER ⊇ SHORTINT6.2.

Array typesAn array is a structure consisting of a fixed number of elements which are all of the same type,called the element type. The number of elements of an array is called its length. The elements ofthe array are designated by indices, which are integers between 0 and the length minus 1.ArrayType = ARRAY length {"," length} OF type.length = ConstExpression.A declaration of the formARRAY N0, N1, ... , Nk OF T5is understood as an abbreviation of the declarationARRAY N0 OFARRAY N1 OF...ARRAY Nk OF TExamples of array types:ARRAY N OF INTEGERARRAY 10, 20 OF REAL6.3. Record typesA record type is a structure consisting of a fixed number of elements of possibly different types.The record type declaration specifies for each element, called field, its type and an identifierwhich denotes the field.

The scope of these field identifiers is the record definition itself, but theyare also visible within field designators (see 8.1) referring to elements of record variables.RecordType= RECORD ["(" BaseType ")"] FieldListSequence END.BaseType= qualident.FieldListSequence = FieldList {";" FieldList}.FieldList= [IdentList ":" type].IdentList= identdef {"," identdef}.If a record type is exported, field identifiers that are to be visible outside the declaring modulemust be marked. They are called public fields; unmarked fields are called private fields.Record types are extensible, i.e.

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
5224
Авторов
на СтудИзбе
426
Средний доход
с одного платного файла
Обучение Подробнее