コード例 #1
0
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)
コード例 #2
0
def test_compile_null():
    assert str(compiler(ast.Module())) == '''\
コード例 #3
0
def test_compile_print():
    assert str(compiler(ast.Module(ast.Print(), ast.String(' butt')))) == '''\
コード例 #4
0
def test_compile_hello():
    assert str(compiler(ast.Module(ast.Hello()))) == '''\
コード例 #5
0
def hello(source):
    return interpret(str(compiler(parse(lex(source)))))