~magnusmorton/delayrepay

52b44eedbbb73917cb14423176efc106bb29b470 — Magnus Morton 5 months ago ee1c9c9
added cpu.py
1 files changed, 18 insertions(+), 0 deletions(-)

A delayrepay/cpu.py
A delayrepay/cpu.py => delayrepay/cpu.py +18 -0
@@ 0,0 1,18 @@
from .visitor import Visitor


class CpuVisitor(Visitor):
    def visit_NPArray(self, node):
        return node.array

    def visit_Scalar(self, node):
        return node.val

    def visit_UnaryFuncEx(self, node):
        return node.func(*self.visit(node.children))

    def visit_BinaryFuncEx(self, node):
        return node.func(*self.visit(node.children))

    def visit_BinaryNumpyEx(self, node):
        return node.func(*self.visit(node.children))