Repository navigation
Expand file tree
/
Copy pathbnf
More file actions
62 lines (47 loc) · 2.4 KB
/
Copy pathbnf
File metadata and controls
62 lines (47 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<program> ::= <statements> <sys_result>?
<statements> ::= <statement> <statements> | ε
<statement> ::= <schema> | <query>
<schema> ::= <ident> "{" <fields> "}"
<fields> ::= <field> ("," <field>)* | ε
<field> ::= <ident> <field_type>
<field_type> ::= "String" | "Int8" | "Float" | "Bool" | "DateTime"
| "GeoPoint" ("(" "grid" ":" "{" "resolution" ":" <string> "}")")?
| <ident> // Reference to another schema (e.g., Profession, Industry)
<ident> ::= [a-zA-Z_][a-zA-Z0-9_]*
<string> ::= "\"" [^"]* "\""
<query> ::= <ident> "=" <source> <operator_chain>?
<source> ::= <ident> ("::" <ident>)?
<operator_chain> ::= "::" <operator> <operator_chain>?
<operator> ::= "filter" "{" <condition> "}"
| "geo_within" "{" "field" ":" <field_path> "," "bounds" ":" "{" <bounds> "}" "}"
| "lead" "{" "name" ":" <ident> "," "field" ":" <field_path> "," "offset" ":" <number> ("," "order" "by" <order_by>)? "}"
| "select" "{" <select_fields> "}"
| "batch_insert" "[" <insert_values> "]"
<condition> ::= <expr> <op> <expr>
<op> ::= "==" | "!=" | ">" | "<" | ">=" | "<="
<expr> ::= <field_path> | <literal> | <arith_expr> | <func_call>
<field_path> ::= "." <ident> ("." <ident>)*
<literal> ::= <string> | <number> | "true" | "false" | "null" | <object>
<number> ::= "-"? [0-9]+ ("." [0-9]+)?
<select_fields> ::= <select_field> ("," <select_field>)*
<select_field> ::= <ident> (":" <expr>)?
<arith_expr> ::= <literal> "-" <field_path>
<func_call> ::= "count" "(" <field_path> ")"
<sys_result> ::= "sys" "::" "result" "{" <result_map> "}"
<result_map> ::= <ident> ":" <ident> ("," <ident> ":" <ident>)* | ε
<program> ::= <statements> <sys_result>?
<statements> ::= <statement> <statements> | ε
<statement> ::= <schema> | <query>
<schema> ::= <ident> "{" <fields> "}"
<query> ::= <ident> "=" <source> <operator_chain>?
<source> ::= <ident> ("::" <ident>)?
<operator_chain> ::= "::" <operator> <operator_chain>?
<operator> ::= "filter" "{" <condition> "}"
| "geo_within" "{" "field" ":" <field_path> "," "bounds" ":" "{" <bounds> "}" "}"
| "lead" "{" "name" ":" <ident> "," "field" ":" <field_path> "," "offset" ":" <number> ("," "order" "by" <order_by>)? "}"
| "select" "{" <select_fields> "}"
| "batch_insert" "[" <insert_values> "]"
// function syntax
fn <name>(<param>: <type>, ...) -> <return_type> {
<query_body>
}