/*
Comments and /*nested*/commentsareathing*/ptinf(T:string,c:...any)->int;// We just declare the signature, it is implemented in a c fileMyStruct:Struct{id:int;age:u8;}main:=()->int{a:int;a=1;b:int=2;c:=a+b;printf("The value of c is %d\n",c);// 3arr:int[10];mys:MyStruct;mys.id=2;arr[0]=mys.id;printf("The id is %d, and the 0th element is %d\n",mys.id,arr[0]);// 2, 2// We also have pointers:p:*int;p=&c;*p=2;printf("The value of c is %d\n",c);// 2return0;}
如你所见,目前这个阶段它还很基础,但我计划实现一些日常会用到的东西。该程序使用 llvm-backend,允许我将其与 C 文件链接在一起,既可以调用 C 函数,也可以提供供 C(或任何其他可以使用 C 的语言)调用的函数。