示例#1
0
def main():
    
    strm = sys.stdin
    theScanner = calcscanner.calcScanner(strm)
    theParser = calcparser.calcParser()
    
    ast = theParser.parse(theScanner)
示例#2
0
def main():

    #strm = sys.stdin
    strm = io.StringIO("457+300+300;")
    theScanner = calcscanner.calcScanner(strm)
    '''while True:
        tokenId, lex = theScanner.getToken()
        print(tokenId,lex)
        if tokenId == 10:
            return'''

    theParser = calcparser.calcParser()
    ast = theParser.parse(theScanner)
示例#3
0
def main():

    if (len(sys.argv)) != 2:
        print("usage: calc filename")
        print(
            "   calc will interpret/compile the expression in the file named")
        print("   filename and print its result to standard output")
        return

    strm = open(sys.argv[1], "r")
    theScanner = calcscanner.calcScanner(strm)
    theParser = calcparser.calcParser()

    ast = theParser.parse(theScanner)
    print(ast)
def main():

    # unless testing, it should be sys.stdin
    #strm = io.StringIO("457+321")

    print(
        "Enter expressions with +,-,*,/,S (for store), and R (for recall) and terminated by a semicolon (i.e. ;)."
    )

    strm = sys.stdin
    theScanner = calcscanner.calcScanner(strm)
    '''
    while True:
        tokenId, lex = theScanner.getToken()
        print(tokenId, lex)
        if tokenId == 10:
            return
	'''

    theParser = calcparser.calcParser()

    ast = theParser.parse(theScanner)
def main():
    
    strm = sys.stdin
    theScanner = calcscanner.calcScanner(strm)
    theParser = calcparser.calcParser()
    ast = theParser.parse(theScanner)