Basic Types¶
S++ has a number of basic types, which are the building blocks of all S++ programs. This section will detail the basic types in S++. The basic types in S++ are:
As every type in S++ is treated as first class, these types are also treated as objects, and follow standard type
identifier regex, rather that a keyword-like identifier. All of these types have std::copy::Copy
superimposed over
them, to allow easy use of the numbers without having to place .clone()
everywhere for simple calculations.
Furthermore, simple CPU instructions are used to copy these types, which fit directly inside the registers. The
superimposition of the Copy
type is used to model tje copy logic for the memory checker.
Number Types¶
S++ uses a large range of numeric types, allowing for low-level optimizations and refined resource utilization on embedded devices. The naming convention is inspired by Rust, but modified to match the syntactic type-identifier requirements.
All of these types are found in the std::number
module of the STL:
Type |
Postfix |
Size (bits) |
Min |
Max |
Precision |
Description |
---|---|---|---|---|---|---|
|
|
|
|
|
|
Signed 8-bit float |
|
|
|
|
|
|
Signed 16-bit float |
|
|
|
|
|
|
Signed 32-bit float |
|
|
|
|
|
|
Signed 64-bit float |
|
|
|
|
|
|
Signed 128-bit float |
|
|
|
|
|
|
Signed 8-bit integer |
|
|
|
|
|
|
Signed 16-bit integer |
|
|
|
|
|
|
Signed 32-bit integer |
|
|
|
|
|
|
Signed 64-bit integer |
|
|
|
|
|
|
Signed 128-bit integer |
|
|
|
|
|
|
Signed 256-bit integer |
|
|
Signed “size” type |
||||
|
|
|
|
|
|
Unsigned 8-bit integer |
|
|
|
|
|
|
Unsigned 16-bit integer |
|
|
|
|
|
|
Unsigned 32-bit integer |
|
|
|
|
|
|
Unsigned 64-bit integer |
|
|
|
|
|
|
Unsigned 128-bit integer |
|
|
|
|
|
|
Unsigned 256-bit integer |
|
|
Unsigned “size” type |
||||
|
|
|
|
|
|
Arbitrary precision integer |
|
|
|
|
|
|
Arbitrary precision float |
A number literal’s is always the std::bignum::bigint::BigInt
or std::bignum::bigdec::BigDec
if no postfix type is
provided. Use the above postfixes to set the numeric type explicitly. All the number types, except BigInt
and BigDec
have compiler builtin operation methods, to hook into llvm-specialized functions.
The Copy
class is superimposed over all of these number types so that they can be used in calculations easily without
having to manually clone them. Also, numer types are small so this doesnt create a memory issue.
USize, SSize¶
The USize
and SSize
types are slightly special, as they are used to represent the numeric type that corresponds to
the maximum size of addressable memory on the target architecture, unsigned and signed. This means that on a 32-bit
architecture, USize <=> U32
and SSize <=> S32
, and on a 64-bit architecture, the 64-bit integer equivalents. The
USize
type is used for indexing and slicing operations, typically seen in arrays and vectors. It is also used for
system resource objects, such as socket and thread identifiers.
Boolean Type¶
The boolean type is S++ is std::boolean::Bool
. This is a compiler known type that maps to the llvm bool
type.
Literals true
and false
are used to create boolean value types. The Copy
class is superimposed over the boolean
type as-well.
Void Type¶
The void type in S++ is std:void::Void
. This is a compiler known type that maps to the llvm void
type. The Void
type is used to represent the absence of a value, and is used as the return type for functions that do not return a
value. Variables cannot hold a Void
type, and function parameters whose type is generic (and the generic argument is
Void
), are removed from the substituted signature.