コード例 #1
0
def run_string(string):
    tokens = OysterScanner(string).tokenize()
    statements = OysterParser().parse(tokens)
    instructions = [
        Instruction(Instruction.CODE, statement)
        for statement in statements.items
    ]
    instructions.reverse()
    env = populate_globals(Env(None, None))
    stack = [StackFrame(instructions, env)]
    cur = None
    while stack:
        cur = eval(stack, cur)

    print "Result is", cur.__str__()
コード例 #2
0
ファイル: test_case.py プロジェクト: diiq/oyoy
 def setUp(self):
     self.env = populate_globals(Env(None, None))
コード例 #3
0
ファイル: test_environment.py プロジェクト: diiq/oyoy
 def setUp(self):
     self.lexical_environment = Env(None, None)
     self.calling_environment = Env(None, None)
     self.local = Env(self.lexical_environment, self.calling_environment)