Skip to content

Lexical structure

// starts a comment that runs to the end of the line. /* starts a comment that ends at the first */. Block comments do not nest, and one that is never closed is a compile error (E-UNTERMINATED-COMMENT).

Comments can carry type annotations for the editor. The compiler ignores them. See type annotations.

A name is [A-Za-z_][A-Za-z0-9_]*.

  • Variable names are case-sensitive: temp.Foo and temp.foo are two variables.
  • Function names, event names, built-in names, object types, and keywords are not case-sensitive: onActionServerSide and onactionserverside are the same function.
function public private return if else while do for break continue switch case default
with new import enum const true false null NULL SPC NL TAB in
try catch finally throw async await

Keywords are matched without regard to case. This is an extension: older servers accept only lowercase keywords and built-in names (OQ-LANG-3), so write them in lowercase in scripts that must also run there. The words try, catch, finally, throw, async, and await are keywords only where the grammar expects them. Everywhere else they are ordinary names, so an older script that uses try as a variable still compiles.

pi is a constant, not a keyword.

  • Decimal: 123, 1.5, .5, and 5..
  • Hexadecimal: 0x1F. The value is an integer.
  • Exponent: 1e2, 1.5e1, 1e-2. The exponent needs a digit, so 1e is the number 1 followed by the name e.
  • No octal (007 is 7), no binary, no digit separators.

A number literal is a 64-bit floating point value. A leading - is the unary minus operator, not part of the literal.

function onCreated() {
echo(0x1F + 1);
// expect: 32
echo(1e2);
// expect: 100
echo(007);
// expect: 7
}

Run this example in the playground

Strings are written in double quotes. There are no single-quoted strings. The escapes are:

Escape Meaning
\n new line
\t tab
\r carriage return
\\ a backslash
\" a double quote
\' a single quote

Any other \x gives the character x without the backslash (OQ-LANG-6). A raw new line inside a double-quoted string is part of the string (a string with a \ before the new line gets the same new line), so a text can span lines. A string that is never closed runs to the end of the file and is a compile error (E-UNTERMINATED-STRING). Two string literals next to each other are not joined; use @.

function onCreated() {
echo("say \"hi\"");
// expect: say "hi"
echo("a" @ "b");
// expect: ab
}

Run this example in the playground

Strings are sequences of bytes. .length() counts bytes, and a text in UTF-8 uses more than one byte for most non-ASCII characters (OQ-LANG-1).

+ - * / % ^ ++ -- = += -= *= /= %= @= &= |= <<= >>=
== != === !== < > <= >= && || ! & | << >>
@ ? : ; , . ( ) [ ] { }
  • ^ is power. There is no ^=.
  • =< and => are the legacy spellings of <= and >=. ~ is the bitwise complement and xor the bitwise exclusive or (see operators).
  • === and !== are engine extensions (see operators).
  • SPC, NL, and TAB are operators written as words. They join two texts with a space, a new line, or a tab.

Engine version 0.1.0. Built 2026-11-18.