EngineSQL-Inspired Rules / SQX

Syntax

Write source that matches the current line-based SQX parser.

Keep each complete rule on one physical line. The editor and compiler process lines independently; wrapping a rule before THEN can create a condition-only line and an invalid action line.

Declarations and conditional rules

IF order type="market" action="buy" size=1 transmit=false
TICK price > 50 THEN order SET note="above threshold", transmit=false

IF configures a model. Its parameters are space-separated key=value pairs. IF POS selects a position declaration; IF TICK explicitly selects the default tick declaration. Choose the type supported by the model.

TICK and POS select a conditional rule's runtime branch. WITH supplies calculation parameters; SET supplies target-property values. Both use comma-separated parameters.

TICK sma WITH minutes=3 > sma WITH minutes=10 THEN order SET note="fast above slow", transmit=false

The order target in this line must already be configured, for example by the declaration above.

Formatting rules

Use uppercase structural keywords: IF, TICK, POS, WITH, AND, THEN, SET, and FINAL. Some prefix checks tolerate case, but the parser is not consistently case-insensitive.

Put spaces around comparison operators and structural keywords. Keep assignment pairs together, such as minutes=3. Model/property identifiers start with a letter and contain letters or digits; dotted member access and underscore names are not general expression syntax.

Use numbers, booleans, and quoted scalar strings. Quote time and timezone values. An unquoted identifier on a comparison's right side is interpreted as another model, so quote literal directions such as "buy".

This is not a general expression evaluator: arithmetic, variable interpolation, function calls, parentheses, nested groups, and SQL clauses such as SELECT/FROM are not part of this text grammar. Avoid commas inside parameter strings and keyword separators inside quoted values; the parser is not a full escaping-aware language parser.

Comments and blank lines

Use whole-line comments beginning with --- , as in the getting-started example. Blank lines are allowed. Do not rely on ordinary SQL -- or trailing inline comments.

Validation has layers

A syntactically accepted model or property name may still be unknown to the runtime. The compiler creates configuration; it does not establish that every model, parameter, action, or data dependency exists.

The low-level compiler filters out unparseable lines. Agent Lab separately validates every line and fails the run on invalid SQX. Check the editor's diagnostics instead of treating partial compiled output as a successful source validation.

Continue with conditions.

On this page