Guest User

Untitled

a guest
Jan 3rd, 2012
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Function(object):
  2.     def __init__(self, name, code=None):
  3.         self.name = name
  4.         self.code = []
  5.         self.labels = {}
  6.  
  7.         if code is not None:
  8.             self.load(code)
  9.    
  10.     def load(self, code):
  11.         pc = 0
  12.        
  13.         for inst in code:
  14.             if inst[0] == "label":
  15.                 label = inst[1]
  16.                 self.labels[label] = pc
  17.             else:
  18.                 self.code.insert(pc, inst)
  19.                 pc += 1
  20.    
  21.     def label(self, label):
  22.         return self.labels[label]
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×