agtest/arith.ag

14 lines
212 B
Text
Raw Normal View History

2021-06-09 00:56:30 +00:00
iface Node {
val: int,
}
node Expr : Node {
<l:Expr> "+" <r:Expr> => {
self.val = l.val + r.val;
}
<l:Expr> "*" <r:Expr> => {
self.val = l.val * r.val;
}
<n:r"[0-9]+"> => { self.val = parseInt(n); }
}