summaryrefslogtreecommitdiff
path: root/code/main.felan
diff options
context:
space:
mode:
Diffstat (limited to 'code/main.felan')
-rw-r--r--code/main.felan77
1 files changed, 74 insertions, 3 deletions
diff --git a/code/main.felan b/code/main.felan
index a49972b..15dbe68 100644
--- a/code/main.felan
+++ b/code/main.felan
@@ -1,7 +1,46 @@
+ptr :: (t:type) -> type {
+ return struct {
+ address : u64;
+ t :: t;
+ };
+};
+
+array :: (t:type,length:u64)->type{
+ return struct {
+ ptr : *t;
+ length :: length;
+ };
+};
+
main :: () -> void {
- a : [10]u8 = undefined;
- a[0] = 2;
- print(123);
+ test : array(u64,@cast(8,u64)) = undefined;
+ test2 : array(u64,@cast(8,u64)) = undefined;
+ println(@typeOf(test) == @typeOf(test2));
+ test.ptr = null;
+ test.length;
+};
+
+print :: (value:[10]u8)->void{
+ println(23);
+};
+
+println :: ()->void{
+ putc '\n';
+};
+
+println :: (value:i64)->void{
+ print(value);
+ putc '\n';
+};
+
+println :: (value:u64)->void{
+ print(value);
+ putc '\n';
+};
+
+println :: (value:bool)->void{
+ print(value);
+ putc '\n';
};
print :: (value:i64)->void{
@@ -20,3 +59,35 @@ print :: (value:i64)->void{
i -= 1;
}
};
+
+print :: (value:u64)->void{
+ value := value;
+ a : [20]u8 = undefined;
+ i := 0;
+ while {
+ a[i] = '0' + @cast(value % 10,u8);
+ i += 1;
+ value /= 10;
+ value != 0;
+ } {}
+
+ while i > 0 {
+ putc a[i-1];
+ i -= 1;
+ }
+};
+
+print :: (value:bool)->void{
+ if value {
+ putc 't';
+ putc 'r';
+ putc 'u';
+ putc 'e';
+ }else{
+ putc 'f';
+ putc 'a';
+ putc 'l';
+ putc 's';
+ putc 'e';
+ }
+};