diff --git a/docs/SterlingLangDoc.html b/docs/SterlingLangDoc.html new file mode 100644 index 0000000..ea92c45 --- /dev/null +++ b/docs/SterlingLangDoc.html @@ -0,0 +1,477 @@ + + + + + + Sterling Language Documentation + + + + + +

Sterling Language Documentation

+

Version: 0.1.0-alpha

+ +

Overview

+

Sterling is a low-level, strongly typed, systems programming language designed for performance, ABI stability, C interoperability, and full control over memory and hardware. It supports metaprogramming, hot-reloading, inline and raw assembly, and is built for multi-file compilation. It also introduces memory safety primitives and modern low-abstraction control flow enhancements.

+ +

This Document is a work in progress, features are not yet implemented and i use this as a design document to stay true to my vision

+ +

File Extensions (placeholder, subject to change)

+ + +

Function Qualifiers

+

Every function must declare its linkage explicitly:

+ +

+fn		// globally visible, default linkage
+fn_static	// translation unit-local only
+fn_inline	// inline-only, no symbol emitted
+fn_asm		// raw assembly function, globally visible
+fn_static_asm	// raw assembly function, TU-local only
+
+ +

Function Syntax

+

All functions must explicitly declare their return type. The only exception is void, which may be omitted for brevity when no return value is intended.

+ +

+fn u32 add(u32 a, u32 b) {
+	return (a + b);
+}
+
+fn_extern i32 printf(const char* fmt, ...);
+
+fn_inline u32 max(u32 a, u32 b) {
+	return ((a > b) ? a : b);
+}
+
+fn exit() {
+	// equivalent to fn void exit()
+}
+
+ +

Assembly Functions

+

Write raw x86_64 assembly using fn_asm or fn_static_asm. Symbol, section, and global declaration are implicit.

+ +

+fn_asm void* memset(void* dst, u8 value, u64 size) {
+	test rdx, rdx
+	je .done
+
+	mov rax, rsi
+	mov rdi, rdi
+	mov rcx, rdx
+
+	rep stosb
+
+.done:
+	mov rax, rdi
+	ret
+}
+
+ +

Syscalls

+

System calls are allowed via fn_asm or wrapped using concrete ABI-aware interfaces. Example:

+ +

+fn_asm void exit() {
+	mov rax, 60   ; syscall: exit
+	mov rdi, 0    ; exit code
+	syscall
+	ret
+}
+
+ +

Types

+

Sterling supports explicitly sized, ABI-stable primitive types. Signed and unsigned integer types are defined as follows:

+ +

+i8, i16, i32, i64	// signed integers
+u8, u16, u32, u64	// unsigned integers
+f32, f64		// 32-bit and 64-bit IEEE floats
+bool			// 1-byte boolean, 0 or 1 only
+char			// 1-byte character (UTF-8)
+
+ +

Pointer types:

+ +

+T*	// Pointer to type T
+ptr*	// Special pointer with implicit coercion allowed (e.g., for GC, reflective systems)
+void*	// Opaque pointer with explicit cast required
+
+ +

All types have explicitly defined size and alignment. Structs support default values and zero-initialization rules:

+ +

+typedef struct {
+	u32 x = 5;
+	u32 y;
+} vec2u;
+
+vec2u a = {};	// x = 5, y = 0
+vec2u b = {0};	// x = 0, y = 0
+vec2u c;	// x = 0, y = 0 (default zero-init)
+
+ +

To opt out of default zero-initialization:

+ +

+@raw u32 raw_val; // uninitialized
+
+ +

Memory Model

+

Sterling uses explicit, manual memory management by default. All variables are zero-initialized unless explicitly marked with @raw. Heap allocation is done via standard system or custom allocators.

+ +

Alignment and packing are controllable per type (TBD syntax). All layout is predictable and optimized for cache behavior. There are no hidden fields, vtables, or RTTI overhead.

+ +

Operating System Development Features

+ + +

Metaprogramming

+

TODO: Describe 'meta' keyword, templating, compile-time codegen, restrictions on type inference.

+ +

ABI and Interop

+

TODO: Specify ABI model (System V AMD64), calling convention details, struct/pointer representation rules.

+ +

Threading

+

TODO: Describe standard threading model, scheduler integration, context switching, green threads API.

+ +

Graphics and Rendering

+

TODO: Describe native rendering interface, GPU abstraction layer, and access to OpenGL/DirectX backends.

+ +

Build and Compilation Model

+

TODO: AOT compilation, linker behavior, multi-file project structure, module system (if any).

+ + + + + + + + +

Function Syntax

+

Return types are mandatory and must be declared explicitly. The only exception is void, which can be omitted as it represents no return value.

+ +

+fn u32 add(u32 a, u32 b) {
+	return a + b;
+}
+
+fn_extern i32 printf(const char* fmt, ...);
+
+fn_inline u32 max(u32 a, u32 b) {
+	return (a > b) ? a : b;
+}
+
+fn exit() {
+	// equivalent to fn void exit()
+}
+
+ +

Assembly Functions

+

Write raw x86_64 assembly using fn_asm or fn_static_asm. Symbol, section, and global declarations are implicit.

+ +

+fn_asm void* memset(void* dst, u8 value, u64 size) {
+	test rdx, rdx
+	je .done
+
+	mov rax, rsi
+	mov rdi, rdi
+	mov rcx, rdx
+
+	rep stosb
+
+.done:
+	mov rax, rdi
+	ret
+}
+
+ +

Syscalls

+

System calls can be issued directly using fn_asm. Wrappers may be defined for ABI-safe interfaces.

+ +

+fn_asm void exit() {
+	mov rax, 60   ; syscall: exit
+	mov rdi, 0    ; exit code
+	syscall
+	ret
+}
+
+ +

Types

+ +

+i8, i16, i32, i64     // signed integers
+u8, u16, u32, u64     // unsigned integers
+f32, f64              // IEEE floats
+bool                  // 1-byte boolean
+char                  // UTF-8 byte
+
+ +

Pointer types:

+ +

+T*         // pointer to T
+ptr*       // special pointer with implicit coercion
+void*      // opaque pointer, explicit cast only
+
+ +

Structs support defaults and zero-initialization:

+ +

+typedef struct {
+	u32 x = 5;
+	u32 y;
+} vec2u;
+
+vec2u a = {};      // x = 5, y = 0
+vec2u b = {0};     // x = 0, y = 0
+vec2u c;           // x = 0, y = 0 (default)
+
+ +

+u32 raw @raw; // opt-out of zero-init
+
+ +

Memory Model

+ +

Arrays, strings, and bitfields are memory-safe by default with bounds-aware utility functions and type traits.

+ +

Metaprogramming

+ +

+meta define_add(T);
+T add(T a, T b) {
+	return a + b;
+}
+
+ +

Only primitive types are allowed without explicit overloads. Structs must implement meta_add manually. Compile-time execution is guaranteed only for pure expressions.

+ +

Control Flow Extensions

+

Designed for structured, optimized low-level behavior:

+

+match_const value {
+	0b0000: return EMPTY;
+	0b0001: return CORNER;
+	...
+}
+
+fallthrough_block(value) {
+	0b0011: case_edge;
+	0b1010: case_edge;
+
+	label case_edge:
+		// handle edge
+		break;
+}
+
+loop_outer: while (true) {
+	loop_inner: while (true) {
+		if (x) break loop_outer;
+	}
+}
+
+ +

Bitfields and Bit Types

+

Sterling supports bit and bitfield types to define compact data structures. Useful for efficient array storage, runtime layout configuration, and manual control of field width.

+

+bitfield struct TileMask {
+	bit corner : 1;
+	bit edge   : 1;
+	bit fill   : 1;
+	...
+}
+
+ +

Memory-Aware Structures

+

Sterling provides tools to construct layout-aware containers like aligned arrays, flexible bitfield arrays, and layout-optimized structures that adjust at runtime.

+ +

Nested Loop Control

+

Use labeled loop exits or control redirection to break from specific nesting levels without deep stacks:

+

+while (game_running) {
+	while (update_running) {
+		if (exit_to_game) break @2;
+	}
+}
+
+ +

Threading

+

TODO: Specify green threading model, context switch ABI, thread-local storage and atomic operations.

+ +

ABI and Interop

+

Sterling uses the System V AMD64 ABI. C interop requires exact type and calling signature match. All exported symbols must declare calling convention and linkage explicitly. Casts must be intentional. fn test() -> i32 syntax is not supported; return type must be declared in C form as fn i32 test().

+ +

Build and Compilation

+

TODO: Describe Sterling to C translation, compiler phases, linking steps, macro expansion and preprocessing rules.

+ + + + + + + + + Sterling Language Documentation + + + + +

Sterling Language Documentation

+

Version: 0.1.0-alpha

+ +

Overview

+

Sterling is a low-level, strongly typed, systems programming language designed for performance, ABI stability, C interoperability, and full control over memory and hardware. It supports metaprogramming, hot-reloading, inline and raw assembly, and is built for multi-file compilation.

+ +

File Extensions

+ + +

Function Qualifiers

+

Every function must declare its linkage explicitly:

+
fn               // globally visible, default linkage
+fn_static        // translation unit-local only
+fn_inline        // inline-only, no symbol emitted
+fn_asm           // raw assembly function, globally visible
+fn_static_asm    // raw assembly function, TU-local only
+ +

Function Syntax

+

All functions must explicitly declare their return type. The only exception is void, which may be omitted for brevity when no return value is intended.

+
fn u32 add(u32 a, u32 b) {
+	return a + b;
+}
+
+fn_inline u32 max(u32 a, u32 b) {
+	return (a > b) ? a : b;
+}
+
+fn exit() {
+	// equivalent to fn void exit()
+}
+ +

Assembly Functions

+

Write raw x86_64 assembly using fn_asm or fn_static_asm. Symbol, section, and global declaration are implicit.

+
fn_asm void* memset(void* dst, u8 value, u64 size) {
+	test rdx, rdx
+	je .done
+
+	mov rax, rsi
+	mov rdi, rdi
+	mov rcx, rdx
+
+	rep stosb
+
+.done:
+	mov rax, rdi
+	ret
+}
+ +

Syscalls

+

System calls are allowed via fn_asm or wrapped using concrete ABI-aware interfaces. Example:

+
fn_asm void exit() {
+	mov rax, 60   ; syscall: exit
+	mov rdi, 0    ; exit code
+	syscall
+	ret
+}
+ +

Register Access

+

Sterling exposes raw CPU registers as language-level primitives. This is intended for kernel, embedded, and runtime-critical tasks.

+
fn u64 get_rbp() {
+	return rbp;
+}
+
+fn void set_rsp(u64 val) {
+	rsp = val;
+}
+

Supported registers: rax, rbx, rcx, rdx, rsi, rdi, rsp, rbp, r8..r15. Usage outside permitted contexts may trigger compile-time errors. Clobber rules and calling conventions must be respected.

+ +

Types

+

Sterling supports explicitly sized, ABI-stable primitive types. Signed and unsigned integer types are defined as follows:

+
i8, i16, i32, i64     // signed integers
+u8, u16, u32, u64     // unsigned integers
+f32, f64              // 32-bit and 64-bit IEEE floats
+bool                  // 1-byte boolean, 0 or 1 only
+char                  // 1-byte character (UTF-8)
+

Pointer types:

+
T*         // Pointer to type T
+ptr*       // Special pointer with implicit coercion allowed (e.g., for GC, reflective systems)
+void*      // Opaque pointer with explicit cast required
+

All types have explicitly defined size and alignment. Structs support default values and zero-initialization rules:

+
typedef struct {
+	u32 x = 5;
+	u32 y;
+} vec2u;
+
+vec2u a = {};      // x = 5, y = 0
+vec2u b = {0};     // x = 0, y = 0
+vec2u c;           // x = 0, y = 0 (default zero-init)
+

To opt out of default zero-initialization:

+
u32 raw_val @raw; // uninitialized
+ +

Memory Model

+

Sterling uses explicit, manual memory management by default. All variables are zero-initialized unless explicitly marked with @raw. Heap allocation is done via standard system or custom allocators.

+ +

Alignment and packing are controllable per type (TBD syntax). All layout is predictable and optimized for cache behavior. There are no hidden fields, vtables, or RTTI overhead.

+ +

Metaprogramming

+

TODO: Describe 'meta' keyword, templating, compile-time codegen, restrictions on type inference.

+ +

ABI and Interop

+

TODO: Specify ABI model (System V AMD64), calling convention details, struct/pointer representation rules.

+ +

Threading

+

TODO: Describe standard threading model, scheduler integration, context switching, green threads API.

+ +

Graphics and Rendering

+

TODO: Describe native rendering interface, GPU abstraction layer, and access to OpenGL/DirectX backends.

+ +

Build and Compilation Model

+

TODO: AOT compilation, linker behavior, multi-file project structure.

+ + + diff --git a/docs/design.html b/docs/SterlingOsDesign.html similarity index 100% rename from docs/design.html rename to docs/SterlingOsDesign.html diff --git a/docs/server.go b/docs/server.go new file mode 100644 index 0000000..a6a4db5 --- /dev/null +++ b/docs/server.go @@ -0,0 +1,17 @@ +package main + +import ( + "log" + "net/http" +) + +func main() { + fs := http.FileServer(http.Dir("./sterling")) + http.Handle("/", fs) + + log.Println("Serving at http://localhost:8080") + err := http.ListenAndServe(":8080", nil) + if err != nil { + log.Fatal(err) + } +} diff --git a/docs/sterling.html b/docs/sterling.html deleted file mode 100644 index d9af81e..0000000 --- a/docs/sterling.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - Sterling Language Documentation - - - - -

Sterling Language Documentation

-

Version: 0.1.0-alpha

- -

Overview

-

Sterling is a low-level, strongly typed, systems programming language designed for performance, ABI stability, C interoperability, and full control over memory and hardware. It supports metaprogramming, hot-reloading, inline and raw assembly, and is built for multi-file compilation and dynamic linking.

- -

This Document is a work in progress, features are not yet implemented and i use this as a design document to stay true to my vision

- -

File Extensions

- - -

Function Qualifiers

-

Every function must declare its linkage explicitly:

- -

-fn		// globally visible, default linkage
-fn_static	// translation unit-local only
-fn_export	// must be exported to dynlib/staticlib
-fn_extern	// declared but defined elsewhere
-fn_inline	// inline-only, no symbol emitted
-fn_asm		// raw assembly function, globally visible
-fn_static_asm	// raw assembly function, TU-local only
-
- -

Function Syntax

-

All functions must explicitly declare their return type. The only exception is void, which may be omitted for brevity when no return value is intended.

- -

-fn u32 add(u32 a, u32 b) {
-	return (a + b);
-}
-
-fn_extern i32 printf(const char* fmt, ...);
-
-fn_inline u32 max(u32 a, u32 b) {
-	return ((a > b) ? a : b);
-}
-
-fn exit() {
-	// equivalent to fn void exit()
-}
-
- -

Assembly Functions

-

Write raw x86_64 assembly using fn_asm or fn_static_asm. Symbol, section, and global declaration are implicit.

- -

-fn_asm void* memset(void* dst, u8 value, u64 size) {
-	test rdx, rdx
-	je .done
-
-	mov rax, rsi
-	mov rdi, rdi
-	mov rcx, rdx
-
-	rep stosb
-
-.done:
-	mov rax, rdi
-	ret
-}
-
- -

Syscalls

-

System calls are allowed via fn_asm or wrapped using concrete ABI-aware interfaces. Example:

- -

-fn_asm void exit() {
-	mov rax, 60   ; syscall: exit
-	mov rdi, 0    ; exit code
-	syscall
-	ret
-}
-
- -

Types

-

Sterling supports explicitly sized, ABI-stable primitive types. Signed and unsigned integer types are defined as follows:

- -

-i8, i16, i32, i64	// signed integers
-u8, u16, u32, u64	// unsigned integers
-f32, f64		// 32-bit and 64-bit IEEE floats
-bool			// 1-byte boolean, 0 or 1 only
-char			// 1-byte character (UTF-8)
-
- -

Pointer types:

- -

-T*	// Pointer to type T
-ptr*	// Special pointer with implicit coercion allowed (e.g., for GC, reflective systems)
-void*	// Opaque pointer with explicit cast required
-
- -

All types have explicitly defined size and alignment. Structs support default values and zero-initialization rules:

- -

-typedef struct {
-	u32 x = 5;
-	u32 y;
-} vec2u;
-
-vec2u a = {};	// x = 5, y = 0
-vec2u b = {0};	// x = 0, y = 0
-vec2u c;	// x = 0, y = 0 (default zero-init)
-
- -

To opt out of default zero-initialization:

- -

-@raw u32 raw_val; // uninitialized
-
- -

Memory Model

-

Sterling uses explicit, manual memory management by default. All variables are zero-initialized unless explicitly marked with @raw. Heap allocation is done via standard system or custom allocators.

- -

Alignment and packing are controllable per type (TBD syntax). All layout is predictable and optimized for cache behavior. There are no hidden fields, vtables, or RTTI overhead.

- -

Operating System Development Features

- - -

Metaprogramming

-

TODO: Describe 'meta' keyword, templating, compile-time codegen, restrictions on type inference.

- -

ABI and Interop

-

TODO: Specify ABI model (System V AMD64), calling convention details, struct/pointer representation rules.

- -

Threading

-

TODO: Describe standard threading model, scheduler integration, context switching, green threads API.

- -

Graphics and Rendering

-

TODO: Describe native rendering interface, GPU abstraction layer, and access to OpenGL/DirectX backends.

- -

Build and Compilation Model

-

TODO: AOT compilation, linker behavior, multi-file project structure, module system (if any).

- - - diff --git a/docs/sterling/assets/IosevkaSS15-Regular.ttf b/docs/sterling/assets/IosevkaSS15-Regular.ttf new file mode 100644 index 0000000..da77b4c Binary files /dev/null and b/docs/sterling/assets/IosevkaSS15-Regular.ttf differ diff --git a/docs/sterling/css/base.css b/docs/sterling/css/base.css new file mode 100644 index 0000000..605b1ce --- /dev/null +++ b/docs/sterling/css/base.css @@ -0,0 +1,106 @@ +:root { + --bg-color: #0f1117; + --fg-color: #f4f4f4; + --accent-color: #36c; + --code-bg: #1a1c22; + --section-gap: 4rem; +} + +body { + margin: 0; + font-family: monospace; + background-color: var(--bg-color); + color: var(--fg-color); + transition: background 0.3s, color 0.3s; + display: flex; +} + +header { + background: #000; + padding: 1rem; + color: var(--fg-color); + text-align: center; + position: sticky; + top: 0; + width: 100%; + z-index: 10; + box-shadow: 0 0 10px #0008; + display: flex; + align-items: center; + justify-content: space-around; +} + +header h1 { + margin: 0; + font-size: 1.5rem; + color: var(--accent-color); +} + +#searchInput { + display: block; + position: relative; + top: 100%; + right: 1rem; + padding: 0.5rem; + border: 1px solid var(--fg-color); + z-index: 5; + width: 200px; + background: none; + color: var(--fg-color); +} + +.controls { + background: #111; + padding: 1rem; + border-top: 1px solid #333; + display: flex; + gap: 1rem; + justify-content: center; +} + +.controls button { + background: none; + border: 1px solid var(--fg-color); + color: var(--fg-color); + padding: 0.5rem 1rem; + cursor: pointer; +} + +main { + flex-grow: 1; + padding: 2rem; +} + +.section { + padding-bottom: 2rem; +} + +.section h2 { + color: var(--accent-color); + font-size: 1.25rem; + cursor: pointer; +} + +.section-content { + display: none; + margin-top: 1rem; +} + +.section.open .section-content { + display: block; +} + +code { + display: block; + background: var(--code-bg); + padding: 1rem; + margin: 1rem 0; + white-space: pre-wrap; + color: #aaffaa; +} + +@media print { + .controls, #searchDropdown, #searchToggle { + display: none !important; + } +} diff --git a/docs/sterling/html/back-end.html b/docs/sterling/html/back-end.html new file mode 100644 index 0000000..e69de29 diff --git a/docs/sterling/html/exemple.html b/docs/sterling/html/exemple.html new file mode 100644 index 0000000..e69de29 diff --git a/docs/sterling/html/start.html b/docs/sterling/html/start.html new file mode 100644 index 0000000..e69de29 diff --git a/docs/sterling/index.html b/docs/sterling/index.html new file mode 100644 index 0000000..063df9d --- /dev/null +++ b/docs/sterling/index.html @@ -0,0 +1,270 @@ + + + + + + + + Language Documentation + + + +
+
+

Sterling Documentation

+ +
+ +
+ + + +
+ +
+ +

Version: 0.1.0-alpha

+ +

Preface

+

An Idiot admire complexity, a genius admire simplicity Terry A. Davis

+

Master All, Ace One

+ +

Overview

+

Sterling is a low-level, strongly typed, systems programming language designed for performance, ABI stability, C interoperability, and full control over memory and hardware. It supports metaprogramming, hot-reloading, inline and raw assembly, and is built for multi-file compilation. It also introduces memory safety primitives and modern low-abstraction control flow enhancements.

+ +

This Document is a work in progress, features are not yet implemented and i use this as a design document to stay true to my vision

+ +

File Extensions (subject to change)

+ +
+

Function Qualifiers

+
+

Every function must declare its linkage explicitly:

+
+		

fn globally visible, default linkage

+

fn_static translation unit-local only

+

fn_inline inline-only, no symbol emitted

+

fn_asm raw assembly function, globally visible

+

fn_static_asm raw assembly function, TU-local only

+
+
+
+ +
+

Function Syntax

+
+ +

All functions must explicitly declare their return type. The only exception is void, which may be omitted for brevity when no return value is intended.

+ +

+fn u32 add(u32 a, u32 b) {
+	return (a + b);
+}
+
+fn_inline u32 max(u32 a, u32 b) {
+	return ((a > b) ? a : b);
+}
+
+fn exit() {
+	// equivalent to fn void exit()
+}
+
+
+
+ +
+

Assembly Functions

+
+

Write raw x86_64 assembly using fn_asm or fn_static_asm. Symbol, section, and global declaration are implicit.

+

+fn_asm void* memset(void* dst, u8 value, u64 size) {
+	test rdx, rdx
+	je .done
+
+	mov rax, rsi
+	mov rdi, rdi
+	mov rcx, rdx
+
+	rep stosb
+
+.done:
+	mov rax, rdi
+	ret
+}
+
+
+
+ +
+

Syscalls

+
+

System calls are allowed via fn_asm or wrapped using concrete ABI-aware interfaces. Example:

+

+fn_asm void exit() {
+	mov rax, 60   ; syscall: exit
+	mov rdi, 0    ; exit code
+	syscall
+	ret
+}
+
+
+
+ +
+

Register Access

+
+

Sterling exposes raw CPU registers as language-level primitives. This is intended for kernel, embedded, and runtime-critical tasks.

+

+fn u64 get_rbp() {
+	return rbp;
+}
+
+fn void set_rsp(u64 val) {
+	rsp = val;
+}
+
+

Supported registers: rax, rbx, rcx, rdx, rsi, rdi, rsp, rbp, r8..r15.

+
+
+ +
+

Types

+
+ +

+i8, i16, i32, i64	// signed integers
+u8, u16, u32, u64	// unsigned integers
+f32, f64		// 32-bit and 64-bit IEEE floats
+bool			// 1-byte boolean, 0 or 1 only
+char			// 1-byte character (UTF-8)
+
+

+T*	// Pointer to type T
+ptr*	// Special pointer with implicit coercion allowed
+void*	// Opaque pointer with explicit cast required
+
+

+typedef struct {
+	u32 x = 5;
+	u32 y;
+} vec2u;
+
+vec2u a = {};      // x = 5, y = 0
+vec2u b = {0};     // x = 0, y = 0
+vec2u c;           // x = 0, y = 0
+
+

+u32 raw_val @raw;
+
+
+
+ +
+

Memory Model

+
+

Manual memory management by default. Variables are zero-initialized unless marked @raw. All layout is predictable and cache-friendly. Custom allocators are encouraged.

+
    +
  • Stack: locals
  • +
  • Heap: explicit alloc/free
  • +
  • Inline: structs passed by value
  • +
+
+
+ +
+

Bitfields

+
+

+typedef struct(bitfield) {
+	u8 field0 : 3;
+	u8 field1 : 5;
+} Flags8;
+
+
+
+ +
+

Control Flow

+
+

Sterling introduces tagged loops and escape blocks for structured yet flat nested loop behavior:

+

+loop_outer: loop {
+	loop_inner: loop {
+		if (should_exit_inner()) break loop_inner;
+		if (should_exit_outer()) break loop_outer;
+	}
+}
+
+

This allows control without stack-nesting or excessive flags.

+
+
+ +
+

Dual Grid Branching Optimization

+
+

In place of traditional if-else trees for dual-tiling, prefer using precomputed lookup tables, or bitwise masks with packed branchless evaluation. Consider encoding tile states as compact u16 index and dereferencing behavior.

+
+
+ +
+

Dynamic Arrays with Aligned Layout

+
+

Runtime-initialized aligned linear arrays can be used to simulate array-of-array structures, where all memory layout is controlled explicitly with offsets:

+

+struct ArrayView {
+	u8* data;
+	u32 stride;
+	u32 count;
+};
+
+

Insertions and deletions move memory explicitly, re-aligning if needed.

+
+
+ +
+

Dynamic Linking

+
+

Sterling does not rely on dynamic linking by default. Static linking is favored for OS and runtime simplicity. Dynamic linking may be optionally implemented via host-defined facilities.

+
+
+ +
+

Metaprogramming

+
+

TODO: Describe 'meta' keyword, templating, compile-time codegen, restrictions on type inference.

+
+
+ +
+

ABI and Interop

+
+

TODO: Specify ABI model (System V AMD64), calling convention details, struct/pointer representation rules.

+
+
+ +
+

Threading

+
+

TODO: Describe standard threading model, scheduler integration, context switching, green threads API.

+
+
+ +
+

Graphics and Rendering

+
+

TODO: Describe native rendering interface

+
+
+ +
+

Build and Compilation Model

+
+

TODO: AOT compilation, linker behavior, multi-file project structure, module system (if any).

+
+
+ + + diff --git a/docs/sterling/js/base.js b/docs/sterling/js/base.js new file mode 100644 index 0000000..b9da8df --- /dev/null +++ b/docs/sterling/js/base.js @@ -0,0 +1,33 @@ +function toggleTheme() { + const root = document.documentElement; + const dark = root.style.getPropertyValue('--bg-color') === '#0f1117'; + root.style.setProperty('--bg-color', dark ? '#ffffff' : '#0f1117'); + root.style.setProperty('--fg-color', dark ? '#000000' : '#f4f4f4'); + root.style.setProperty('--code-bg', dark ? '#f0f0f0' : '#1a1c22'); +} + +function filterContent() { + const query = document.getElementById('searchInput').value.toLowerCase(); + document.querySelectorAll('.section').forEach(section => { + const text = section.innerText.toLowerCase(); + section.style.display = text.includes(query) ? 'block' : 'none'; + }); +} + +function downloadOfflineVersion() { + const blob = new Blob([document.documentElement.outerHTML], { type: 'text/html' }); + const a = document.createElement('a'); + a.href = URL.createObjectURL(blob); + a.download = 'SystemsLangDocumentation.html'; + a.click(); +} + +function toggleSection(header) { + const section = header.parentElement; + section.classList.toggle('open'); +} + +function toggleSearch() { + const dropdown = document.getElementById('searchDropdown'); + dropdown.style.display = dropdown.style.display === 'block' ? 'none' : 'block'; +}