Exemplo n.º 1
0
def test_and():
    @apply_passes([bool_to_bit()])
    def and_f(x, y):
        return x and y

    assert inspect.getsource(and_f) == '''\
Exemplo n.º 2
0
def test_xor():
    @apply_passes([bool_to_bit()])
    def xor(x, y):
        return x and not y or not x and y

    assert inspect.getsource(xor) == '''\
Exemplo n.º 3
0
def test_or():
    @apply_passes([bool_to_bit()])
    def or_f(x, y):
        return x or y

    assert inspect.getsource(or_f) == '''\
Exemplo n.º 4
0
def test_not():
    @apply_passes([bool_to_bit()])
    def not_f(x):
        return not x

    assert inspect.getsource(not_f) == '''\
Exemplo n.º 5
0
    def __init__(self, assembler=None):
        if assembler is None:
            assembler=Assembler

        _AsmFamily.__init__(self, assembler, AssembledADT)
        _RewriterFamily.__init__(self, (ssa(), bool_to_bit(), if_to_phi(self.Bit.ite)))