update documentation

This commit is contained in:
zongor 2025-07-05 23:51:12 -04:00
parent 7ec2f90d38
commit 9c94e4a6ef
6 changed files with 18 additions and 19 deletions

View File

@ -34,17 +34,17 @@
- =real= type (f32).
- =int= for integer numbers (i32).
- =nat= for unsigned integer numbers (u32).
- =byte= for interop (u8, i64, etc.).
- 3D math primitives: =vec=, =mat=, =quat=, and more.
- Strings with interpolation, =split=, =replace=, =trim=, etc.
- =byte= arrays for interop (u8, i64, etc.).
- =str= Strings with interpolation, =split=, =replace=, =trim=, etc.
- Error handling:
- try-catch
- Null coalescing (=??=) and null checks (=?.=).
- Fortran style array operations.
- Lightweight coroutines with event-loop-driven multitasking.
- FFI via C-defined "system calls" (examples provided in VM).
** Modularity & Ecosystem
- C-like arrays with fat pointers.
- Fortran-like arrays.
- Standard library: math, networking, 3D rendering, minimal GUI.
- =use= keyword for modular code organization via file-based namespaces.
@ -55,8 +55,7 @@
- Portable to new systems, microcontrollers, and web via Emscripten.
** Memory Management
- Reference counting for globally scoped objects.
- =weak= keyword to avoid cyclical references.
- Frame scoped arena allocators
** Rendering & I/O
- SDL2-based abstraction for input, audio, and rendering.

View File

@ -353,10 +353,10 @@ fn «token» («parameter» «type», ...) «return_type» {
:CUSTOM_ID: loops
:END:
#+begin_src zre
for («token» in «collection») { «body» }
for («variable» in «collection») { «body» }
#+end_src zre
iterates through each object in the collection setting it to token
iterates through each object in the collection setting it to variable
#+begin_src zre
while («boolean expression») { «body» }
@ -365,7 +365,7 @@ while («boolean expression») { «body» }
loops until the expression is false
#+begin_src zre
do (let «variable» = initial_value, end_value, increment) { «body» }
do («variable» = initial_value, end_value, increment) { «body» }
#+end_src zre
loops from initial value to end value by increment value (like a for loop in other languages)

View File

@ -7,7 +7,7 @@ fn main(argc real, argv str[]) {
let username = argv[0]; ! implied str
let password = argv[1]; ! implied str
let me = Player(username, Vec3(0.0, 1.0, 2.0), PURPLE); ! implied Player struct
let me = Player(username, [0.0, 1.0, 2.0], PURPLE); ! implied Player struct
let running = true;
while (running) {
@ -22,12 +22,12 @@ fn main(argc real, argv str[]) {
}
splitbox(parent.size 0.75) {
canvas("3D") {
model(Floor(Vec3(0, 0, 0), 30));
model(Floor([0, 0, 0], 30));
me.update();
model(Cube(me.pos, Vec3(0.5, 0.5, 0.5), me.appearance));
model(Cube(me.pos, [0.5, 0.5, 0.5], me.appearance));
if (let players = me.server.read("players")) {
for (p in players) {
model(Cube(p.pos, Vec3(0.5, 0.5, 0.5), p.apperance));
model(Cube(p.pos, [0.5, 0.5, 0.5], p.apperance));
}
}
}

View File

@ -7,10 +7,10 @@
! Camera .
!!
type Camera {
init(pos Vec3, look Vec3) {
init(pos [3]real, look [3]real) {
this.setting = "CAMERA_PERSPECTIVE";
this.pov = 45.0;
this.up = Vec3(0.0, 1.0, 0.0);
this.up = [0.0, 1.0, 0.0];
this.pos = pos;
this.look = look;
}
@ -20,13 +20,13 @@ type Camera {
! Player .
!!
type Player {
init(username str, pos Vec3, color Color) {
init(username str, pos real[3], color Color) {
this.server = Client("tcp://localhost:25565");
this.username = username;
this.pos = pos;
this.color = color;
this.camera =
Camera((this.pos.x + 10.0, this.pos.y + 10.0, this.pos.z), this.pos);
Camera([this.pos.x + 10.0, this.pos.y + 10.0, this.pos.z], this.pos);
}
login(str password) Player[] {

View File

@ -3,7 +3,7 @@ use "common.ztl";
fn main(argc real, argv str[]) {
let s = Server("tcp://0.0.0.0:25565");
let running = true;
let players = [Player("user", [0, 0, 0], RED)];
let players = [Player("user", [0., 0., 0.], RED)];
while (running) {
if (let client = s.accept("players")) {
if (let message = client.get()) {

View File

@ -1,4 +1,4 @@
fn add(a int, b int) int {
fn add(int a, int b) int {
return a + b;
}