OcaltQL Syntax & EMIT

OcaltQL is designed to read like English and execute like a machine. Statements are built from verbs, subjects, and prepositions. The rules are minimal by design.

EMIT

EMIT is the output verb. Whatever follows it is written directly to the response. It is the equivalent of echo in PHP or print in Python.

Example
EMIT "Hello World"
Emitting a Variable
STRING "Hello World" SET ?msg
AFTER EMIT ?msg

Statement Structure

Every OcaltQL statement follows this pattern:

[CHAIN] [SUBJECT] VERB [MODE] [ARGS] [PREPOSITION TARGET] [SET ?var]

Case Sensitivity

OcaltQL is case-insensitive for everything except variable names. EMIT, emit, and Emit are identical. ?var and ?Var are not.

Case Insensitivity
emit "Hello World"
after emit "This works too"
AFTER Emit "So does this"

String Delimiters

Double quotes, single quotes, and backticks are fully interchangeable as string delimiters.

Interchangeable Delimiters
EMIT "double quotes"
AFTER EMIT 'single quotes'
AFTER EMIT `backticks`

Line Rules

A fullstop at the end of a line is optional — it is not required and has no effect on execution. Multiple statements can sit on the same line. The chain keyword (AFTER, AND, OR) acts as the delimiter between statements on the same line.

Optional Fullstop
EMIT "Hello World".
AFTER EMIT "Same result"
Multiple Statements on One Line
EMIT "Hello" AFTER EMIT "World" AFTER EMIT "!"

Comments

Comments are wrapped in (* ... *). They are ignored by the parser and can appear anywhere in the script — inline or on their own line.

Comments
(* This is a comment *)
EMIT "Hello World" (* inline comment *)
AFTER EMIT "Done"

OPEN and CLOSE

OPEN and CLOSE define the body of conditional and loop blocks. They can be nested to any depth.

Nested Blocks
STRING "hello" SET ?var
AFTER IF ?var IS SET
OPEN
  EMIT "outer block"
  IF ?var IS EQUAL TO "hello"
  OPEN
    EMIT " — inner block"
  CLOSE
CLOSE

SET and Value-Returning Verbs

SET ?var is only valid when the verb produces a returnable value. Verbs that are pure side-effects — such as SAVE — do not accept SET. The runtime enforces this at the caller level per verb.

Valid SET Usage
CALCULATE 10 + 5 SET ?result
AFTER EMIT ?result