From: "Howard W. LUDWIG" <howard.w.ludwig@lmco.com>
Subject: Re: Please read this..thank you
Date: 1997/11/07
Date: 1997-11-07T00:00:00+00:00 [thread overview]
Message-ID: <346335F8.7B04@lmco.com> (raw)
In-Reply-To: 345BBEC0.1D12@upnaway.com
Sho wrote:
>
> Dear Ada Programmers,
>
> Could you please help me with the algorithms on how to convert Infix to
> a Postfix expression? examples:
>
> Infix: 1 + 2 + 3
> Postfix: 1 2 3 + +
I do not know whether you were simply trying to put together a quick,
simple example without paying close attention to what you were doing
(and consequently made a silly mistake) or you have an actual
misunderstanding which may cause you troubles in trying to compose
appropriate code. However, your example is in error:
While we all know that addition of integers (and, more generally, real
and complex numbers) is associative, so that (1 + 2) + 3 = 1 + (2 + 3).
However, most applications (APL being the only major exception I know)
regard 1 + 2 + 3 as meaning (1 + 2) + 3 (which might be modified by
application of commutative and associative principles to some other
arrangement--note that Ada is restrictive regarding such rearrangements
for floating point values due to the "non-real" floating-point model,
so I am not being pedantic here; another example would be an operation,
such as subtraction, which is nonassociative). Now,
(1 + 2) + 3 is 1 2 + 3 + in infix
whereas
1 + (2 + 3) is 1 2 3 + + in infix.
> Sho
Howard W. LUDWIG
Working (but not speaking) for Lockheed Martin Electronics & Missiles
Co.
next prev parent reply other threads:[~1997-11-07 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-11-02 0:00 Please read this..thank you Sho
1997-11-02 0:00 ` Robert S. White
1997-11-07 0:00 ` Howard W. LUDWIG [this message]
1997-11-10 0:00 ` John M. Mills
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox