def __init__(self):
        # Declare attributes

        inh(A, 'value')

        eq(Node, 'value', lambda n: 77)
        eq(Node, 'value', lambda n: -1)
    def __init__(self):
        # Declare attributes

        inh(Node, "inhAttr")

        eq(Root, "inhAttr", lambda n: -1)
        eq(Node, "inhAttr", lambda n: 0)
Example #3
0
    def __init__(self):
        # Declare attributes

        # Global min attribute
        inh(Node, "globalmin")

        # First Argument is the node that is to contain the equation
        eq(Program, 'globalmin', lambda n: 42)
Example #4
0
    def __init__(self):
        # Declare attributes

        syn(Transition, "source_attribute", lambda n: n.source)
        syn(Transition, "target_attribute", lambda n: n.target)

        inh(Declaration, "lookup")

        eq(StateMachine, "lookup",
           lambda n, label: MinTree.lookup_equation(n, label))

        #syn(State, "localLookup", lambda n: None)

        eq(State, "localLookup",
           lambda n, label: MinTree.local_lookup_equation(n, label))
Example #5
0
    def __init__(self):
        # Declare attributes

        # Global min attribute
        inh(Node, "globalmin")

        # First Argument is the node that is to contain the equation
        eq(Program, 'globalmin', lambda n: Program.node.localmin())

        # Local min attributes
        syn(Program, "localmin")
        syn(Leaf, "localmin")
        syn(Pair, "localmin")

        # Define their equations
        eq(Leaf, 'localmin', lambda x: x.value)
        eq(Pair, 'localmin',
           lambda x: min(x.left.localmin(), x.right.localmin()))
        eq(Program, 'localmin', lambda x: 0)
    def __init__(self):
        # Declare attributes

        # Local min attributes
        syn(Program, "localmin")
        syn(Leaf, "localmin")
        syn(Pair, "localmin")

        # Define their equations
        eq(Leaf, 'localmin', lambda x: x.value)
        eq(Pair, 'localmin',
           lambda x: min(x.left.localmin(), x.right.localmin()))
        eq(Program, 'localmin', lambda x: 0)
Example #7
0
    def __init__(self):
        # Declare attributes

        # Final computation
        inh(Expr, "finalCalc")

        # First Argument is the node that is to contain the equation
        eq(Program, 'finalCalc', lambda n: n.node.localCalc())

        # Local computation
        syn(Mul, "localCalc")
        syn(Add, "localCalc")
        syn(Div, "localCalc")
        syn(Sub, "localCalc")
        syn(Numeral, "localCalc")

        # Define their equations
        eq(Mul, 'localCalc',
           lambda x: x.left.localCalc() * x.right.localCalc())
        eq(Add, 'localCalc',
           lambda x: x.left.localCalc() + x.right.localCalc())
        eq(Div, 'localCalc',
           lambda x: x.left.localCalc() / x.right.localCalc())
        eq(Sub, 'localCalc',
           lambda x: x.left.localCalc() - x.right.localCalc())
        eq(Numeral, 'localCalc', lambda x: x.value)
    def __init__(self):
        # Declare attributes

        inh(Node, 'root')

        eq(Root, 'root', lambda n: n)