p-sharp syntax
NOTE This article has been written concurrently with the programming language. It isn't an exceptionally proper documentation but can be used to see the core syntax of the language.
Keywords
plaintext
Types
rs
Variables
Syntax
go
Example
go
Constants
Syntax
go
Example
go
NOTE Variables, constants and functions are MANDATORY to be initialized
Comments
Syntax (single line)
go
Syntax (multi-line)
go
Functions
Syntax
go
Example
go
While loops
Syntax
rs
Example
rs
For loops
Syntax
go
Example
go
NOTE: Iterators aren't yet designed but will soon be.
Namespaces
Syntax
go
Example
go
Modules
Syntax
go
Example
go
go
Structs
Syntax
go
Example
go
Pointers
Syntax
go
Example
go
Quick distinctions
go
Attributes
Syntax
rs
Example
go
Inline assembly
Syntax
go
Example
go
Integer overflow
Both signed and unsigned integers wrap back to the lowest possible value.
Enums
Syntax
rs
Example
go
Padding in structs
Example
go
go
NOTE Padding always inserts a byte that is equal to 0x00 (0)
Aligning structs
Example
go
go
Stack preallocation
Stack preallocation allocates stack space on the caller's space instead of the callee, meaning when it returns, the memory can still be used.
Example
go
NOTE the stack_top argument is passed by the compiler automatically, discarding it means stack preallocation won't happen and will be removed by the compiler
Templates
Syntax
go
Special data for different types
go
Casting
Syntax
cpp
Examples
go
go