← Back to Documentation

The Basics

The fundamental building blocks of ARO: syntax, structure, and core concepts you'll use in every program.

Source Files

ARO source files use the .aro extension. An application is a directory containing one or more .aro files:

MyApp/
├── openapi.yaml    # Required for HTTP server
├── main.aro
├── users.aro
└── events.aro

All files in the directory are automatically compiled together. No import statements needed.

Comments

ARO uses Pascal-style block comments:

(* This is a comment *)

(*
   Multi-line comments
   are also supported
*)

(* Comments can contain (* nested comments *) *)

Feature Sets

A feature set is the primary organizational unit in ARO. It groups related statements that accomplish a business goal:

(Feature Name: Business Activity) {
    (* statements go here *)
}

Example

(Validate User Credentials: Authentication) {
    <Extract> the <username> from the <request: body username>.
    <Extract> the <password> from the <request: body password>.
    <Retrieve> the <user> from the <user-repository> where username = <username>.
    <Compare> the <password> against the <user: passwordHash>.
    <Return> an <OK: status> with <user>.
}

Statements

Every statement follows the Action-Result-Object pattern:

<Action> [article] <result> preposition [article] <object> [modifiers].
ComponentDescriptionExample
ActionThe verb/operation<Extract>, <Create>
ArticleOptional: a, an, thethe, a, an
ResultThe output variable<user>, <data: processed>
PrepositionRelationship wordfrom, to, with
ObjectThe input/target<request: body>
ModifiersAdditional clauseswhere id = <user-id>

Every statement ends with a period (.).

Variables

Variables are denoted with angle brackets and hold values during execution.

Simple Variables

<user>
<order>
<total>

Qualified Variables

Add context with a colon and qualifier:

<user: id>           (* The id property of user *)
<request: body>      (* The body of the request *)
<order: lineItems>   (* The lineItems of an order *)

Compound Names

<user-id>
<order-total>
<customer-email>

Prepositions

Prepositions define the relationship between result and object:

PrepositionMeaningExample
fromData source<Extract> the <id> from the <request>
toDestination<Send> the <email> to the <user>
forPurpose/benefit<Compute> the <hash> for the <password>
withAccompaniment<Create> the <user> with <data>
intoStorage target<Store> the <user> into the <repository>
againstComparison<Compare> the <a> against the <b>
onLocation/port<Start> the <server> on port 8080

Literals

String Literals

<Log> "Hello, World!" to the <console>.

String Interpolation

<Create> the <greeting> with "Hello, ${user-name}!".

Object Literals

<Create> the <user> with {
    name: "John Doe",
    email: "john@example.com",
    role: "admin"
}.

Special Feature Sets

Application-Start

The required entry point:

(Application-Start: My Application) {
    (* Initialization code *)
    <Return> an <OK: status> for the <startup>.
}

Application-End

Optional exit handlers:

(Application-End: Success) {
    (* Cleanup on graceful shutdown *)
    <Return> an <OK: status> for the <shutdown>.
}

(Application-End: Error) {
    (* Cleanup on error *)
    <Return> an <OK: status> for the <error-handling>.
}

Event Handlers

Feature sets with "Handler" in the business activity:

(Send Email: UserCreated Handler) { ... }
(Process File: FileCreated Handler) { ... }
(Log Connection: ClientConnected Handler) { ... }

Reserved Words

The following words have special meaning in ARO:

Next Steps

Feature Sets - Organizing code into feature sets
Actions - Complete action reference