TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Erik Huelsmann
from: David Noon
date: 1996-05-14 22:03:04
subject: Converting infix to post

On Friday, 96/05/10, Erik Huelsmann wrote to all about "Converting
infix to postf" as follows:

EH> I am looking for some routine that (helps me or does 
EH> itself) converts infix-math-expressions to postfix-math-
EH> expressions.

Hi Erik,

The algorithm is known as the Bauer-Samuelson algorithm. It has been
widely published since the early 1960's. The reference I last used (c.
1974) was "A Compiler Generator" by McKeeman, Horning and Wortman.

EH> If anybody knows a goed book on expression evaluation, I 
EH> would like to know that too. Little problem is the fact 
EH> that I use pascal, but I can read C(++) code.

The above book covers all sorts of stuff like that. The samples are in
McKeeman's language he called XPL. It should be fairly easy for a
Pascal programmer to read, since it is a very trimmed down dialect of
PL/I. [I.e., it's block structured.]

EH> The expression I want to get to work first is:
EH> 
EH>  X*(X'*X)^(-1)*X'*y
EH> 
EH> Yes, it is regression, but don't mind that. I know it has to be
EH> converted to:

As a statistician I recognise the normal equations immediately.
Remember that these are matrices and vectors, and therefore
multiplication is not necessarily commutative. [This algebra is
getting to be a bit of a drag; I've recently posted some similar stuff
on commutative/associative (or not) arithmetic operations in the
C_echo.] Your scope to reorder things is exceedingly limited in a matrix
domain.

Regards

Dave


 * KWQ/2 1.2i * Snail (n): a greyhound programmed in Visual BASIC.
--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1
@PATH: 440/4 141/209 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.