ordo-expression-syntax
Skill37 starsChanged 10 months agoMITView on GitHub
Ordo expression syntax quick reference. Includes comparison operators, logical operators, built-in functions, conditional expressions, field access syntax. Use for writing rule conditions, calculating output values, data transformation.
In this repository6 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ordo-editor-componentSkill
- ordo-jit-optimizationSkill
- ordo-rule-developmentSkill
- ordo-server-deploymentSkill
- ordo-testingSkill
The file
Files
Ordo Expression Syntax
Operators
Comparison Operators
| Operator | Description | Example |
== | Equal | status == "active" |
!= | Not equal | status != "banned" |
> | Greater than | age > 18 |
>= | Greater or equal | balance >= 1000 |
< | Less than | price < 100 |
<= | Less or equal | level <= 5 |
Logical Operators
| Operator | Description | Example |
&& | And | age >= 18 && active == true |
|| | Or | vip == true || points > 1000 |
! | Not | !is_blocked |
Arithmetic Operators
| Operator | Description | Example |
+ | Addition | price + tax |
- | Subtraction | total - discount |
* | Multiplication | quantity * price |
/ | Division | total / count |
% | Modulo | index % 2 |
Field Access
Dot Notation
user.name
user.profile.level
order.items[0].priceArray Indexing
items[0]
matrix[1][2]
users[index]Safe Access (coalesce)
coalesce(user.nickname, user.name, "Anonymous")Built-in Functions
String Functions
| Function | Description | Example |
len(s) | String length | len(name) > 0 |
upper(s) | To uppercase | upper(code) == "VIP" |
lower(s) | To lowercase | lower(email) |
trim(s) | Trim whitespace | trim(input) |
starts_with(s, prefix) | Prefix match | starts_with(url, "https") |
ends_with(s, suffix) | Suffix match | ends_with(file, ".pdf") |
contains_str(s, sub) | Contains substring | contains_str(desc, "urgent") |
substring(s, start, end) | Extract substring | substring(code, 0, 3) |
Math Functions
| Function | Description | Example |
abs(n) | Absolute value | abs(diff) < 0.01 |
min(a, b, ...) | Minimum | min(price, max_price) |
max(a, b, ...) | Maximum | max(0, balance) |
floor(n) | Floor | floor(rating) |
ceil(n) | Ceiling | ceil(price) |
round(n) | Round | round(average) |
Array Functions
| Function | Description | Example |
len(arr) | Array length | len(items) > 0 |
sum(arr) | Sum of array | sum(prices) >= 100 |
avg(arr) | Average | avg(scores) > 60 |
count(arr) | Element count | count(orders) |
first(arr) | First element | first(results) |
last(arr) | Last element | last(history) |
Type Functions
| Function | Description | Example |
type(v) | Get type | type(value) == "string" |
is_null(v) | Is null | is_null(optional) |
is_number(v) | Is number | is_number(input) |
is_string(v) | Is string | is_string(data) |
is_array(v) | Is array | is_array(items) |
Conversion Functions
| Function | Description | Example |
to_int(v) | To integer | to_int(str_num) |
to_float(v) | To float | to_float(price) |
to_string(v) | To string | to_string(code) |
Time Functions
| Function | Description | Example |
now() | Current timestamp (seconds) | now() - created_at > 86400 |
now_millis() | Current timestamp (milliseconds) | now_millis() |
Conditional Expressions
if-then-else
if condition then value1 else value2Examples:
if exists(discount) then price * (1 - discount) else price
if vip == true then 0.2 else 0.05
if age >= 18 then "adult" else "minor"exists Check
if exists(user.nickname) then user.nickname else user.nameNested Conditions
if tier == "gold" then 0.2
else if tier == "silver" then 0.1
else 0.05Literals
Numbers
42 # Integer
3.14 # Float
-100 # NegativeStrings
"hello"
"it's ok"
"line1\nline2"Booleans
true
falseNull
nullRust API
Parsing Expressions
use ordo_core::prelude::*;
let parser = ExprParser::new();
let expr = parser.parse("age >= 18 && status == \"active\"")?;Evaluation
let evaluator = Evaluator::new();
let context = Context::from_json(r#"{"age": 25, "status": "active"}"#)?;
let result = evaluator.eval(&expr, &context)?;Compile to Bytecode
let compiler = ExprCompiler::new();
let compiled = compiler.compile(&expr)?;
let vm = BytecodeVM::new();
let result = vm.execute(&compiled, &context)?;Key Files
crates/ordo-core/src/expr/parser.rs- Expression parsercrates/ordo-core/src/expr/eval.rs- Expression evaluationcrates/ordo-core/src/expr/functions.rs- Built-in functionscrates/ordo-core/src/expr/ast.rs- AST definitions
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

