speedcat/test_type_checker.cat
Slendi 0f5db0972c Use LLVM-18
Signed-off-by: Slendi <slendi@socopon.com>
2024-04-08 00:11:36 +03:00

97 lines
1.5 KiB
Plaintext

\\let asdf := 0b1101 as f32
\\let poop :: 12.0 + 2.0 * asdf
\
\\fn name(a b: f32) i32 {
\\ ret (a + b) as i32
\\}
\
\\name 123.0 456.0
\
\\let arr: []i32, arr2: [69]u8, ptr: ^i32
\
\fn meow(val: i32) i32
\
\let amogus := 500 + (meow 8008135)
\
\meow 69 * amogus + 420
\
\let a b := 5 1
\
\if a == 5 {
\ if b {
\ meow 123
\ } else {
\ meow 69
\ }
\} elif a == 2 {
\ meow 456
\} else {
\ meow 420
\}
\
\fn add(a b: i32) i32 {
\ ret a + b
\}
\
\for a != 0 {
\ meow (1 << a) >> 1
\ a = a - 1
\}
\
\(meow (add 60 9)) -> meow
struct Color {
a b g r: u8,
}
fn ClearBackground(c: u32)
fn DrawRectangle(x y w h: i32, c: u32)
fn DrawCircle(x y: i32, r: f32, c: u32)
fn InitWindow(w h: i32, title: i32)
fn CloseWindow
fn BeginDrawing
fn SetTargetFPS(fps: i32)
fn EndDrawing
fn DrawFPS(x y: i32)
fn WindowShouldClose i32
1 << 3 | 2
fn ColorToRaylib(c: Color) u32 {
ret c.a as u32 << 24 | c.b as u32 << 16 | c.g as u32 << 8 | c.r
}
fn ClearBackgroundWrap(c: Color) {
ClearBackground (ColorToRaylib c)
}
fn DrawRectangleWrap(x y w h: i32, c: Color) {
DrawRectangle x y w h (ColorToRaylib c)
}
fn DrawCircleWrap(x y: i32, r: f32, c: Color) {
DrawCircle x y r (ColorToRaylib c)
}
let white :: .Color{255 69 69 69}
let red :: .Color{255 0 0 255}
let blue :: .Color{255 0 255 255}
let x := 0
InitWindow 640 480 0
SetTargetFPS 30
for WindowShouldClose == 0 {
x = x + 1
BeginDrawing
ClearBackgroundWrap white
DrawFPS 20 20
DrawRectangleWrap 80 x 100 200 red
DrawCircleWrap 200 200 100.0 blue
EndDrawing
}
CloseWindow