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