agtest/test/arith.ag

17 lines
252 B
Text
Raw Permalink Normal View History

2021-06-09 05:10:45 +00:00
iface HasValue {
2021-06-14 20:52:53 +00:00
val: int,
2021-06-09 00:56:30 +00:00
}
2021-06-09 05:10:45 +00:00
node Expr : HasValue {
2021-06-14 20:52:53 +00:00
<l:Expr> "+" <r:Expr> => {
2021-09-30 22:39:08 +00:00
self.val = l.val + r.val;
2021-06-14 20:52:53 +00:00
}
2021-09-30 22:39:08 +00:00
2021-06-14 20:52:53 +00:00
<l:Expr> "*" <r:Expr> => {
self.val = l.val * r.val;
}
2021-09-30 22:39:08 +00:00
2021-09-30 20:32:32 +00:00
<n:"[0-9]+"> => { self.val = parseInt(n); }
2021-06-09 00:56:30 +00:00
}
2021-09-30 22:39:08 +00:00