Lexical structure
- Identifiers are ASCII only:
[A-Za-z_][A-Za-z0-9_]*. A non-ASCII letter where an identifier could start isAES1001. Non-ASCII text is fully supported inside string literals. - Keywords:
package import script type struct enum var const func return if else for switch case default break continue true false nil yield signal coroutine. - Contextual:
startis a keyword only when it is followed by a name and(; elsewhere it is an ordinary identifier.wait,framesandfixedare special only right afteryield. - Reserved for future versions (using them is
AES1004):await select go chan defer interface map. - Literals: integers
10,0x1f,1_000; floats1.5,.5,1e3,1_000.5; strings"..."with escapes\n \t \" \\ \uXXXX;true,false,nil. Underscores must separate digits. - Comments:
// lineand/* block */. A//comment group directly above a declaration is its documentation and is shown on hover and in completion. - Semicolons are inserted at a line end after an identifier, literal,
),],},return,break,continue,++,--, or after a>that closes type arguments. Write code line by line as in Go;}followed byelsemust be on the same line. - Operators:
+ - * / % == != < <= > >= && || ! = := += -= *= /= %= ++ --. There are no bitwise operators; a lone&or|isAES1001.
Deliberately unsupported lexical forms (each has a diagnostic that names the intended form):
| Input | Why | Write instead |
|---|---|---|
'a' |
no char type separate from string |
"a" |
1. / 1.e3 |
a float needs digits after the point | 1.0 / 1.0e3 |
имя := 1 |
identifiers are ASCII | ASCII names |
a & b |
no bitwise arithmetic | && / || |