feat: add support for structs and member access

This commit is contained in:
2026-04-22 23:49:13 +02:00
parent f3c93fa516
commit ec2aa771fa
12 changed files with 1006 additions and 101 deletions
+29
View File
@@ -0,0 +1,29 @@
[code]
foreign fn putchar(c: i32) -> i32;
struct Point {
x: i32,
y: i32
}
fn print_num(n: i32) {
// Simple hack to print a 2-digit number for testing
putchar(48 + (n / 10));
putchar(48 + (n % 10));
putchar(10); // newline
}
fn main() -> i32 {
let p = Point { x: 40, y: 2 };
// 40 + 2 = 42
print_num(p.x + p.y);
return 0;
}
[expected_return_code]
0
[expected_output]
42