formula solver 6/7

 BBS: Inland Empire Archive
Date: 03-13-93 (22:27)             Number: 339
From: QUINN TYLER JACKSON          Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: formula solver 6/7             Conf: (2) Quik_Bas
'>>> Start of page 6.

' This part expands any TOKEN$ that is a factorial
Suffix$ = RIGHT$(TOKEN$, 1)
IF Suffix$ = "!" THEN ' expand the factorial to something more chewable!
    Factorial = VAL(TOKEN$)
    Temp = 1
    FOR i = 1 TO Factorial
        Temp = Temp * i
    NEXT i
    TOKEN$ = STR$(Temp)
END IF

END SUB

SUB sqjLevel1 (r)

' See if something of a higher precedence should be done
first. CALL sqjLevel2(r)

Op$ = TOKEN$

' The lowest level of precedence is handled by this Level.

DO WHILE fqjInOpList(LOGICAL, Op$)
    CALL sqjGetOp
    CALL sqjLevel2(h)
    CALL sqjApplyOp(Op$, r, h)
    Op$ = TOKEN$
LOOP

END SUB

SUB sqjLevel2 (r)

' See if something of a higher precedence should be done
first. CALL sqjLevel3(r)
Op$ = TOKEN$

DO WHILE fqjInOpList(ADDSUB, Op$)
    CALL sqjGetOp
    CALL sqjLevel3(h)
    CALL sqjApplyOp(Op$, r, h)
    Op$ = TOKEN$
LOOP

END SUB

SUB sqjLevel3 (r)

' See if something of a higher precedence should be done
first. CALL sqjLevel4(r)
Op$ = TOKEN$

DO WHILE fqjInOpList(MULTDIV, Op$)
    CALL sqjGetOp
    CALL sqjLevel4(h)
    CALL sqjApplyOp(Op$, r, h)
    Op$ = TOKEN$
LOOP

END SUB

SUB sqjLevel4 (r)

' See if something of a higher precedence should be done
first. CALL sqjLevel5(r)

'>>> Continued on page 7.

--- Maximus/2 2.01wb
 * Origin: The Nibble's Roost, Richmond BC Canada 604-244-8009 (1:153/918)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET