On Sun, 27 Apr 2008 13:35:35 -0400 "John P. Baker" <[EMAIL PROTECTED]>
wrote:

:>Actually, I am working on a lexical analyzer and parser for a future
:>product.

:>The issue is that we have three formats (binary, decimal, and hexadecimal)
:>and three lengths (4, 8, and 16).

:>Clearly, we must have a letter to indicate the start of the exponent.

:>However, a numeric literal may not have an exponent.

:>Therefore, it does not seem prudent to use that exponent initiator to
:>specify either the length or the format.

:>The best approach would seem to be to permit 0-2 suffix letters to a numeric
:>literal which will identify the format and length.

:>If we use "E"/"e" to indicate an exponent, then we cannot use "E"/"e" as a
:>suffix character, since we are unable to distinguish the context properly.

:>So we need to determine what characters should be used for the various
:>formats and lengths.

:>Should we care in which order the format and length characters are
:>specified?

:>If format and/or length characters are not specified, how should we
:>determine what format and/or length should apply to the numeric literal?

:>Obviously, we can look at the number of digits specified and the value of
:>the exponent, if any.  However, in many cases these will be insufficient.

:>We can look and the surrounding context, but that adds a level of complexity
:>which may not be necessary.

But it would be the most reasonable way.

If I recall correctly, FORTRAN/PLI needed explicit exponentiation, i.e.,

    DOUBLE A,B
        .
    A = B+1.23

would use a short 1.23 rather than determining that the other operands were
double thus 1.23 should be treated as a double as well.

One had to do

    A = B+1.23D0

It would behoove you to determine the context to generate the best values. 

If your parser will support scaled values, 1.23 may not even be a floating
point number - it may be a fixed scaled value.

In general it is best to make things easier for the carbon life forms creating
and using the data rather than the silicon non-life forms processing the data
(even if it does cause more initial work for the carbon life forms programming
the silicon).

:>Ideas and suggestions, please.
:>
:>John P. Baker
:>
:>-----Original Message-----
:>From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On Behalf
:>Of Binyamin Dissen
:>Sent: Sunday, April 27, 2008 1:06 PM
:>To: IBM-MAIN@BAMA.UA.EDU
:>Subject: Re: Fixed-Point and Scientific Notation
:>
:>Typically E is used for short, D is used for long and L is now being used
:>for
:>double long.
:>
:>Should be.
:>
:>1.5E+0 - short.
:>1.5D+0 - long.
:>1.5L+0 - double long.
:>
:>What are you trying to do? Determine an interchange format?

--
Binyamin Dissen <[EMAIL PROTECTED]>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to