From: CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 5-MAR-1989 00:29 To: MRGATE::"ARISIA::EVERHART" Subj: Thoughts On Mathmatical Expression Analysis And SIG Tapes... Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Sat, 4 MAR 89 21:02:55 PDT Received: from central.cis.upenn.edu by KL.SRI.COM with TCP; Sat, 4 Mar 89 20:55:48 PST Received: from LINC.CIS.UPENN.EDU by central.cis.upenn.edu id AA07592; Sat, 4 Mar 89 23:51:45 -0500 Received: from XRT.UPENN.EDU by linc.cis.upenn.edu id AA19409; Sat, 4 Mar 89 23:59:29 EST Posted-Date: Sat, 4 Mar 89 23:56 EDT Message-Id: <8903050459.AA19409@linc.cis.upenn.edu> Date: Sat, 4 Mar 89 23:56 EDT From: "Clayton, Paul D." Subject: Thoughts On Mathmatical Expression Analysis And SIG Tapes... To: INFO-VAX@KL.SRI.COM X-Vms-To: @INFOVAX,CLAYTON There was a recent request for a 'real-time' mathmatical expression parser and evaluator that brought back a flood of memories, good and bad. Some years ago, I was designing, coding and installing a multiuser telemarketing system that was VAX/VMS based. Had an 11/750 all lined up and ready to support the 32 terminals that the people doing the dialing were to look at and read from. Then they threw a nasty curve and said that certain 'scripts' required that the terminal operator enter some data and a result be calulated and posted someplace else. After looking at the problem for a day, I quickly determined that a calculator is a remarkable tool when one ponders the intricate details of standard math rules. The 'confusion' factor when following the order that operations are to be done in and then add in the '(' and ')' characters and the result is a migrane. I still think the first four (4) function calculator I got in 1973, for opening a new bank account AND paying $52.00+-, was a good deal. Anyway... I am not one to reinvent the wheel, and my personal collection of RSX/IAS and VAX SIG tapes looked promising. Looking for something on these tapes is not as hard as it appears. The VAX SIG Tape Copy group does an excellant job (thanks to Glenn Everhart and company) creating the tapes and all versions have a VAX000 save set within which are the AAAREADME.* files from x number of previous tapes. I just looked at the 88 Spring tape and the AAAREADME files date back to the REAL early 1980's. It turned out that on the VAX SIG Spring 1984 tape in the directory [VAX84A.CSC.EXP] there is a mathmatical expression parser and evaluator that will handle any legal math equation, including the great '(' and ')' rule breakers! This gem was written by Dennis Fitzgerald, who at time worked for CSC, Baltimore Maryland USA. I have not found any newer version of this submission. It uses the LIB$TPARSE routines and generates an internal RPN (reverse Polish notation) version of the equation that can then be immediately evaluated or saved and looked at later. Also included was a symbol table manager, using the B-Tree utilities of VAX/VMS, and an interface into the evaluator so that user 'symbols/variables' could be stored and later looked up at the time of evaluation. I used it back then and had no problems getting it to work with my application, which saved weeks/months by not having to develop one myself. If you are interested, try and find the tape. If you can not find the tape but want the routines, drop a line and I will get the parts into VMS_SHARE format. I have included the tables of supported functions and operations that this package will handle at the bottom of this message. The data types which are supported is as follows. byte integer*2 integer*4 real*4 real*8 Hope this helps with the mathmatical problem and also gets more users interested in the SIG tapes. They are a GREAT resource!! Now if only the wife will ease up about the 30 some tapes, and growing, that I keep at home, and the kid will stop using the tape(s) as a toy for the cat... ;-) Have fun... pdc Paul D. Clayton Address - CLAYTON%XRT@RELAY.UPENN.EDU Disclaimer: All thoughts and statements here are my own and NOT those of my employer, and are also not based on, or contain, restricted information. Table 2 -- Unary Operations operation code symbol --------- ---- ------ negation 1 - arccosine 2 acos arcsine 3 asin arctangent 4 atan cosine 5 cos sine 6 sin tangent 7 tan arccosine (degrees) 8 acosd arcsine (degrees) 9 asind arctangent (degrees) 10 atand cosine (degrees) 11 cosd sine (degrees) 12 sind tangent (degrees) 13 tand square root 14 sqrt exponential 15 exp natural logarithm 16 log common logarithm 17 log10, alog10 absolute value 18 abs integer value 19 int nearest integer value 20 nint real*4 value 21 real, float zero extend 22 zext real*8 value 23 dble Table 3 -- Binary Operations operation code symbol --------- ---- ------ addition 1 + subtraction 2 - exponentiation 3 ** multiplication 4 * division 5 /