+ elif instruction == 'push_symbol':
+ assert argument.startswith('sym(')
+ assert argument.endswith(')')
+
+ result = SYMBOL_TABLE.get(argument)
+ if not result:
+ result = Symbol(name=argument[4:-1])
+ SYMBOL_TABLE[argument] = result
+
+ stack.append(result)
+
+ elif instruction == 'structure':
+ kvps = []
+
+ for i in range(argument):
+ key = stack.pop()
+ value = stack.pop()
+ kvps.append((key.name, value))
+
+ keys = tuple(reversed(list(k for k,v in kvps)))
+ result = collections.namedtuple('Structure', keys)(**dict(kvps))
+
+ stack.append(result)
+