Skip to content

Commit af9e344

Browse files
committed
add-reame-lang-ref
Signed-off-by: yaacov <[email protected]>
1 parent d7905bd commit af9e344

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

README_language.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Tree Search Language (TSL) Reference
2+
3+
A quick overview of TSL syntax, operators, literals and identifiers.
4+
5+
## 1. Basic Structure
6+
7+
- Expressions combine identifiers, literals, operators and parentheses:
8+
```
9+
(field1 = 'value' OR field2 > 10) AND NOT field3 IN [1,2,3]
10+
```
11+
12+
## 2. Identifiers
13+
14+
- Start with a letter or underscore, may include letters, digits, `_`, `.`, `/`, `-`
15+
- Array suffixes: `[index]`, `[*]`, `[name]`
16+
- Examples:
17+
```
18+
name
19+
user.age
20+
pods[0].status
21+
services[my.service].ip
22+
```
23+
24+
## 3. Literals
25+
26+
- String: `'text'`, `"text"`, `` `text` ``
27+
- Numeric: integer, decimal, scientific, with optional SI suffix (`Ki`, `M`, etc.)
28+
- Date/Time: `YYYY-MM-DD` or RFC3339 `YYYY-MM-DDThh:mm:ssZ`
29+
- Boolean: `true`, `false`
30+
- Null: `null`
31+
- Arrays: `[expr, expr, ...]`
32+
33+
## 4. Operators
34+
35+
1. Logical
36+
- `AND`, `OR`, `NOT`
37+
2. Comparison
38+
- `=`, `!=`, `<`, `<=`, `>`, `>=`
39+
3. Pattern
40+
- `LIKE`, `ILIKE` (case‑insensitive), `~=` (regex match), `~!` (regex not match)
41+
4. Membership
42+
- `IN`, `NOT IN`, `BETWEEN … AND …`
43+
5. Arithmetic
44+
- `+`, `-`, `*`, `/`, `%`
45+
6. Array functions
46+
- `LEN x`, `ANY x`, `ALL x`, `SUM x`
47+
48+
## 5. Precedence (high→low)
49+
50+
1. Unary: `NOT`, `LEN`, `ANY`, `ALL`, `SUM`, unary `-`
51+
2. `*`, `/`, `%`
52+
3. `+`, `-`
53+
4. `IN`, `BETWEEN`, `LIKE`, `ILIKE`, `IS`, etc.
54+
5. Comparisons: `=`, `!=`, `<`, `<=`, `>`, `>=`, `~=`, `~!`
55+
6. `AND`
56+
7. `OR`
57+
58+
## 6. Examples
59+
60+
```sql
61+
# combine filters
62+
(name LIKE '%joe%' OR city = 'milan') AND age BETWEEN 20 AND 30
63+
64+
# array operations
65+
tags IN ['a','b','c']
66+
SUM scores > 100
67+
ANY (values > 5)
68+
69+
# date comparison
70+
created_at >= '2021-01-01T00:00:00Z'
71+
```

0 commit comments

Comments
 (0)