def hic(source): llsource = str(compiler(parse(lex(source)))) _, s = mkstemp('.s') interpreter = Popen(('llc', '-o', s), stdin=PIPE) interpreter.communicate(llsource) assert interpreter.returncode == 0, interpreter.returncode clang = Popen(('clang', s)) clang.wait() assert clang.returncode == 0, clang.returncode os.unlink(s)
def test_compile_null(): assert str(compiler(ast.Module())) == '''\
def test_compile_print(): assert str(compiler(ast.Module(ast.Print(), ast.String(' butt')))) == '''\
def test_compile_hello(): assert str(compiler(ast.Module(ast.Hello()))) == '''\
def hello(source): return interpret(str(compiler(parse(lex(source)))))