Esempio n. 1
0
 def makeSemantFunc (code, numArgs, globalObject):
     args = ['n0']
     for i in xrange (numArgs):
         args.append ('n%d'% (i+1))
     try:
         return util.createFunction (util.uniqueIdentifier (),
                                     args, code, globalObject)
     except Exception, e:
         util.error ("couldn't create semantic function: " + str(e))
         sys.exit(1)
Esempio n. 2
0
 def makeSemantFunc (code, numArgs, globalObject):
     args = ['n0']
     for i in xrange (numArgs):
         args.append ('n%d'% (i+1))
     try:
         return util.createFunction (util.uniqueIdentifier (),
                                     args, code, globalObject)
     except Exception, e:
         util.error ("couldn't create semantic function: " + str(e))
         sys.exit(1)
 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))