OILS / asdl / examples / typed_arith.asdl View on Github | oilshell.org

18 lines, 15 significant
1module arith {
2
3 pipeline = (bool negated)
4
5 arith_expr =
6 NoOp
7 | Const(int i) --
8 | Big(BigInt b) --
9 | Var(string name) -- eval variable
10 | Unary(string op, arith_expr a)
11 | Binary(string op, arith_expr left, arith_expr right)
12 | Ternary(arith_expr cond, arith_expr true_expr, arith_expr false_expr)
13 | FuncCall(string name, arith_expr* args)
14 | Index(arith_expr a, arith_expr index)
15 -- Using Python's style for now. Bash uses length instead of end.
16 | Slice(arith_expr a, arith_expr? begin, arith_expr? end, arith_expr? stride)
17}
18