-
Notifications
You must be signed in to change notification settings - Fork 0
Definitions
Single lined comments start with #.
Multi-lined comments are nested. They start with #{ and end with }.
CTalk supports these types are primitives:
| Type name | Unsigned? | Signed? | Imaginary? | Complex? |
|---|---|---|---|---|
bool |
||||
size_t |
||||
any_t |
||||
char |
unsigned char |
signed char |
||
short |
unsigned short |
signed short |
||
int |
unsigned int |
signed int |
||
long |
unsigned long |
signed long |
||
long long |
unsigned long long |
signed long long |
||
float |
imaginary float |
complex float |
||
double |
imaginary double |
complex double |
||
long double |
imaginary long double |
complex long double |
any_t is the equivalent of a generic pointer void * in C.
Pointer to a type is written as [type].
Bounded arrays are written as [bound, bound... type].
For example, a definition like int arr[2][4] would be written as arr : [2, 4 int].
That have been said, type comes after the name.
A definition like a, b, c : int is expanded into int a; int b; int c;.
Scheme:
function <name> : <return type> () <statements> end
function <name> : <return type> <parameters> <statements> end
function <name> : <return type> <parameters>, ... <statements> end
A void returning function can be written as either function f : void or function f.
The <parameters> field is never omitted, and that, to write a function that takes no parameters,
it is detonated by (). By doing so, the function cannot be variadic (trailing ellipsis).
For example: The main method
function main:int argc:int, argv:[[char]]
#{ Function called main returning int
that takes argc (int type) and
argv (pointer to char pointer). #}
end;