예제 #1
0
파일: pypy_target.py 프로젝트: diiq/oyoy
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
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__()
예제 #3
0
파일: test_case.py 프로젝트: diiq/oyoy
 def setUp(self):
     self.env = populate_globals(Env(None, None))
예제 #4
0
파일: test_case.py 프로젝트: diiq/oyoy
 def setUp(self):
     self.env = populate_globals(Env(None, None))