Aexol Language

DocsAexol LanguageLanguage Reference

Complete reference for Aexol syntax — types, visitors, roles, workflows, agents, and enums.

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
}

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
}

Enums

Define fixed sets of named values:

enum Priority {
  low
  medium
  high
  critical
}

enum TaskStatus {
  todo
  in_progress
  done
  archived
}

Use enums as field types:

type Task {
  id: string
  status: TaskStatus
  priority: Priority
}

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"
}

Nested Capabilities

Capabilities can be nested to model hierarchical access:

visitor DocumentEditor {
  "login" {
    "create document"
    "edit document"
    "delete document"
  }
}

Anonymous Visitor

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

visitor {
  "view public content"
  "search"
}

Roles

Roles define permission sets with explicit resource access:

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

  permission comments {
    create,
    read,
    delete own
  }
}

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
}

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
}

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
}

Agents

Agents define autonomous entities with capabilities:

agent NotificationService {
  "send email"
  "send sms"
  "send push notification"
}

Agents can be associated with roles:

agent ContentProcessor: Editor {
  "fetch document"
  "process content"
  "publish document"
}

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"
}

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