Skip to content

Instantly share code, notes, and snippets.

@gregglind
Created April 1, 2011 21:04
Show Gist options
  • Save gregglind/898856 to your computer and use it in GitHub Desktop.
Save gregglind/898856 to your computer and use it in GitHub Desktop.
class Instruction(object):
def __init__(**kwargs):
for k,v in kwargs.items():
self.k = v
def __repr__(self):
return "%s %r" % (self.__class__, self.__dict__)
def __call__(self,memory):
# do whatever it is that this thing does, returning (a copy of) the memory
return memory
class Store(Instruction):
def __init__(self,....):
# if you want to get fancy here with params, do so
def __call__(self,memory):
# do whatever store does
set_word(memory,self.position, self.value) # or whatever!
return memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment