Aexol Language Reference

Complete syntax reference for the Aexol specification language.

Types

Define data structures with fields. Fields support primitive types, custom types, arrays, and circular references.

type User {
  id: string
  name: string
  email: string
  age: number
  isActive: boolean
}
✨ Edit in Studio

Field Types

TypeExample
stringname: string
numberage: number
booleanisActive: boolean
datetimecreatedAt: datetime
Custom typeauthor: User
Arraytags: string[]
Nested arraymatrix: number[][]

Circular References

Types can reference themselves or each other:

type User {
  id: string
  name: string
  posts: Post[]
  comments: Comment[]
}

type Post {
  id: string
  title: string
  author: User
  comments: Comment[]
}

type Comment {
  id: string
  text: string
  author: User
  post: Post
}
✨ Edit in Studio

Enums

Define fixed sets of named values:

enum Priority {
  low
  medium
  high
  critical
}

enum TaskStatus {
  todo
  in_progress
  done
  archived
}
✨ Edit in Studio

Use enums as field types:

type Task {
  id: string
  status: TaskStatus
  priority: Priority
}
✨ Edit in Studio

Visitors

Visitors define capability hierarchies — what each actor can do in the system. Capabilities are quoted strings:

visitor Admin {
  "manage users"
  "view reports"
  "configure system"
}
✨ Edit in Studio

Nested Capabilities

Capabilities can be nested to model hierarchical access:

visitor DocumentEditor {
  "login" {
    "create document"
    "edit document"
    "delete document"
  }
}
✨ Edit in Studio

Anonymous Visitor

At most one anonymous visitor (unnamed) is allowed per specification:

visitor {
  "view public content"
  "search"
}
✨ Edit in Studio

Roles

Roles define permission sets with explicit resource access:

role Editor {
  permission documents {
    create,
    read,
    update,
    delete
  }

  permission comments {
    create,
    read,
    delete own
  }
}
✨ Edit in Studio

Workflows

Workflows define state machines with transitions between states. Use the initial keyword to set the starting state:

workflow OrderFlow {
  initial: pending
  pending -> processing when payment_confirmed
  processing -> shipped when items_packed
  shipped -> delivered when customer_confirms
  pending -> cancelled when timeout
}
✨ Edit in Studio

Transition Conditions

Add when clauses to transitions:

workflow ArticleFlow {
  initial: draft
  draft -> review when submitted
  review -> published when approved
  review -> draft when changes_requested
  published -> archived when deprecated
}
✨ Edit in Studio

Multiple Transitions

A state can transition to multiple targets:

workflow PaymentFlow {
  initial: pending
  pending -> authorized
  pending -> failed
  authorized -> captured
  authorized -> voided
  captured -> completed
  captured -> refunded
}
✨ Edit in Studio

Agents

Agents define autonomous entities with capabilities:

agent NotificationService {
  "send email"
  "send sms"
  "send push notification"
}
✨ Edit in Studio

Agents can be associated with roles:

agent ContentProcessor: Editor {
  "fetch document"
  "process content"
  "publish document"
}
✨ Edit in Studio

Complete Example

type User {
  id: string
  email: string
  name: string
  role: UserRole
  posts: Post[]
}

enum UserRole {
  admin
  editor
  viewer
}

type Post {
  id: string
  title: string
  content: string
  status: PostStatus
  author: User
  comments: Comment[]
  tags: string[]
}

enum PostStatus {
  draft
  review
  published
  archived
}

workflow PostFlow {
  initial: draft
  draft -> review when submitted
  review -> published when approved
  review -> draft when changes_requested
  published -> archived when deprecated
}

visitor Admin {
  "manage users"
  "manage all posts"
  "configure system"
}

visitor Editor {
  "create posts"
  "edit own posts"
  "submit for review"
}

visitor Viewer {
  "view published posts"
  "add comments"
}

agent PublicationBot {
  "schedule posts"
  "notify reviewers"
  "archive old posts"
}
✨ Edit in Studio

Validation Rules

The Aexol validator checks:

  • ✅ Unique type, visitor, agent, role, and workflow names
  • ✅ At most one anonymous visitor
  • ✅ All type references resolve to existing types
  • ✅ Workflow states reference defined states
  • ✅ Valid capability verbs
  • ✅ No circular references in required fields

See Also