Types¶
Céu is statically typed, requiring all variables, events, and other storage entities to be declared before they are used in programs.
A type is composed of a type identifier,
followed by an optional sequence of pointer modifiers &&
,
followed by an optional option modifier ?
:
Type ::= ID_type {`&&´} [`?´]
Examples:
var u8 v; // "v" is of 8-bit unsigned integer type
var _rect r; // "r" is of external native type "rect"
var Tree t; // "t" is a data of type "Tree"
var int? ret; // "ret" is either unset or is of integer type
input byte&& RECV; // "RECV" is an input event carrying a pointer to a "byte"
Primitives¶
Céu has the following primitive types:
none // void type
bool // boolean type
on/off // synonym to bool
yes/no // synonym to bool
byte // 1-byte type
int uint // platform dependent signed and unsigned integer
integer // synonym to int
s8 u8 // signed and unsigned 8-bit integers
s16 u16 // signed and unsigned 16-bit integers
s32 u32 // signed and unsigned 32-bit integers
s64 u64 // signed and unsigned 64-bit integers
real // platform dependent real
r32 r64 // 32-bit and 64-bit reals
ssize usize // signed and unsigned size types
Natives¶
Types defined externally in C can be prefixed by _
to be used in Céu programs.
Example:
var _message_t msg; // "message_t" is a C type defined in an external library
Native types support modifiers to provide additional information to the compiler.
Abstractions¶
See Abstractions.
Modifiers¶
Types can be suffixed with the pointer modifier &&
and the option modifier
?
.
Pointer¶
TODO (like in C)
TODO cannot cross yielding statements
Option¶
TODO (like "Maybe")
TODO: _