User and operator guide · Developer
Atlas Vector Language Specification
On this page
ConventionsLexical structureWhitespace and commentsKeywordsIdentifiers and enum symbolsOperators, delimiters, and aliasesInfix wordsLiteralsGrammarPrecedence and associativityNon-associative comparisonsis null / is not nullnot inInfix-word desugaringConstructorsMember access and callsTrailing commasParser limitsType system and static semanticsTypesAssignabilityEnumsEnum-string interoperabilityRoots and attribute accessThis page is the reference rendering of the Atlas Vector Language (AVL) normative specification. The authoritative source is Vector Language engine; where this page and that document disagree, the document wins. The specification defines language version 1.0. For the platform integration view — the enforcement surfaces each context pack drives and the lifecycle subsystems behind them — see the Atlas Vector Language page.
AVL answers four classes of questions — transformation, qualification, selection, and decision — and never acts on them. The governing principle is:
AVL computes; Atlas services act.
Conventions
-
Grammar is written in EBNF:
{ x }= zero or more,[ x ]= optional,|= alternative,"lit"= terminal. -
"MUST", "MUST NOT", "SHOULD" carry their usual normative force.
-
A diagnostic code (
AVL-XXX) names a compile-time or runtime error or warning class; the append-only list is in Diagnostics. -
Two version identifiers appear in artifacts.
LanguageVersion("1.0") is normative — it is embedded in every compiled artifact and decision trace and is the compatibility contract of this specification.CompilerVersion("avlc-1.0.1") is non-normative build metadata recorded alongside a stored compilation; it identifies a compiler build, not a language version.
Lexical structure
A source text is UTF-8. Lexing always continues past an invalid token so the parser can keep reporting; an invalid lexeme becomes an ILLEGAL token.
Whitespace and comments
Space, tab, carriage return, and newline are insignificant separators. A comment runs from // to end of line. There are no block comments.
Keywords
There are exactly eleven keywords. Keywords take precedence over identifier/enum classification.
if then else and or not in is true false null
Identifiers and enum symbols
An identifier matches [A-Za-z_]. After the keyword check, a lexeme is classified as an *enum symbol (ENUM) if and only if every character is in [A-Z0-9_] and it contains at least one uppercase letter; otherwise it is an identifier (IDENT).
-
Enum symbols:
ACTIVE,AAL3,REQUIRE_MFA,A_1. -
Identifiers:
user,_x,abc,a1. -
A lexeme with no uppercase letter (
,123) is never an enum symbol.
An enum symbol carries no intrinsic type; its enum is inferred from the expected type at the use site (see Enums).
Operators, delimiters, and aliases
Canonical operator and delimiter tokens:
== != < <= > >= + - * / % ( ) [ ] { } , . :
The following friendly aliases lex to the same token as their canonical form. The canonical spelling is chosen when the expression is rendered to canonical form (see Canonicalization and checksums).
| Alias | Canonical |
|---|---|
|
|
|
|
|
|
|
|
`pass:[ |
|
]` |
|
A lone & or | is ILLEGAL.
Infix words
The seven identifiers contains, startsWith, endsWith, matches, before, after, within remain ordinary IDENT tokens, but the parser desugars them in infix position to a same-named function call (see Infix-word desugaring). Everywhere else they are ordinary function names.
Literals
-
String: double-quoted. The only escapes are
\",\\,\n,\t. Any other\xis an error; an unterminated string (EOF or newline before the closing quote) is an error. A string literal’s value is the decoded text. -
Number:
[0-9]+ ( "." [0-9]+ )?— decimal, optional single fraction. No sign (a leading-is always the unary-minus operator), no exponent, no hex. A.not followed by a digit is not part of a number (it is member access). -
Boolean / null: the keywords
true,false,null. -
There is no dedicated duration or timestamp literal. Durations are produced only by
days()/hours()/minutes(); timestamps bynow()/parseTimestamp()or by coercion of a schema-typed attribute. Timestamp data arrives as RFC 3339 strings and is coerced by declared type.
Grammar
expr = ifExpr | orExpr ;
ifExpr = "if" expr "then" expr "else" expr ; (* else is mandatory *)
orExpr = andExpr { "or" andExpr } ;
andExpr = notExpr { "and" notExpr } ;
notExpr = "not" notExpr | comparison ;
comparison = additive [ compOp additive | "not" "in" additive | isClause | infixWord additive ] ;
compOp = "==" | "!=" | "<" | "<=" | ">" | ">=" | "in" ;
isClause = "is" [ "not" ] "null" ;
infixWord = "contains" | "startsWith" | "endsWith" | "matches" | "before" | "after" | "within" ;
additive = multiplicative { ( "+" | "-" ) multiplicative } ;
multiplicative = unary { ( "*" | "/" | "%" ) unary } ;
unary = "-" unary | postfix ;
postfix = primary { "." ( ident | enum ) [ "(" args ")" ] } ;
primary = number | string | "true" | "false" | "null"
| enum (* enum symbol *)
| ident [ "(" args ")" ] (* root ref or free function call *)
| ident construct (* constructor: lowercase ident only *)
| "(" expr ")"
| list ;
list = "[" [ expr { "," expr } [ "," ] ] "]" ; (* trailing comma allowed *)
construct = "{" field { "," field } [ "," ] "}" ; (* trailing comma allowed *)
field = ident ":" expr ;
args = [ expr { "," expr } ] ; (* trailing comma NOT allowed *)
Precedence and associativity
Lowest to highest:
| Level | Construct | Associativity |
|---|---|---|
1 |
|
— (all three parts required) |
2 |
|
left |
3 |
|
left |
4 |
prefix |
right (prefix) |
5 |
|
non-associative |
6 |
|
left |
7 |
|
left |
8 |
prefix |
right (prefix) |
9 |
postfix |
left |
10 |
primary |
— |
Note the deliberate asymmetry: prefix not is low precedence (not a == b parses as not (a == b)), while unary - is high precedence (-a * b parses as (-a) * b). There is no unary +.
Non-associative comparisons
A comparison level admits at most one comparison. a < b < c is a compile error (comparison operators are non-associative; combine comparisons with 'and'). Chain with and: a < b and b < c.
is null / is not null
x is null desugars to x == null; x is not null desugars to x != null. Only null (or not null) may follow is.
not in
At the comparison level, not is legal only immediately followed by in: a not in b becomes a not-in b. A prefix not elsewhere is handled at level 4.
Infix-word desugaring
a endsWith b desugars to the call endsWith(a, b). The right operand is parsed at additive precedence, so a contains b + c is contains(a, b + c).
Constructors
name { field: value, … } builds a typed object (decision { … }, assignment { … }). The constructor name must be a lowercase identifier. Field names are identifiers; a trailing comma is allowed. Unknown, duplicate, and missing-required fields are diagnosed by the checker, not the parser.
Member access and calls
After a primary, .name is member access; .name(args) is a method-style call whose receiver is the preceding expression. The name after . may be an identifier or an enum symbol. Chains left-associate. A free name(args) (no receiver) is a function call; a bare name is a context root reference.
Type system and static semantics
Types
The kinds are: String, Number, Boolean, Timestamp, Duration, Null (the type of the null literal only), List<T>, Enum<Name>, Object<Name> (a constructor result), and Any (a schema-declared untyped value). All AVL 1.0 types are nullable; null-safety is a checker warning plus runtime propagation, not a separate non-nullable type.
Assignability
-
Nullis assignable to every type. -
Anyaccepts every type and every type acceptsAny(both directions).Anyis intended for equality, comparison, and coercion sites. -
List<T>is covariant inT(a nil element type is a wildcard). -
Otherwise assignability is structural equality (same kind, same name, recursively equal element type).
Enums
An enum definition has a name, a member list, and an open flag. An open enum admits any enum symbol; a closed enum checks membership (unknown member is AVL-ENUM with a "did you mean" suggestion). The checker resolves an enum symbol’s type from the use-site expected type — comparison against an enum attribute, an enum constructor field, membership in List<Enum>, or the pack result type. An enum symbol with no determinable expected enum type is AVL-ENUM.
Enum-string interoperability
An enum symbol and a string of the same text compare equal, in both directions. This holds at ==/!=, in in/not in, at result validation, and wherever text coercion applies. String functions accept enum arguments (their symbol text).
Roots and attribute access
A bare context root MUST NOT be read — user alone is AVL-CAP (bare root object cannot be read; select an explicit attribute). Only root-anchored dotted paths are readable (user.department, user.clearance). The root must be one the context pack declares (AVL-ROOT, with suggestions); the path must resolve in the schema (AVL-ATTR, with suggestions). The node’s type is the attribute’s declared type.
Operator typing
-
and/or/not: operands must beBoolean(orAny); aNulloperand is anAVL-NULLwarning (runtime result is null); a non-boolean non-null operand isAVL-TYPE. ResultBoolean. -
==/!=: valid when either side is assignable to the other, or they are an enum/string mix, or either isAny. ResultBoolean. A literal-case mismatch such aslower(x) == "MixedCase"raises theAVL-CASEwarning. -
< ⇐ > >=: after null/Anyallowance, both operands must be the same orderable kind, one ofNumber,String,Timestamp,Duration. ResultBoolean. A nullable attribute operand not wrapped incoalesce(…)raisesAVL-NULL. -
Arithmetic:
-
+:Number+Number→Number;String+String→String;Timestamp+Duration→Timestamp;Duration+Duration→Duration; andString + (Number|Boolean|Enum)→ String (and the mirror), a friendly concatenation coercion. -
-:Number−Number→Number;Timestamp−Timestamp→Duration;Timestamp−Duration→Timestamp;Duration−Duration→Duration. -
* / %:Numberonly, toNumber. -
An
Any/Nulloperand yieldsAny. OtherwiseAVL-TYPE.
-
-
in/not in: the right side must beList<T>(orAny/Null); the left must be assignable toT(or an enum/string mix). ResultBoolean. -
unary
-: operandNumber(orAny/Null), toNumber.
if
The condition must be Boolean (a Null condition is an AVL-NULL warning: the runtime errors). The branches are unified: equal produces that type; one Null produces the other; either Any produces Any; assignable produces the wider; otherwise AVL-TYPE. The pack’s expected result type propagates into both branches.
Lists
A list literal’s element type is the fold of the non-null element types; an empty or all-null list takes the expected element type or Any.
Null semantics and evaluation
Evaluation is three-valued, bounded, snapshotted, and optionally traced. On any error the runtime returns a null value plus the error — it never fabricates a value. The evaluation timestamp is pinned from the snapshot (or the supplied Now, or the process clock at start); now() and all time-bound functions read only this pinned time.
Per-operator null behavior:
-
==/!=: value equality; not null-propagating (null == nullis true,null == nonnullis false); enum/string interop applies. -
< ⇐ > >=: anyNulloperand yields null. Mismatched non-null kinds areAVL-TYPE. -
+ - * / %: anyNulloperand yields null. String concatenation coercesNumber/Boolean/Enum; a result string over the string limit isAVL-LIMIT. Division or modulo by zero is an error (not null). -
in/not in:Nullon either side yields null; a non-list right side isAVL-TYPE. -
and/or: short-circuit —false and Xis false andtrue or Xis true without evaluatingX. Otherwise aNulloperand yields null; a non-boolean non-null operand isAVL-TYPE. -
not:Nullyields null; non-boolean non-null is an error. -
unary
-:Nullyields null; non-number is an error. -
if: a null condition is an evaluation error (AVL-NULL, "wrap the condition in coalesce(…)") — not a silent else. Only the taken branch is evaluated. -
construct: fields are evaluated in sorted key order; null-valued fields are omitted from the object. -
attribute read: a missing snapshot/root/field or a null intermediate yields null; a declared-
Timestampattribute arriving as an RFC 3339 string is coerced (parse failure yields null). -
truthiness: a boolean result is produced only for a
Booleanvalue; null or any other kind is not truthy — the runtime never silently coerces a non-boolean to a boolean.
Builtin function library
There are 37 builtins. Each has a name, group, one or more overloads, a purity (pure | timebound | resolver), a static cost, and an optional method-style flag (may be called receiver.fn(args)). Global rule: a null argument yields a null result, except memberOf with no wired resolver (which errors). A wrong-kind non-null argument is an error. Text coercion accepts both strings and enum symbols.
core (pure, cost 1)
| Name | Signature | Semantics |
|---|---|---|
|
|
first non-null argument; all null yields null |
|
|
render a scalar; null yields null |
|
|
Number to itself; String parsed or null; Boolean to 1/0; else null |
|
|
rune count; null yields null |
|
|
whether the value is null |
|
|
the first argument, or the second when the first is null |
string (pure, cost 1 unless noted; method-style where noted)
| Name | Signature | Notes |
|---|---|---|
|
|
unicode-aware |
|
|
unicode-aware |
|
|
trims leading/trailing whitespace |
|
|
trims ends and collapses internal whitespace runs to single spaces |
|
|
lowercase + trim; null if not email-shaped (no |
|
|
local part before the first |
|
|
method-style; overloaded on the first parameter — this is the only |
|
|
method-style |
|
|
method-style |
|
|
cost 5, method-style; RE2; the pattern must be a string literal and is length-bounded |
|
|
split on a separator |
|
|
any null element yields null |
|
|
replace all occurrences |
|
|
rune indices, clamped; start ≥ end yields "" |
date (cost 1; method-style where noted)
| Name | Signature | Purity | Notes |
|---|---|---|---|
|
|
timebound |
the pinned evaluation time, never the wall clock |
|
|
pure |
RFC 3339; failure yields null |
|
|
pure |
fractional days |
|
|
pure |
fractional days allowed |
|
|
pure |
duration constructor |
|
|
pure |
duration constructor |
|
|
pure |
duration constructor |
|
|
pure |
method-style; strict |
|
|
pure |
method-style; strict |
|
|
timebound |
method-style; abs(ts − now) ≤ d |
collection (pure, cost 2)
| Name | Signature | Notes |
|---|---|---|
|
|
element count |
|
|
list length 0, or empty string |
|
|
first element; empty yields null |
|
|
deduplicate, first-seen order |
|
|
share any element |
lookup (resolver, cost 10)
lookup(String table, String key) → Any resolves a snapshot-bound lookup row; a missing key is null. The table argument must be a string literal (so the dependency can be extracted).
Context packs
A context pack is the per-use-case contract: the roots an expression may read, the function groups it may call, its result type, its resource budget, its failure mode, its readable input sensitivities, and its trace policy. Failure modes are enforcement-point contracts (the runtime always returns the error): DENY, NO_MATCH, OMIT, REJECT_UPDATE, PRESERVE, SUSPEND, INDETERMINATE, ERROR_BRANCH.
Shared enums:
-
Effect(closed):ALLOW, DENY, NOT_APPLICABLE, INDETERMINATE, DEFER, REQUIRE_APPROVAL -
AssignmentEffect(closed):ASSIGN, UNASSIGN, NOT_APPLICABLE -
Assurance(closed):AAL1, AAL2, AAL3 -
Obligation(open)
Shared constructors:
-
decision { effect (required), reason, requiredAssurance, obligations, advice, sessionDurationSeconds, confidence } -
assignment { effect (required), entitlementSet, expiresAt, reason }
The built-in packs:
| Pack | Ver | Roots | Result | Failure mode | Readable sensitivities |
|---|---|---|---|---|---|
|
1.1 |
source, user, tenant, evaluation |
|
REJECT_UPDATE |
public, internal only |
|
1.0 |
user, tenant, evaluation |
|
PRESERVE |
all declared |
|
1.0 |
user, application, tenant, evaluation |
|
INDETERMINATE |
all declared |
|
1.0 |
user, application, session, tenant, evaluation |
|
OMIT |
all declared |
|
1.0 |
user, application, session, tenant, evaluation |
|
OMIT |
all declared |
|
1.0 |
user, session, device, risk, application, tenant, evaluation |
|
DENY |
all declared |
|
1.0 |
user, session, device, risk, resource, application, request, tenant, evaluation |
|
DENY |
all declared |
|
1.0 |
user, request, resource, application, tenant, evaluation |
|
ERROR_BRANCH |
all declared |
|
1.0 |
user, request, resource, tenant, evaluation |
|
INDETERMINATE |
all declared |
PROFILE_MAPPING v1.1 is the one pack that restricts readable input sensitivities to public and internal: the gateway’s schema-projection adapter filters controlled and secret-classified attributes out of the projected user/source roots before compilation, so a PROFILE_MAPPING expression cannot read them.
Evaluation, snapshot, and resource limits
Evaluation runs against an input snapshot built before execution; no undeclared lookup or clock access happens after snapshot construction. Timestamps in the snapshot arrive as RFC 3339 strings and are coerced by declared type. Whole-root reads are rejected both at compile time (AVL-CAP) and at IR-validation time.
The default resource limits — a pack may lower TimeLimit and MaxCost; all others fall to these defaults:
| Limit | Default |
|---|---|
Time |
50 ms |
Operations |
10 000 |
Call depth |
8 |
List length |
1 000 |
String length |
64 KiB |
Value depth |
32 |
Value count |
10 000 |
Snapshot bytes |
4 MiB |
Result bytes |
256 KiB |
Cost budget |
1 000 |
Exceeding a bound is AVL-LIMIT; exceeding the pack cost budget at compile time is AVL-COST. Cost is a static estimate: constants and enum symbols cost 0, an attribute read 1, binary/unary/logical/if 1, a list 1 + len, a constructor 2, a function call its declared cost, a policy reference 25; both if branches are counted (static worst case).
Canonicalization and checksums
Every expression has a single canonical form independent of friendly-syntax spelling: binary expressions are fully parenthesized with canonical operator spelling, is null renders as (x == null), infix words render as function calls, strings are re-quoted with the four escapes. The canonical source’s SHA-256 is the SourceChecksum; the compiled IR’s canonical JSON SHA-256 is the IR Checksum. Two spellings that canonicalize identically produce the identical IR checksum — this is the basis for immutable versioning.
Diagnostics
Diagnostic codes are append-only and are never repurposed. Unknown attribute, function, and enum names produce "did you mean …" suggestions.
-
Errors:
AVL-SYNTAX,AVL-ROOT,AVL-ATTR,AVL-FUNC,AVL-FUNC-CAP,AVL-ARITY,AVL-TYPE,AVL-ENUM,AVL-RESULT,AVL-COST,AVL-CONSTRUCT,AVL-CAP,AVL-LIMIT,AVL-SNAPSHOT,AVL-INTERNAL. -
Warnings:
AVL-NULL,AVL-CASE.
Reserved forms
policy("id") is a reserved call form (not a registry function): the id must be a string literal, the referenced policy must be known to the compiler, and it produces a policy reference (cost 25) that the runtime evaluates against the same snapshot, sharing the operation budget and deadline.
Versioning and stability
-
LanguageVersionis1.0and is embedded in every compiled artifact and decision trace. This specification defines version1.0. Additions that do not change the meaning of any existing conformant expression (new builtins, new packs, new enum members, new diagnostics) are backward-compatible within1.0. A change to the meaning of an existing conformant expression requires a new language version. -
Activated expression versions are immutable; they are content-addressed by
SourceChecksumand their compiled IR byChecksum. -
CompilerVersion(avlc-1.0.1) is non-normative build metadata stored with a compilation; it is a single source of truth in the codebase (avl.CompilerVersion) and MUST NOT drift between the library and its callers. -
The diagnostic-code list is append-only.
Exclusions (AVL 1.0)
AVL 1.0 deliberately excludes: recursion, loops, lambdas, action execution, arbitrary HTTP or I/O, user-supplied native code, unbounded graph queries, dynamic reflection, and runtime source compilation in production (production runtimes execute compiled IR loaded from signed bundles).
Conformance
An implementation conforms to this specification when, for every construct and builtin defined here, it compiles and evaluates as specified — including the null-propagation rules, the enum-string interoperability, canonicalization, each pack’s result-type and failure-mode contract, resource-limit enforcement, and the diagnostics. The conformance suite (Vector Language engine) verifies these claims, and it re-extracts every fenced example from the normative specification and asserts each compiles and evaluates exactly as written — a documentation-drift check that keeps this reference honest.
Executable examples
lower(source.givenName + "." + source.surname)
user.department == "Engineering" and user.status == ACTIVE
user.contractEndDate is not null and user.contractEndDate > now()
if user.status == ACTIVE and device.managed == true
then decision { effect: ALLOW, requiredAssurance: AAL2 }
else decision { effect: DENY, reason: "unmanaged device", obligations: [REQUIRE_MANAGED_DEVICE] }