diff options
Diffstat (limited to 'test.yx')
-rw-r--r-- | test.yx | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/test.yx b/test.yx deleted file mode 100644 index 346f095..0000000 --- a/test.yx +++ /dev/null @@ -1,133 +0,0 @@ -X :: 5; -Y: u8 : X; -Z :: Y; - -ZZ :: 127; - -my_global: i8 = ZZ; -no_init: u128; - -another_global := 123'456'789; - -uninit :: () { - x: int = …; - y: u32 = ...; -} - -pub main :: () { - no_init: u128; - x := no_init; - - no_init_undef: int = …; -} - -pub bar :: () int { - hello_world_this_is_my_var := 126; - hello_world_this_is_my_var′ := 127; - hello_world_this_is_my_var″ := 128; - return hello_world_this_is_my_var′; -} - -foo :: () int { - baz :: () int { - X :: X; - return X; - } - - y := 5; - x := y; - return x; -} - -rune :: () { - ch: rune = 8224; /* U+2020 DAGGER */ -} - -float_test :: () { - π :: 3.14159265358979323846264338327950288419716939937510582097494459; - a: f16 = π; - b: f32 = π; - c: f64 = π; - d: f128 = π; - - f := 3.14; -} - -/* Yes we have comments in this language, - /* You can even nest them! */ */ - -/* There are no line-comments, because why have 2 styles when you can have 1? */ - -neg_test :: () int { - x := 420; - return -x; -} - -/* This method should return 1337, because it’s not an increment but - actually parsed as (+ (+ x)), which is equivalant to ‘x’. */ -some_math :: () int { - x := 1337; - return ++x; -} - -complex_math :: () uint { - x: uint = 42; - y: uint = 123; - z := (x + y) / x; - return x + y / x; -} - -div :: () f64 { - return 5 / 2; -} - -remainder :: () int { - x := 5; - y := 2; - z := 5 % 2; - return x % y; -} - -xor :: () int { - x := 42; - y := 123; - z := ~y; - return x + z ~ y; -} - -shl_kinda_sus :: () u8 { - x: u8 = 1; - y: u16 : 1<<8 - 1; - return x<<y; -} - -shr :: () u8 { - x: u8 = 255; - y: u8 = 3; - return x >> 256; -} - -bit_fidling :: () int { - x := 122; - y := x | 1; - return y; -} - -assignment :: () int { - x := 5; - y := 4; - x = x + y; - y = 69; - return x + y; -} - -some_global: int; -mutate_global :: () { - some_global = 42; -} - -float_div :: () f64 { - x := 5.0; - y := 2.0; - return x / y; -} |