From 9b06c2548eec5a4ec67798ea6332d3df0d76ff81 Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Sat, 8 Oct 2022 10:16:02 +0200 Subject: [PATCH] Update readme --- README.md | 50 ++++++-------------------------------------------- core_main.cpp | 5 +++-- 2 files changed, 9 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index c6e8aed..db89901 100644 --- a/README.md +++ b/README.md @@ -73,46 +73,9 @@ Dot :: (a: Vec3, b: Vec3): F32 ;; return a.x*b.x + a.y*b.y + a.z*b.z "-" :: (a: Vec3, b: Vec3): Vec3 ;; return {a.x-b.x, a.y-b.y, a.z-b.z} ``` -## Unicode conversion example - -``` odin -Utf8ToUtf32 :: (c: *U8, max_advance: S64): U32, S64 - out_str: U32 - advance: S64 - if (c[0] & 0b10000000) == 0 - if max_advance >= 1 - c0 := c[0]->U32 - out_str = c0 - advance = 1 - - elif (c[0] & 0b11100000) == 0b11000000 - if (c[1] & 0b11000000) == 0b10000000 // Continuation byte required - if max_advance >= 2 - c0 := c[0]->U32; c1 := c[1]->U32 - out_str = (c0 & 0b00011111) << 6 | (c1 & 0b00111111) - advance = 2 - - elif (c[0] & 0b11110000) == 0b11100000 - if (c[1] & 0b11000000) == 0b10000000 && (c[2] & 0b11000000) == 0b10000000 // Two continuation bytes required - if max_advance >= 3 - c0 := c[0]->U32; c1 := c[1]->U32; c2 := c[2]->U32 - out_str = (c0 & 0b00001111) << 12 | (c1 & 0b00111111) << 6 | (c2 & 0b00111111) - advance = 3 - - elif (c[0] & 0b11111000) == 0b11110000 - if (c[1] & 0b11000000) == 0b10000000 && (c[2] & 0b11000000) == 0b10000000 && (c[3] & 0b11000000) == 0b10000000 // Three continuation bytes required - if max_advance >= 4 - c0 := c[0]->U32; c1 := c[1]->U32; c2 := c[2]->U32; c3 := c[3]->U32 - out_str = (c0 & 0b00001111) << 18 | (c1 & 0b00111111) << 12 | (c2 & 0b00111111) << 6 | (c3 & 0b00111111) - advance = 4 - - return out_str, advance -``` - ## What's missing ? - [x] Constant evaluation and constant folding - Folding and precomputing every expression that can be calculated at compile time. Which allows to check if a given constant expression is actually something that can be computed at compile time - - [ ] Constant expressions with concrete types without casting - [x] Untyped types - Context dependent type assignment of constant expressions, this is a feature I really loved in Go, it makes constants work very well with a very strict type system and it makes errors like overflow of constants in C due to bad size specifier impossible - [x] Infinite precision integers in constants @@ -134,7 +97,7 @@ Utf8ToUtf32 :: (c: *U8, max_advance: S64): U32, S64 - [x] All the standard binary, unary expressions - [x] Pointer arithmetic and pointer as array - [x] Dot access expression needs a redesign because it doesn't handle expressions after the dot, requires identifiers - - [ ] Casting might need a redesign not sure + - [ ] Casting might need a redesign not sure from '->' to 'cast' - [x] Runtime reflection - [x] Dumping info @@ -145,13 +108,8 @@ Utf8ToUtf32 :: (c: *U8, max_advance: S64): U32, S64 - [x] Slices - [ ] Dynamic arrays - [ ] Hash tables - - [ ] Tuples - - [x] Beginnings - - [x] Multiple return values from a function - - [ ] But do we actually want this? - - [ ] Some kind of tuple expressions - - [ ] Using tuples as single values without unpacking +- [x] Multiple return values - [ ] Generics / Parametric polymorphism @@ -161,6 +119,10 @@ Utf8ToUtf32 :: (c: *U8, max_advance: S64): U32, S64 - [x] Bulletproof - [ ] Assignment expressions? +- [x] Conditional compilation, you can include files based on a pattern: + - "$os_multimedia.core" expands to "win32_multimedia.core" or "unix_multimedia.core" depending on the platform. + - [ ] Compiler should include "linux_something.core" and "unix_something.core" at the same time + - [ ] Platforms - [x] Windows - [ ] Unix based diff --git a/core_main.cpp b/core_main.cpp index 55c65c6..ac66296 100644 --- a/core_main.cpp +++ b/core_main.cpp @@ -4,6 +4,7 @@ First doable version: - [ ] Imports are leaking names ! Multimedia leaks windows stuff - [ ] Test and bulletproof any, slices +- [ ] Include multiple pattern matched imports "unix_" and "linux_" both should be included on linux In the future @@ -12,8 +13,6 @@ In the future - [ ] Complicated c declaration generation - [ ] Way to import and force evaluate #import_lazy #import ? -- [ ] Conditional compilation, maybe based on some pattern matching - - [ ] #import "$OS.core" - [ ] Expand macros - [ ] Defer @@ -151,6 +150,8 @@ For modules it's a bit different cause they should be distributed as valid. ## Done +- [x] Conditional compilation, maybe based on some pattern matching + - [x] #import "$OS.core" - [x] You can't alias Lambdas because they are not evaluated as constant. I used a little simplification where lambdas and structs were marked as such in parsing I think. BUT Structs work so it's maybe just a little fix of constant