Here is some RakuAST. It behaves a bit differently than you'd expect:
use MONKEY-SEE-NO-EVAL;
my $ast = RakuAST::ApplyInfix.new(
left => RakuAST::IntLiteral.new(44),
infix => RakuAST::Infix.new('+'),
right => RakuAST::IntLiteral.new(22)
);
$ast.left.value.say;
$ast.infix.operator.say;
$ast.right.value.say;
my $r = EVAL $ast;
$r.say;
$ast.infix.^attributes[0].set_value($ast.infix, '*');
$ast.left.value.say;
$ast.infix.operator.say;
$ast.right.value.say;
$r = EVAL $ast;
$r.say;
say '----';
my $new-ast = RakuAST::ApplyInfix.new(
left => $ast.left,
infix => RakuAST::Infix.new('*'),
right => $ast.right
);
$r = EVAL $new-ast;
$r.say;
It outputs:
44
+
22
66
44
*
22
66
----
968
Note that the 968 should replace the 66 above the '---'. It didn't. I had to recreate the node.
Was this intentional?