Skip to content

USL Syntax Reference

Complete syntax guide for the USL language.

Lexical Elements

Keywords

domain     entity     value      enum       variant
policy     actor      rule       allow      deny
behavior   state      initial    on         requires
effects    service    action     enforces   implementation
escape     capability adapter    function   nondeterministic
timeout    spec       test       property   verify
import     module     use        as         from
if         else       match      let        return
forall     exists     in         this       context

Identifiers

// Valid identifiers
user
userId
User_Name
_private
MAX_SIZE

// Invalid identifiers
123user     // Can't start with digit
user-name   // Hyphens not allowed
class       // Reserved keyword

Literals

// Integer
42
1_000_000

// Float
3.14
2.5e10

// String
"hello"
"multi\nline"

// Boolean
true
false

Operators

// Arithmetic
+  -  *  /  %

// Comparison
==  !=  <  >  <=  >=

// Logical
&&  ||  !

// Member access
.

// Function call
()

// Index
[]

Grammar

Full EBNF grammar available in the compiler source.

More Details

See specialized references: - Domain Layer Syntax - Policy Layer Syntax - Behavior Layer Syntax - Service Layer Syntax - Escape Layer Syntax