Skip to content

Syntax

Omega's surface syntax is a Lisp-shaped s-expression language. Source text is tokenized, parsed into Datum values, and lifted into AST Expr nodes by the compiler.

The Datum type

projects/omega-lisp/src/core/reader/datum.ts:7-14:

ts
export type Datum =
  | number
  | string
  | boolean
  | null
  | Sym
  | Char
  | Datum[];

export type Sym = { sym: string };
export type Char = { char: string };

There are six atom kinds — number, string, boolean, null, symbol, char — plus the recursive list/array.

Atoms

lisp
42                ; number
3.14              ; number
"hello"           ; string
#t  #f            ; booleans (also written true / false in some forms)
nil               ; null
foo               ; symbol
:keyword          ; symbol whose name starts with ":"
#\a               ; character literal

Lists, vectors, maps

lisp
(a b c)           ; list — function application or special form
[a b c]           ; vector literal (read as `(vector a b c)`)
{:k v :k2 v2}     ; map literal (where supported by the reader)

The vector reader macro is vec in datum.ts:22: [a b c] → (vector a b c).

Quoting

lisp
'foo              ; (quote foo)            — literal symbol
`foo              ; (quasiquote foo)       — quasi-quote
,foo              ; (unquote foo)
,@foo             ; (unquote-splicing foo)

Comments

lisp
;; line comment to end of line
#| block comment |#

Function application

lisp
(+ 1 2)                       ; → 3
(define x 10)                 ; bind in current scope
(let ((y 5)) (+ x y))         ; → 15

The first element of a non-empty list is the operator. If the operator's symbol resolves to a special form, the list is interpreted by that form's evaluator. Otherwise it's a function call: evaluate operator, evaluate arguments, apply.

Effects

lisp
(effect infer.op "What is 2+2?")
(effect file.read.op "/etc/hosts")
(effect agent.spawn.op 'claude 'sonnet)

effect is a special form. The first argument is a quoted operation name; the rest are arguments. The evaluator pauses, the host's EffectBackend is asked to handle the op, and execution resumes with the returned value.

See also

Source: projects/omega-lisp/src/core/reader/datum.ts, projects/omega-lisp/src/core/reader/parse.ts, projects/omega-lisp/src/core/reader/tokenize.ts. Quoting and quasiquoting are core reader features; specific reader macros are configured in the parser.