Exemple #1
0
 def all_rl(expr):
     if is_leaf(expr):
         return expr
     else:
         args = map(rule, expr.args)
         return new(type(expr), *args)
Exemple #2
0
 def top_down_rl(expr):
     newexpr = rule(expr)
     if is_leaf(newexpr):
         return newexpr
     return new(type(newexpr), *map(top_down_rl, newexpr.args))
Exemple #3
0
 def bottom_up_rl(expr):
     if is_leaf(expr):
         return rule(expr)
     else:
         return rule(new(type(expr), *map(bottom_up_rl, expr.args)))
Exemple #4
0
 def top_down_rl(expr):
     newexpr = rule(expr)
     if is_leaf(newexpr):
         return newexpr
     return new(type(newexpr), *map(top_down_rl, newexpr.args))
Exemple #5
0
 def bottom_up_rl(expr):
     if is_leaf(expr):
         return rule(expr)
     else:
         return rule(new(type(expr), *map(bottom_up_rl, expr.args)))
Exemple #6
0
 def all_rl(expr):
     if is_leaf(expr):
         return expr
     else:
         args = map(rule, expr.args)
         return new(type(expr), *args)