Sandbox AngelScript Dialect
Supported
- A subset of AngelScript 2.37
- Array extension
Unsupported
- Global entities other than classes and interfaces
- Class destructors
- Strings
- Non-ASCII characters
- Certain keywords (see below)
Supported Syntax*
| SCRIPT | ⟶ | (CLASS | INTERFACE | ;)* |
| INTERFACE | ⟶ | interface IDENTIFIER (; | ((: IDENTIFIER (, IDENTIFIER)*)? { INTFMTHD* })) |
| CLASS | ⟶ | (abstract | final)* class IDENTIFIER (; | ((: IDENTIFIER (, IDENTIFIER)*)? { (FUNC | VAR)* })) |
| FUNC | ⟶ | (private | protected)? (TYPE &?)? IDENTIFIER PARAMLIST const? FUNCATTR (; | STATBLOCK) |
| VAR | ⟶ | (private|protected)? TYPE IDENTIFIER (( = (INITLIST | EXPR)) | ARGLIST)? (, IDENTIFIER (( = (INITLIST | EXPR)) | ARGLIST)?)* ; |
| INTFMTHD | ⟶ | TYPE &? IDENTIFIER PARAMLIST const? ; |
| STATBLOCK | ⟶ | { (VAR | STATEMENT)* } |
| PARAMLIST | ⟶ | ( (void | (TYPE TYPEMOD (... | IDENTIFIER? (= EXPR)?) (, TYPE TYPEMOD (... | IDENTIFIER? (= EXPR)?))*))? ) |
| TYPEMOD | ⟶ | (& (in | out | inout)?)? |
| TYPE | ⟶ | const? SCOPE DATATYPE TEMPLTYPELIST? ( ([ ]) | (@ const?) )* |
| TEMPLTYPELIST | ⟶ | < TYPE (, TYPE)* > |
| INITLIST | ⟶ | { (ASSIGN | INITLIST)? (, (ASSIGN | INITLIST)?)* } |
| SCOPE | ⟶ | ::? (IDENTIFIER ::)* (IDENTIFIER TEMPLTYPELIST? ::)? |
| DATATYPE | ⟶ | (IDENTIFIER | PRIMTYPE | ? | auto) |
| PRIMTYPE | ⟶ | void | int | int32 | uint | uint32 | float | double | bool |
| FUNCATTR | ⟶ | (override | final | explicit | delete)* |
| STATEMENT | ⟶ | (IF | FOR | WHILE | RETURN | STATBLOCK | BREAK | CONTINUE | DOWHILE | SWITCH | EXPRSTAT) |
| EXPRSTAT | ⟶ | ASSIGN? ; |
| SWITCH | ⟶ | switch ( ASSIGN ) { CASE* } |
| IF | ⟶ | if ( ASSIGN ) STATEMENT (else STATEMENT)? |
| FOR | ⟶ | for ( (VAR | EXPRSTAT) EXPRSTAT (ASSIGN (, ASSIGN)*)? ) STATEMENT |
| WHILE | ⟶ | while ( ASSIGN ) STATEMENT |
| DOWHILE | ⟶ | do STATEMENT while ( ASSIGN ) ; |
| RETURN | ⟶ | return ASSIGN? ; |
| BREAK | ⟶ | break ; |
| CONTINUE | ⟶ | continue ; |
| EXPR | ⟶ | EXPRTERM (EXPROP EXPRTERM)* |
| CASE | ⟶ | ((case EXPR) | default) : STATEMENT* |
| EXPRTERM | ⟶ | ((TYPE =)? INITLIST) | (EXPRPREOP* EXPRVALUE EXPRPOSTOP*) |
| EXPRVALUE | ⟶ | void | CONSTRUCTCALL | FUNCCALL | VARACCESS | CAST | LITERAL | ( ASSIGN ) |
| CONSTRUCTCALL | ⟶ | TYPE ARGLIST |
| EXPRPREOP | ⟶ | - | + | ! | ++ | -- | ~ | @ |
| EXPRPOSTOP | ⟶ | (. (FUNCCALL | IDENTIFIER)) | ([ (IDENTIFIER :)? ASSIGN (, (IDENTIFIER :)? ASSIGN)* ]) | ARGLIST | ++ | -- |
| CAST | ⟶ | cast < TYPE > ( ASSIGN ) |
| LITERAL | ⟶ | NUMBER | BITS | true | false | null |
| FUNCCALL | ⟶ | SCOPE IDENTIFIER TEMPLTYPELIST? ARGLIST |
| VARACCESS | ⟶ | SCOPE IDENTIFIER |
| ARGLIST | ⟶ | ( (IDENTIFIER :)? ASSIGN (, (IDENTIFIER :)? ASSIGN)* ) |
| ASSIGN | ⟶ | CONDITION ( ASSIGNOP ASSIGN )? |
| CONDITION | ⟶ | EXPR (? ASSIGN : ASSIGN)? |
| EXPROP | ⟶ | MATHOP | COMPOP | LOGICOP | BITOP |
| MATHOP | ⟶ | + | - | * | / | % | ** |
| COMPOP | ⟶ | == | != | < | <= | > | >= | is | !is |
| LOGICOP | ⟶ | && | || | ^^ | and | or | xor |
| BITOP | ⟶ | & | | | ^ | << | >> | >>> |
| ASSIGNOP | ⟶ | = | += | -= | *= | /= | |= | &= | ^= | %= | **= | <<= | >>= | >>>= |
| IDENTIFIER | ⟶ | starts with letter or _, can include any letter and digit, same as in C++ |
| NUMBER | ⟶ | includes integers and real numbers, same as C++ |
| BITS | ⟶ | binary 0b or 0B, octal 0o or 0O, decimal 0d or 0D, hexadecimal 0x or 0X |
| COMMENT | ⟶ | starts with // and ends with new line or starts with /* and ends with */ |
| WHITESPACE | ⟶ | spaces, tab, carriage return, and line feed |
* Grammar rules adapted from the full EBNF (copyright (c) 2003-2025 Andreas Jönsson)
Supported Keywords – General
- abstract
- class
- delete
- explicit
- final
- interface
- override
- private
- protected
- super
- this
Supported Keywords – Control Flow
- and
- break
- case
- continue
- default
- do
- else
- false
- for
- if
- is
- not
- or
- return
- switch
- true
- while
- xor
Supported Keywords – Type
- array
- auto
- bool
- cast
- const
- double
- float
- in
- inout
- int
- int32
- null
- out
- uint
- uint32
- void
Supported Methods – Arrays
- find
- findByRef
- insertAt
- insertLast
- length
- removeAt
- removeLast
- removeRange
- resize
- reverse
- sort
- sortAsc
- sortDesc
Unsupported Keywords
- catch
- enum
- external
- foreach
- from
- funcdef
- function
- get
- import
- int16
- int64
- int8
- mixin
- namespace
- property
- set
- shared
- try
- typedef
- uint16
- uint64
- uint8
- using