basically follows LISP notation but written with C-like function call semantics. Example: f1(1,b,c).f2(d,e,f).f3(w)
Dot (.
) separated function calls will compose to left thread ->
call: ["->",["f1",1,"b","c"],["f2","d","e","f"],["f3","w"]]
Semicolon (;
) separated function calls will compose to begin
call: ["begin",["f1",1,"b","c"],["f2","d","e","f"],["f3","w"]]
Arrays notation []
will result in [
call: [1,2,3]
=> ["[","1","2","3"]
Some functions will have special syntax for their arguments. Currently only logical
syntax is supported.
For example, it is used for where
function, which has single logical expression argument with 3 operations: and
, or
, not
.
Logical operations may use any LPE expression as argumants. Brackets are preserved with call to obvious ()
function.
where((a and b or c) or (avg(d) < avg(e)) or (e = 20 and parse_kv(locations.src_id)))
[
"where",
[
"or",
[
"()",
[
"and",
"a",
[
"or",
"b",
"c"
]
]
],
[
"or",
[
"()",
[
"<",
[
"avg",
"d"
],
[
"avg",
"e"
]
]
],
[
"()",
[
"and",
[
"=",
"e",
20
],
[
"parse_kv",
[
"->",
"locations",
"src_id"
]
]
]
]
]
]
]
Note, that dot notation in arguments locations.src_id
is currently interpreted as ->
call.
echo "FIRST([in([6+abc().cba()*3+2,6+8],out()),[45,44],444]).SECOND(.fff(2,3,4,,3+5-987).last())" | npm run cli
Run tests:
npm install
npm run test
npm run test-sql