16 lines
252 B
Text
16 lines
252 B
Text
iface HasValue {
|
|
val: int,
|
|
}
|
|
|
|
node Expr : HasValue {
|
|
<l:Expr> "+" <r:Expr> => {
|
|
self.val = l.val + r.val;
|
|
}
|
|
|
|
<l:Expr> "*" <r:Expr> => {
|
|
self.val = l.val * r.val;
|
|
}
|
|
|
|
<n:"[0-9]+"> => { self.val = parseInt(n); }
|
|
}
|
|
|