Variable Types
Ground has 5 built-in types, which are all used to hold varying data.
- int: This stores a signed 64-bit integer. As CGround is written in C, integer overflow/underflow is undefined behaviour.
Examples: 46, -17
- double: This stores the same values as a C double, i.e. 1 bit sign, 11 bit exponent, 52 bit mantissa.
Examples: 0.5, -6.25
- string: This stores an immutable sequence of characters, stored in memory as a
char*. Notated with the string enclosed by the " symbol.
Example: "Hello, world!"
- char: This stores a single character. Notated with the character enclosed by the
' symbol.
Example: 'a', ' ' (space)
- list: This stores an array of variables.
Example: [2, -4, -1.5, "Hi!"]
- function: This stores a function. See Functions for more information.
Argument Types
Ground has _ different argument types, which are each used for different arguments in various commands.
- value (
$): This gets the value of a variable.
Example: println $var
- direct (
&): This gets the variable itself.
Example: set &var 10
- line (
%): This is used to mark a label or line number
Example: jump %label
- function (
!): This is used to mark a direct reference to a function
Example: call !myFunction &output
- type (
-): This is used to mark a variable type
Example: fun !myFunction -int (returns an int)