import phylanx # A + B A = phylanx.ast.identifier('A') B = phylanx.ast.identifier('B') expr = phylanx.ast.expression(A) expr.append(phylanx.ast.operation(phylanx.ast.optoken.op_plus, B)) print(expr) ast = phylanx.ast.generate_ast('A + B') print(ast) def visitor(ast): print(ast) return True phylanx.ast.traverse(ast, visitor)