UNIX — универсальная среда программирования - Керниган Брайан Уилсон
На этом ресурсе Вы можете бесплатно читать книгу онлайн UNIX — универсальная среда программирования - Керниган Брайан Уилсон. Жанр: ОС и Сети / Интернет . На сайте booksdaily.club Вы можете онлайн читать полную версию книги без регистрации и sms. Так же Вы можете ознакомится с содержанием, описанием, предисловием о произведении
.AUBrian KernighanRob Pike.AB.I Hocis a simple programmable interpreterfor floating point expressions.It has C-style control flow,function definition and the usualnumerical built-in functions such as cosine and logarithm..AE.NHExpressions.PP.I Hocis an expression language,much like C:although there are several control-flow statements,most statements such as assignmentsare expressions whose value is disregarded.For example, the assignment operator= assigns the value of its right operandto its left operand, and yields the value,so multiple assignments work.The expression grammar is:.DS.Iexpr: number | variable | ( expr ) | expr binop expr | unop expr | function ( arguments ).R.DENumbers are floating point.The input format isthat recognized by @[email protected](3):.ix [scanf]digits, decimal point, digits,.ix [hoc] manual.ix assignment expression.ix multiple assignment@[email protected] or @[email protected], signed exponent.At least one digit or a decimal pointmust be present;the other components are optional..PPVariable names are formed from a letterfollowed by a string of letters and numbers,@[email protected] refers to binary operators suchas addition or logical comparison;@[email protected] refers to the two negation operators,'!' (logical negation, 'not')and '-' (arithmetic negation, sign change).Table 1 lists the operators..TScenter, box;с slfCW l.fBTable 1:fP Operators, in decreasing order of precedence.sp .5^ exponentiation (s-1FORTRANs0 **), right associative! - (unary) logical and arithmetic negation* / multiplication, division+ - addition, subtraction> >= relational operators: greater, greater or equal,< <= less, less or equal,&== != equal, not equal (all same precedence)&& logical AND (both operands always evaluated)|| logical OR (both operands always evaluated)&= assignment, right associative.ТЕ.ix table~of [hoc] operators.PPFunctions, as described later, may be defined by the user.Function arguments are expressions separated by commas.There are also a number of built-in functions,all of which take a single argument,described in Table 2..TScenter, box;с slfCW l.fBTable 2:fP Built-in Functions.sp .5abs(x) @| x |@, absolute value of @[email protected]atan(x) arc tangent of @[email protected]cos(x) @cos (x)@, cosine of @[email protected]exp(x) @e sup [email protected], exponential of @[email protected]int(x) integer part of @[email protected], truncated towards zerolog(x) @log (x)@, logarithm base @[email protected] of @[email protected]log10(x) @log sub 10 (x)@, logarithm base 10 of @[email protected]sin(x) @sin (x)@, sine of @[email protected]sqrt(x) @sqrt [email protected], @x sup [email protected].ТЕ.ix table~of [hoc] functions.PPLogical expressions have value 1.0 (true) and 0.0 (false).As in C,any non-zero value is taken to be true.As is always the case with floating point numbers,equality comparisons are inherently suspect. .PP.I Hocalso has a few built-in constants, shown in Table 3..TScenter, box;c s s