User manual

182
mikoPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
Token Extraction Example
Here is an example of token extraction. Take a look at the following example code sequence:
end_ag := 0;
First, note that end_ag would be parsed as a single identier, rather than as the keyword end followed by the identier
_ag.
The compiler would parse it as the following four tokens:
end_ag // variable identier
:= // assignment operator
0 // literal
; // statement terminator
Note that := parses as one token (the longest token possible), not as token : followed by token =.
Literals
Literals are tokens representing xed numeric or character values.
The data type of a constant is deduced by the compiler using such clues as numeric value and format used in the
source code.
Integer Literals
Integral values can be represented in decimal, hexadecimal or binary notation.
In decimal notation, numerals are represented as a sequence of digits (without commas, spaces or dots), with optional
prex + or - operator to indicate the sign. Values default to positive (6258 is equivalent to +6258).
The dollar-sign prex ($) or the prex 0x indicates a hexadecimal numeral (for example, $8F or 0x8F).
The percent-sign prex (%) indicates a binary numeral (for example, %01010000).
Here are some examples:
11 // decimal literal
$11 // hex literal, equals decimal 17
0x11 // hex literal, equals decimal 17
%11 // binary literal, equals decimal 3
The allowed range of values is imposed by the largest data type in mikroPascal PRO for dsPIC30/33 and PIC24
longint. Compiler will report an error if the literal exceeds 2147483647 ($7FFFFFFF).