White space is defined as ASCII space, horizontal tab and line feeds.
There are three kinds of comments:
// A end-of-line comment like this. All the text from the ASCII characters // to end of the line is ignored
/*
A traditional comment. All the text from the ASCII characters /* to the ASCII characters */ is ignored
*/
("A Auto-doc comment")
These productions imply all of the following properties:
An identifier is an unlimited-length sequence of PTL letters and PTL digits, the first of which must be PTL letter. An identifier cannot have the same spelling as a keyword or boolean literal, or platform variables.
The "PTL letters" include uppercase and lowercase ASCII Latin letters A–Z, and a–z, and the ASCII underscore (_).
The "PTL digits" include the ASCII digits 0-9.
Examples of correct identifiers are: count, MAX_VALUE, num5, numOfPeople, Step_2, amount_US.
Examples of incorrect identifiers are: amount$, 5num, مبلغ, color. (identifier 'color' is incorrect, because color is keyword)
Keywords
The following character sequences are reserved for use as keywords and cannot be used as identifiers:
and
bool
break
char
color
const
continue
datetime
do
double
else
entry
external
false
function
if
int
internal
global
goto
label
not
or
ref
return
string
switch
true
void
while
xor
Literals
A literal is the source code representation of a value of a PTL type. The are six kinds of a literals:
An Integer literal may be expressed in decimal or hexadecimal notation. A hexadecimal literal consist of the leading ASCII characters 0x or 0X followed by one or more ASCII hexadecimal digits and can represent a positive, zero, or negative integer. The largest decimal literal is 2 147 483 647 and the least decimal literal is -2 147 483 648. The largest hexadecimal literal is 0x7FFFFFFF. Example: 15
A Float literal may be expressed in decimal notation and consist one dot. Example: 3.14
A Boolean literal has two values, represent by the literals true and false, formed from ASCII letters. A boolean literal is always of type bool.
A Character literal is expressed as a character enclosing in ASCII single quotes. A character literal is always of type char. Exist special character literal for escape-sequence, like following:
'\n' linefeed
'\t' horizontal tab
'\r' carriage return
'\b' backspace
'\'' single quote
'\"' double quote
'\\' backslash
In the ProTrader programming language, a character literal always represents exactly one character. Example: 'a'
A String literal consist from zero or more characters enclosed in double quotes. The string literal consists from symbols in UTF-16 characters set. Example: "123"
A Color literal represent color. For more details see at Data Types section. Example: Yellow
Separators
The following ASCII characters are the separators: ( ) { } [ ] ; , .
Operators
The following tokens are the operators, formed from ASCII characters:
= += -= *= /= &= |= ^= > < <> == <= >= & | ^ + - * / ! ~
Comments