THE JOA LANGUAGE

Lexical Rules

Learn Joa syntax: comments, identifiers, keywords, string escapes, statement endings, and explicit braces.

Comments

Line comments begin with // and continue to the end of the line. There are no block comments.

// This is a comment
let x = 10  // inline comment

Statement Termination

Use newlines to separate statements. Semicolons are accepted but not required. Reference examples build on earlier declarations unless a block is identified as a complete program.

let a = 1
let b = 2    // preferred — no semicolons needed
let c = 3;   // also valid

Identifiers

Identifiers must start with a letter or underscore, followed by any number of letters, digits, or underscores. They are case-sensitive.

user_name    ✓
_private     ✓
Value2       ✓
2invalid     ✗  (starts with digit)

Keywords

The following words are reserved and cannot be used as identifiers:

let   fn   return   if   else   while   for   in   not   and   or
true  false  null  agent  break  continue

String Literals

Strings are enclosed in double quotes. Supported escape sequences:

Sequence Meaning
\n Newline
\t Tab
\" Literal quote
\\ Literal backslash
let msg = "Hello, world!"
let path = "C:\\Users\\admin"
let line = "first\nsecond"