aboutsummaryrefslogtreecommitdiff
path: root/code/main.felan
blob: 9047fd2eb9b05368809f2cf4caec7d66d3d63ce1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@import("basic.felan");

print :: (comptime t:type,v:t)->void{
  if @typeOf(v) == u8
    @putc(v);
  else
    @putc('n');
};

fun0 :: () -> void {
  i := 0;
  while true {
    i += 1;
    if i == 7
      return;
    else if i % 2 == 0
      continue;
    else if i == 8
      break;
    print(u8,@cast(i,u8)+'0');
    print(u16,@cast(@cast(i,u8) + '0',u16));
  }
};

fun1 :: ()->void{
  a :[20]u8 = undefined;
  a[0] = '2';
  @putc(a[0]);
};

fun2 :: ()->void{
  b := '2';
  c := &b;
  d := &c;
  d.*.* = '6';
  @putc(b);
  @putc(c.*);
  @putc(d.*.*);
};

fun3 :: ()->void{
  st :: struct{
    a : i64;
  };
  a : st = undefined;
  a.a = 2;
  @putc(@cast(a.a,u8)+'0');
};

main :: ()->void{
  fun0();
  fun1();
  fun2();
  fun3();
};