Oberon (на английском языке), страница 2

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

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

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

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

Текст 2 страницы из PDF

a record type can be defined as an extension of another recordtype. In the examples above, CenterNode (directly) extends Node, which is the (direct) base typeof CenterNode. More specifically, CenterNode extends Node with the fields name and subnode.Definition: A type T0 extends a type T, if it equals T, or if it directly extends an extension of T.Conversely, a type T is a base type of T0, if it equals T0, or if it is the direct base type of a basetype of T0.Examples of record types:RECORD day, month, year: INTEGERENDRECORDname, firstname: ARRAY 32 OF CHAR;age: INTEGER;salary: REALEND6.4.

Pointer typesVariables of a pointer type P assume as values pointers to variables of some type T. The pointertype P is said to be bound to T, and T is the pointer base type of P. T must be a record or arraytype. Pointer types inherit the extension relation of their base types. If a type T0 is an extension ofT and P0 is a pointer type bound to T0, then P0 is also an extension of P.PointerType = POINTER TO type.If p is a variable of type P = POINTER TO T, then a call of the predefined procedure NEW(p) hasthe following effect (see 10.2): A variable of type T is allocated in free storage, and a pointer to itis assigned to p.

This pointer p is of type P; the referenced variable p^ is of type T. Failure ofallocation results in p obtaining the value NIL. Any pointer variable may be assigned the valueNIL, which points to no variable at all.66.5. Procedure typesVariables of a procedure type T have a procedure (or NIL) as value. If a procedure P is assignedto a procedure variable of type T, the (types of the) formal parameters of P must be the same asthose indicated in the formal parameters of T. The same holds for the result type in the case of afunction procedure (see 10.1). P must not be declared local to another procedure, and neithercan it be a predefined procedure.ProcedureType = PROCEDURE [FormalParameters].7.

Variable declarationsVariable declarations serve to introduce variables and associate them with identifiers that must beunique within the given scope. They also serve to associate fixed data types with the variables.VariableDeclaration = IdentList ":" type.Variables whose identifiers appear in the same list are all of the same type. Examples of variabledeclarations (refer to examples in Ch. 6):i, j, k:x, y:p, q:s:f:a:w:t:INTEGERREALBOOLEANSETFunctionARRAY 100 OF REALARRAY 16 OFRECORD ch: CHAR;count: INTEGERENDTree8. ExpressionsExpressions are constructs denoting rules of computation whereby constants and current valuesof variables are combined to derive other values by the application of operators and functionprocedures. Expressions consist of operands and operators.

Parentheses may be used toexpress specific associations of operators and operands.8.1. OperandsWith the exception of sets and literal constants, i.e. numbers and character strings, operands aredenoted by designators. A designator consists of an identifier referring to the constant, variable,or procedure to be designated. This identifier may possibly be qualified by module identifiers (seeCh.

4 and 11), and it may be followed by selectors, if the designated object is an element of astructure.If A designates an array, then A[E] denotes that element of A whose index is the current value ofthe expression E. The type of E must be an integer type. A designator of the form A[E1, E2, ... ,En] stands for A[E1][E2] ... [En]. If p designates a pointer variable, p^ denotes the variable whichis referenced by p. If r designates a record, then r.f denotes the field f of r. If p designates apointer, p.f denotes the field f of the record p^, i.e. the dot implies dereferencing and p.f stands forp^.f, and p[E] denotes the element of p^ with index E.The typeguard v(T0) asserts that v is of type T0, i.e. it aborts program execution, if it is not of typeT0.

The guard is applicable, if1.T0 is an extension of the declared type T of v, and if72.v is a variable parameter of record type or v is a pointer.designator = qualident {"." ident | "[" ExpList "]" | "(" qualident ")" | "^" }.ExpList = expression {"," expression}.If the designated object is a variable, then the designator refers to the variable's current value. Ifthe object is a procedure, a designator without parameter list refers to that procedure. If it isfollowed by a (possibly empty) parameter list, the designator implies an activation of theprocedure and stands for the value resulting from its execution.

The (types of the) actualparameters must correspond to the formal parameters as specified in the procedure's declaration(see Ch. 10).Examples of designators (see examples in Ch. 7):ia[i]w[3].cht.keyt.left.rightt(CenterNode).subnode(INTEGER)(REAL)(CHAR)(INTEGER)(Tree)(Tree)8.2. OperatorsThe syntax of expressions distinguishes between four classes of operators with differentprecedences (binding strengths). The operator ~ has the highest precedence, followed bymultiplication operators, addition operators, and relations.

Operators of the same precedenceassociate from left to right. For example, x-y-z stands for (x-y)-z.expression= SimpleExpression [relation SimpleExpression].relation= "=" | "#" | "<" | "<=" | ">" | ">=" | IN | IS.SimpleExpression = ["+"|"-"] term {AddOperator term}.AddOperator = "+" | "-" | OR .term= factor {MulOperator factor}.MulOperator= "*" | "/" | DIV | MOD | "&" .factor= number | CharConstant | string | NIL | set |designator [ActualParameters] | "(" expression ")" | "~" factor.set= "{" [element {"," element}] "}".element= expression [".." expression].ActualParameters = "(" [ExpList] ")" .The available operators are listed in the following tables.

In some instances, several differentoperations are designated by the same operator symbol. In these cases, the actual operation isidentified by the type of the operands.8.2.1. Logical operatorssymbolOR&~resultlogical disjunctionlogical conjunctionnegationThese operators apply to BOOLEAN operands and yield a BOOLEAN result.p OR qstands for"if p then TRUE, else q"p&qstands for"if p then q, else FALSE"8~pstands for"not p"8.2.2.

Arithmetic operatorssymbolresult+*/DIVMODsumdifferenceproductquotientinteger quotientmodulusThe operators +, -, *, and / apply to operands of numeric types. The type of the result is thatoperand's type which includes the other operand's type, except for division (/), where the result isthe real type which includes both operand types. When used as operators with a single operand, denotes sign inversion and + denotes the identity operation.The operators DIV and MOD apply to integer operands only. They are related by the followingformulas defined for any dividend x and positive divisors y:x = (x DIV y) * y + (x MOD y)0 ≤ (x MOD y) < y8.2.3. Set operatorssymbol+*/resultuniondifferenceintersectionsymmetric set differenceThe monadic minus sign denotes the complement of x, i.e. -x denotes the set of integers between0 and MAX(SET) which are not elements of x.x-yx/y==x * (-y)(x-y) + (y-x)8.2.4.

Relationssymbol=#<<=>>=INISrelationequalunequallessless or equalgreatergreater or equalset membershiptype testRelations are Boolean. The ordering relations <, <=, >, and >= apply to the numeric types, CHAR,and character arrays (strings). The relations = and # also apply to the type BOOLEAN and to set,pointer, and procedure types.

x IN s stands for x is an element of s. x must be of an integer type,and s of type SET. v IS T stands for v is of type T and is called a type test. It is applicable, if91. T is an extension of the declared type T0 of v, and if2. v is a variable parameter of record type or v is a pointer.Assuming, for instance, that T is an extension of T0 and that v is a designator declared of typeT0, then the test v IS T determines whether the actually designated variable is (not only a T0, butalso) a T. The value of NIL IS T is undefined.Examples of expressions (refer to examples in Ch. 7):1987i DIV 3~p OR q(i+j) * (i-j)s - {8, 9, 13}i+xa[i+j] * a[i-j](0<=i) & (i<100)t.key = 0k IN {i ..

j-1}t IS CenterNode(INTEGER)(INTEGER)(BOOLEAN)(INTEGER)(SET)(REAL)(REAL)(BOOLEAN)(BOOLEAN)(BOOLEAN)(BOOLEAN)9. StatementsStatements denote actions. There are elementary and structured statements. Elementarystatements are not composed of any parts that are themselves statements. They are theassignment, the procedure call, and the return and exit statements. Structured statements arecomposed of parts that are themselves statements. They are used to express sequencing andconditional, selective, and repetitive execution. A statement may also be empty, in which case itdenotes no action. The empty statement is included in order to relax punctuation rules instatement sequences.statement = [assignment | ProcedureCall |IfStatement | CaseStatement | WhileStatement | RepeatStatement |LoopStatement | WithStatement | EXIT | RETURN [expression] ].9.1.

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