gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## RE: [open-cobol-list] RE: Question About Functions

 From: Roger While Subject: RE: [open-cobol-list] RE: Question About Functions Date: Wed May 11 00:10:40 2005

```This is getting interesting. Had to dig through the 2002 standard -
**-- quote --**
8.7.1 Arithmetic operators
```
There are five binary arithmetic operators and two unary arithmetic operators that may be used in arithmetic expressions. They are represented by specific COBOL characters that shall be preceded by a space and followed by a space except that no space is required between a left parenthesis and a unary operator or between a unary operator and a left parenthesis. The following are the arithmetic operators:
```Binary Arithmetic Operators Meaning
+ Addition
 Subtraction
* Multiplication
/ Division
** Exponentiation
Unary Arithmetic Operators Meaning
+ The effect of multiplication by the numeric literal +1
 The effect of multiplication by the numeric literal 1
**-- end quote --**

Specifically the second sentence. Interesting, spaces are required.
And now -
Referring to Table 4 on page 120 which details allowable combinations
of symbols in expressions:
If the first symbol is + - * / or **. then the second symbol can be an
identifier/literal OR a unary + -.

So, we can have (partial) (quotes inserted for readability) -
" + - 1".

```
This leads me to think that the 2002 standard maybe allows/specifies unparsable grammar. (Or at least forces one to sprinkle well-placed parentheses to achieve the result)
```In fact, with regard to FUNCTION question, I can see potential problems.

Bill, can you comment on this ?

Roger

> Bill wrote :
```
And isn't that NON-conforming? Don't you need a "space" between the "-" and
```"D" to make the minus an "binary operator"?
```
```

```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]