feat: add while loops, break and continue statements
This commit is contained in:
@@ -45,29 +45,37 @@ A Rust-flavored, C-targeting language - built pipeline-first.
|
||||
- [x] Output System V AMD64 ABI-compliant `.o` machine code files
|
||||
- [x] End-to-end test: compile a simple `fn` → link via `gcc` → run → correct exit code
|
||||
|
||||
## Phase 5 - The Ray Tracer Milestone (Current)
|
||||
|
||||
To successfully write a simple ray tracer, we need continuous math, data structures, and I/O. The following path establishes these prerequisites:
|
||||
|
||||
- [ ] **Floating-Point Support:** Add `f32`/`f64` types, decimal literals, and Cranelift lowering for `fadd`, `fmul`, etc.
|
||||
- [ ] **FFI & Interop:** Implement `extern fn` declarations to bind C standard library functions (like `putchar` or `printf`) for `.ppm` image output.
|
||||
- [ ] **Type Casting:** Add the `as` operator to convert floating-point color bounds `[0.0, 1.0]` into integer byte formats `[0, 255]`.
|
||||
- [ ] **Pointers:** Add pointer types (`*T`), address-of (`&`), and dereference (`*`) operators.
|
||||
- [ ] **Structs:** Add `struct` definitions, initializers, and field access (`ray.origin.x`) to represent 3D vectors, rays, and spheres.
|
||||
- [ ] **Arrays:** Add fixed-size arrays (`[T; N]`) or heap allocations for the scene and framebuffers.
|
||||
|
||||
## Planned Features (Backlog)
|
||||
|
||||
### Control flow
|
||||
### Control flow & Variables
|
||||
- [x] booleans and comparision operators
|
||||
- [x] `if` / `else` branching
|
||||
- [ ] `while` loops
|
||||
- [x] `while` loops, `break`, `continue`
|
||||
- [x] `let` bindings and variable assignments
|
||||
|
||||
### Types & memory
|
||||
- [ ] Typed pointers (`*T`)
|
||||
- [ ] Opaque pointers (`*void` / `*opaque`)
|
||||
- [ ] Raw pointer arithmetic & dereference
|
||||
- [ ] Fixed-size arrays (`[T; N]`)
|
||||
- [ ] Raw pointer arithmetic
|
||||
- [ ] Slices (`&[T]` / `[]T`)
|
||||
|
||||
### Composite types
|
||||
- [ ] Structs & field access
|
||||
- [ ] Enums (C-style tagged unions)
|
||||
- [ ] Pattern matching (`match` / `switch`)
|
||||
|
||||
### Strings & interop
|
||||
- [ ] String literals & `*u8` handling
|
||||
- [ ] String literals
|
||||
- [ ] Variadic functions (for `printf` interop)
|
||||
- [ ] `extern` / FFI declarations
|
||||
|
||||
### Tooling & backend
|
||||
- [ ] Proper register allocator
|
||||
|
||||
Reference in New Issue
Block a user