def execNCall(): nmod = lookup(inst.reg1) nfunc = lookup(inst.reg2) nargs = lookup(inst.reg3) # print "nmod: ", nmod # print "nfunc: ", nfunc # print "nargs: ", nargs glob = util.doImports([nmod]) execString = 'return ' + nmod + "."+nfunc+"(**n1)" # print "execString: ", execString func = util.createFunction(name = util.uniqueIdentifier(), args = ["n1"], code = execString, env=glob) define(inst.ret,func(nargs))
def preprocess (gram): '''Returns the tuple: ( [ (regex, lhs) ], # pattern/token list ) WARNING: modifies GRAM argument. ''' #print gram.startSymbol REGEX = re.compile ('') terminals = [] renamedTerminals = {} epsilons = [] # Import all the grammar's modules into a new global object try: glob = util.doImports (gram.imports) except Exception, e: util.error ('problem importing %s: %s' % (gram.imports, str(e))) sys.exit(1)
def preprocess (gram): '''Returns the tuple: ( [ (regex, lhs) ], # pattern/token list ) WARNING: modifies GRAM argument. ''' REGEX = re.compile ('') terminals = [] renamedTerminals = {} epsilons = [] # Import all the grammar's modules into a new global object try: glob = util.doImports (gram.imports) except Exception, e: util.error ('problem importing %s: %s' % (gram.imports, str(e))) sys.exit(1)