[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [open-cobol-list] RE: Question About Functions
From: |
Bill Klein |
Subject: |
RE: [open-cobol-list] RE: Question About Functions |
Date: |
Wed May 11 10:37:25 2005 |
Regarding
" + - 1"
The table shows that after EITHER
+ - * / **
or
Unary + or -
it is NOT permissible to have
+ - * / **
It *is* permissible to have
+ - * / **
followed by
Unary + or -
Therefore,
" + - 1"
must be a binary operator followed by a unary operator, e.g.
Identifier-x + (- 1)"
would be equivalent to
Identifier-x + - 1
which would also be equivalent to
Identifier-x + -1
***
Does this answer the "question" - or am I still missing something?
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Roger While
> Sent: Wednesday, May 11, 2005 2:07 AM
> To: Bill Klein
> Cc: address@hidden; address@hidden
> Subject: RE: [open-cobol-list] RE: Question About Functions
>
> 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"?
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_ids93&alloc_id281&op=ick
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
>