Variables in GaspardOS LANG
All variables are stored outside procedures.
The only exceptions are procedure arguments.
Declaration is simple and direct:
Example
global uint64_t x = 33;
global uint32_t x_32bits = cast uint32_t 33; // the cast operator is used because every integer in my language is 64-bit by default
global double db = 4.677; // doubles are supported without any trouble; they are not my main concern at the moment...
// ----- note: STRING AND WSTRING
global string message_gaspard = " agent.... \n"; // ASCII string type: ptr uint8_t
global wstring message_gaspard_unicode = L"WSTRING ééééé@@àààà \n"; // wstring ptr uint16_t or uint32_t, depending on the platform
A procedure can, of course, change the value of a variable.
A variable does not have to be assigned a value.
For example:
global double db; // no problem
global ptr uint64_t compteur2; // for a ptr (pointer), this makes perfect sense: the address will be determined in the procedure
Warning
It is not perfect!