End of an Era
This commit is contained in:
5
examples/Allocator.nct
Normal file
5
examples/Allocator.nct
Normal file
@@ -0,0 +1,5 @@
|
||||
record Allocator {
|
||||
u8* userdata;
|
||||
u8*(u8* userdata, u8* original, u32 size) realloc;
|
||||
}
|
||||
|
||||
5
examples/Exporter.nct
Normal file
5
examples/Exporter.nct
Normal file
@@ -0,0 +1,5 @@
|
||||
u32 SYMBOL: 1234;
|
||||
|
||||
record Foo {
|
||||
u32 gaga;
|
||||
}
|
||||
8
examples/FarPointer.nct
Normal file
8
examples/FarPointer.nct
Normal file
@@ -0,0 +1,8 @@
|
||||
u8 @far* x;
|
||||
u8 @far* y;
|
||||
|
||||
loop {
|
||||
u8 v = *x;
|
||||
*y = v;
|
||||
x.offset = x.offset + 1;
|
||||
}
|
||||
68
examples/HTTPFileServer.nct
Normal file
68
examples/HTTPFileServer.nct
Normal file
@@ -0,0 +1,68 @@
|
||||
record LibCSockAddrInet6 {
|
||||
u16 family;
|
||||
u16 port;
|
||||
u32 flowinfo;
|
||||
u8[16] address;
|
||||
}
|
||||
|
||||
@section(".text");
|
||||
|
||||
extern u32(u32 domain, u32 type, u32 protocol) socket;
|
||||
extern u32(u32 sockfd, u8* addr, u32 socklen) bind;
|
||||
extern u32(u32 sockfd, u32 backlog) listen;
|
||||
extern u32(u32 sockfd, u8* addr, u32* socklen) accept;
|
||||
extern u32(u32 sockfd, u8* data, u32 length) write;
|
||||
extern u32(u32 sockfd, u8* data, u32 length) read;
|
||||
extern u32(u32 fd) close;
|
||||
|
||||
main: u0() -> {
|
||||
SERV_SOCKET = socket(10, 1, 0);
|
||||
|
||||
LibCSockAddrInet6 addr;
|
||||
addr.family = 10; /* AF_INET6 */
|
||||
addr.port = 43105; /* 25000 in reversed endian */
|
||||
addr.flowinfo = 0;
|
||||
addr.address[0] = 0;
|
||||
addr.address[1] = 0;
|
||||
addr.address[2] = 0;
|
||||
addr.address[3] = 0;
|
||||
addr.address[4] = 0;
|
||||
addr.address[5] = 0;
|
||||
addr.address[6] = 0;
|
||||
addr.address[7] = 0;
|
||||
addr.address[8] = 0;
|
||||
addr.address[9] = 0;
|
||||
addr.address[10] = 0;
|
||||
addr.address[11] = 0;
|
||||
addr.address[12] = 0;
|
||||
addr.address[13] = 0;
|
||||
addr.address[14] = 0;
|
||||
addr.address[15] = 0;
|
||||
bind(SERV_SOCKET, &addr, @sizeof(addr));
|
||||
|
||||
listen(SERV_SOCKET, 16);
|
||||
|
||||
loop {
|
||||
u32 fd = accept(SERV_SOCKET, &addr, &SOCK_LEN);
|
||||
if(fd == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
read(fd, &BUFFER, @sizeof(BUFFER));
|
||||
write(fd, &RESPONSE, @sizeof(RESPONSE));
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
@section(".data");
|
||||
|
||||
u32 SOCK_LEN:;
|
||||
|
||||
u32 SERV_SOCKET:;
|
||||
|
||||
u8[?] RESPONSE: "HTTP/1.0 200 OK\r\nServer: NectarTestHTTPFileServer\r\nContent-Type: text/plain\r\n\r\nYo.";
|
||||
|
||||
u8[1024] BUFFER:;
|
||||
4
examples/Importer.nct
Normal file
4
examples/Importer.nct
Normal file
@@ -0,0 +1,4 @@
|
||||
use Exporter;
|
||||
|
||||
Foo f;
|
||||
f.gaga = SYMBOL;
|
||||
14
examples/IrregularAllocation.nct
Normal file
14
examples/IrregularAllocation.nct
Normal file
@@ -0,0 +1,14 @@
|
||||
u8 a = 12;
|
||||
u8 b = 19;
|
||||
u8 c = a + b;
|
||||
u32 d = 1;
|
||||
u8 e = d + 1;
|
||||
u32 f = 10;
|
||||
u32 g = 55;
|
||||
a;
|
||||
b;
|
||||
c;
|
||||
d;
|
||||
e;
|
||||
f;
|
||||
g;
|
||||
43
examples/ListDLC.nct
Normal file
43
examples/ListDLC.nct
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* ListDLC: Dynamic, Linear growth, C-managed
|
||||
*/
|
||||
|
||||
extern u8*(u8*, u32) realloc;
|
||||
|
||||
record ListDLC[T, S; growth] {
|
||||
S capacity;
|
||||
S size;
|
||||
T[?]* data;
|
||||
}
|
||||
|
||||
ListDLC_remove: [T, S; growth]u0(ListDLC[T, S; growth]* this, S index) -> {
|
||||
T* data0 = &((*((*this).data))[index]);
|
||||
T* data1 = data0 + @sizeof T;
|
||||
S sz = (*this).size;
|
||||
(*this).size = (*this).size - 1;
|
||||
loop {
|
||||
if(index == sz) {
|
||||
break;
|
||||
}
|
||||
|
||||
*data0 = *data1;
|
||||
|
||||
data0 = data0 + @sizeof T;
|
||||
data1 = data1 + @sizeof T;
|
||||
index = index + 1;
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
ListDLC_add: [T, S; growth]u0(ListDLC[T, S; growth]* this, T value) -> {
|
||||
if((*this).size == (*this).capacity) {
|
||||
u32 newcap = (*this).capacity + growth;
|
||||
(*this).capacity = newcap;
|
||||
(*this).data = realloc((*this).data, newcap * @sizeof T);
|
||||
}
|
||||
|
||||
(*((*this).data))[(*this).size] = value;
|
||||
(*this).size = (*this).size + 1;
|
||||
|
||||
return;
|
||||
};
|
||||
27
examples/ListS.nct
Normal file
27
examples/ListS.nct
Normal file
@@ -0,0 +1,27 @@
|
||||
record ListS[T, S; capacity] {
|
||||
S size;
|
||||
T[capacity] data;
|
||||
}
|
||||
|
||||
ListS_remove: [T, S; capacity]u0(ListS[T, S; capacity]* this, S index) -> {
|
||||
T* data = &((*this).data[index]);
|
||||
(*this).size = (*this).size - 1;
|
||||
S sz = (*this).size;
|
||||
loop {
|
||||
if(index == sz) {
|
||||
break;
|
||||
}
|
||||
|
||||
*data = *(data + 1);
|
||||
|
||||
data = data + 1;
|
||||
index = index + 1;
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
ListS_add: [T, S; capacity]u0(ListS[T, S; capacity]* this, T value) -> {
|
||||
(*this).data[(*this).size] = value;
|
||||
(*this).size = (*this).size + 1;
|
||||
return;
|
||||
};
|
||||
14
examples/ScalarReplacementOptimization.nct
Normal file
14
examples/ScalarReplacementOptimization.nct
Normal file
@@ -0,0 +1,14 @@
|
||||
record X {
|
||||
u32 a;
|
||||
u32 b;
|
||||
}
|
||||
|
||||
main: u0() -> {
|
||||
X x;
|
||||
x.a = 5;
|
||||
x.b = 6;
|
||||
|
||||
u32 c = x.a + x.b;
|
||||
|
||||
return;
|
||||
};
|
||||
43
examples/UDPEcho.nct
Normal file
43
examples/UDPEcho.nct
Normal file
@@ -0,0 +1,43 @@
|
||||
@section(".text");
|
||||
|
||||
record sockaddr {
|
||||
0: u16 family;
|
||||
2: u16 port;
|
||||
4: u32 addr;
|
||||
8: u32 zero0;
|
||||
12: u32 zero1;
|
||||
}
|
||||
|
||||
extern u32(u32, u32, u32) socket;
|
||||
extern u32(u32, sockaddr*, u32) bind;
|
||||
extern u32(u32, u8*, u32, u32, u8*, u32*) recvfrom;
|
||||
extern u32(u32, u8*, u32, u32, u8*, u32) sendto;
|
||||
|
||||
MY_SOCKET = socket(2, 2, 0);
|
||||
|
||||
sockaddr sa;
|
||||
sa.family = 2; /* AF_INET */
|
||||
sa.port = 43105; /* 25000 in net-endian */
|
||||
sa.addr = 0; /* Bind to all */
|
||||
sa.zero0 = 0;
|
||||
sa.zero1 = 0;
|
||||
|
||||
bind(MY_SOCKET, &sa, 16);
|
||||
|
||||
loop {
|
||||
|
||||
OTHER_SIDE_LEN = 64;
|
||||
u32 msglength = recvfrom(MY_SOCKET, &BUFFER, 512, 0, &OTHER_SIDE, &OTHER_SIDE_LEN);
|
||||
|
||||
sendto(MY_SOCKET, &BUFFER, msglength, 0, &OTHER_SIDE, OTHER_SIDE_LEN);
|
||||
|
||||
}
|
||||
|
||||
@section(".data");
|
||||
|
||||
u32 MY_SOCKET:;
|
||||
|
||||
u32 OTHER_SIDE_LEN:;
|
||||
u8[64] OTHER_SIDE:;
|
||||
|
||||
u8[512] BUFFER:;
|
||||
18
examples/UserListDLC.nct
Normal file
18
examples/UserListDLC.nct
Normal file
@@ -0,0 +1,18 @@
|
||||
use ListDLC;
|
||||
|
||||
@section(".text");
|
||||
|
||||
@instantiate ListDLC_remove[u32, u32; 9];
|
||||
@instantiate ListDLC_add[u32, u32; 9];
|
||||
|
||||
main: u0() -> {
|
||||
ListDLC[u32, u32; 9] list;
|
||||
ListDLC_add[u32, u32; 9](&list, 1234);
|
||||
ListDLC_add[u32, u32; 9](&list, 4321);
|
||||
ListDLC_add[u32, u32; 9](&list, 7777);
|
||||
ListDLC_add[u32, u32; 9](&list, 6969);
|
||||
ListDLC_remove[u32, u32; 9](&list, 1);
|
||||
return;
|
||||
};
|
||||
|
||||
@section(".bss");
|
||||
2
examples/arrays.nct
Normal file
2
examples/arrays.nct
Normal file
@@ -0,0 +1,2 @@
|
||||
u32[5] arr;
|
||||
arr[0] = 0;
|
||||
75
examples/bf.nct
Normal file
75
examples/bf.nct
Normal file
@@ -0,0 +1,75 @@
|
||||
@section(".data");
|
||||
|
||||
local u8[16384] data:;
|
||||
local u8[16384] code:;
|
||||
|
||||
local u32[64] stck:;
|
||||
|
||||
@section(".text");
|
||||
|
||||
extern u32(u32, u8*, u32) write;
|
||||
extern u32(u32, u8*, u32) read;
|
||||
|
||||
read(0, &code, 16384);
|
||||
|
||||
u32 codePtr = 0;
|
||||
u32 dataPtr = 0;
|
||||
u32 stckPtr = 16rFFFFFFFF;
|
||||
|
||||
loop {
|
||||
if(code[codePtr] == 62) {
|
||||
dataPtr = dataPtr + 1;
|
||||
}
|
||||
if(code[codePtr] == 60) {
|
||||
dataPtr = dataPtr - 1;
|
||||
}
|
||||
if(code[codePtr] == 43) {
|
||||
data[dataPtr] = data[dataPtr] + 1;
|
||||
}
|
||||
if(code[codePtr] == 45) {
|
||||
data[dataPtr] = data[dataPtr] - 1;
|
||||
}
|
||||
if(code[codePtr] == 46) {
|
||||
write(1, &data + dataPtr, 1);
|
||||
}
|
||||
if(code[codePtr] == 44) {
|
||||
read(0, &data + dataPtr, 1);
|
||||
}
|
||||
if(code[codePtr] == 91) {
|
||||
if(data[dataPtr] == 0) {
|
||||
u32 depth = 0;
|
||||
loop {
|
||||
if(code[codePtr] == 91) {
|
||||
depth = depth + 1;
|
||||
}
|
||||
if(code[codePtr] == 93) {
|
||||
depth = depth - 1;
|
||||
}
|
||||
if(depth == 0) {
|
||||
break;
|
||||
}
|
||||
codePtr = codePtr + 1;
|
||||
}
|
||||
}
|
||||
if(data[dataPtr] != 0) {
|
||||
stckPtr = stckPtr + 1;
|
||||
stck[stckPtr] = codePtr;
|
||||
}
|
||||
|
||||
codePtr = codePtr + 1;
|
||||
continue;
|
||||
}
|
||||
if(code[codePtr] == 93) {
|
||||
if(data[dataPtr] == 0) {
|
||||
stckPtr = stckPtr - 1;
|
||||
}
|
||||
if(data[dataPtr] != 0) {
|
||||
codePtr = stck[stckPtr];
|
||||
}
|
||||
}
|
||||
if(code[codePtr] == 0) {
|
||||
loop {}
|
||||
}
|
||||
|
||||
codePtr = codePtr + 1;
|
||||
}
|
||||
11
examples/bit-rounding.nct
Normal file
11
examples/bit-rounding.nct
Normal file
@@ -0,0 +1,11 @@
|
||||
u32 x: 123;
|
||||
u33 y: 5;
|
||||
|
||||
u3* o = 5000;
|
||||
u32 z = *o;
|
||||
u3 p = *(o + z);
|
||||
u3 *g = o - z;
|
||||
p = *g;
|
||||
|
||||
u32 c = 566;
|
||||
u16 j = c;
|
||||
10
examples/cat.nct
Normal file
10
examples/cat.nct
Normal file
@@ -0,0 +1,10 @@
|
||||
extern u8(u8) putchar;
|
||||
extern u32() getchar;
|
||||
|
||||
loop {
|
||||
u32 a = getchar();
|
||||
if(a == -1) {
|
||||
break;
|
||||
}
|
||||
putchar(a);
|
||||
}
|
||||
48
examples/countwords.nct
Normal file
48
examples/countwords.nct
Normal file
@@ -0,0 +1,48 @@
|
||||
@section(".data");
|
||||
|
||||
local u8[33] finalstring: "The amount of words in stdin is: ";
|
||||
|
||||
local u8[4] answer: "0000";
|
||||
|
||||
@section(".text");
|
||||
|
||||
extern s32() getchar;
|
||||
extern s32(s32, u8*, u32) write;
|
||||
|
||||
increase: u0() -> {
|
||||
answer[3] = answer[3] + 1;
|
||||
if(answer[3] > 57) {
|
||||
answer[3] = 48;
|
||||
answer[2] = answer[2] + 1;
|
||||
if(answer[2] > 57) {
|
||||
answer[2] = 48;
|
||||
answer[1] = answer[1] + 1;
|
||||
if(answer[1] > 57) {
|
||||
answer[1] = 48;
|
||||
answer[0] = answer[0] + 1;
|
||||
if(answer[0] > 57) {
|
||||
answer[0] = 48;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
main: u0() -> {
|
||||
loop {
|
||||
s32 c = getchar();
|
||||
if(c == -1) {
|
||||
break;
|
||||
}
|
||||
if(c == 32) {
|
||||
increase();
|
||||
}
|
||||
}
|
||||
|
||||
write(1, &finalstring, 33);
|
||||
write(1, &answer, 4);
|
||||
|
||||
return;
|
||||
};
|
||||
6
examples/funcdefs.nct
Normal file
6
examples/funcdefs.nct
Normal file
@@ -0,0 +1,6 @@
|
||||
fibonacci: u32(u32 n) -> {
|
||||
if(n <= 1) {
|
||||
return n;
|
||||
}
|
||||
return fibonacci(n - 1) + fibonacci(n - 2);
|
||||
};
|
||||
12
examples/functions.nct
Normal file
12
examples/functions.nct
Normal file
@@ -0,0 +1,12 @@
|
||||
extern s32() getchar;
|
||||
extern u0(s32) putchar;
|
||||
|
||||
loop {
|
||||
s32 z = 5;
|
||||
s32 a = getchar();
|
||||
if(a == -1) {
|
||||
break;
|
||||
}
|
||||
putchar(a);
|
||||
putchar(z);
|
||||
}
|
||||
12
examples/if.nct
Normal file
12
examples/if.nct
Normal file
@@ -0,0 +1,12 @@
|
||||
u16 x: 5;
|
||||
loop {
|
||||
u16* y = 257;
|
||||
u9 w = -4;
|
||||
u16 p = *y;
|
||||
u4 z = p + 3;
|
||||
u2 o = -w;
|
||||
|
||||
if(x != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
11
examples/loopregalloc.nct
Normal file
11
examples/loopregalloc.nct
Normal file
@@ -0,0 +1,11 @@
|
||||
u8 a;
|
||||
|
||||
a = 2;
|
||||
|
||||
loop {
|
||||
a = 3;
|
||||
|
||||
u8 b = 1;
|
||||
|
||||
u8 c = 2;
|
||||
}
|
||||
16
examples/lvl1localrecord.nct
Normal file
16
examples/lvl1localrecord.nct
Normal file
@@ -0,0 +1,16 @@
|
||||
record sockaddr {
|
||||
u32 family;
|
||||
u16 port;
|
||||
u32 addr;
|
||||
u32 zero;
|
||||
}
|
||||
|
||||
@section(".data");
|
||||
|
||||
@section(".text");
|
||||
|
||||
sockaddr sa;
|
||||
sa.family = 5;
|
||||
sa.port = 43105;
|
||||
sa.addr = 16rC0A80001;
|
||||
sa.zero = 0;
|
||||
17
examples/lvl1symbolrecord.nct
Normal file
17
examples/lvl1symbolrecord.nct
Normal file
@@ -0,0 +1,17 @@
|
||||
record sockaddr {
|
||||
u32 family;
|
||||
u16 port;
|
||||
u32 addr;
|
||||
u32 zero;
|
||||
}
|
||||
|
||||
@section(".data");
|
||||
|
||||
sockaddr sa:;
|
||||
|
||||
@section(".text");
|
||||
|
||||
sa.family = 5;
|
||||
sa.port = 43105;
|
||||
sa.addr = 16rC0A80001;
|
||||
sa.zero = 0;
|
||||
16
examples/lvl2localrecord.nct
Normal file
16
examples/lvl2localrecord.nct
Normal file
@@ -0,0 +1,16 @@
|
||||
record A {
|
||||
u32 x;
|
||||
u8 z;
|
||||
}
|
||||
|
||||
record B {
|
||||
0: u32 x;
|
||||
7: A a;
|
||||
}
|
||||
|
||||
@section(".text");
|
||||
|
||||
B rec;
|
||||
rec.x = 5;
|
||||
rec.a.x = 10;
|
||||
rec.a.z = 9;
|
||||
19
examples/lvl2symbolrecord.nct
Normal file
19
examples/lvl2symbolrecord.nct
Normal file
@@ -0,0 +1,19 @@
|
||||
record A {
|
||||
u32 x;
|
||||
u8 z;
|
||||
}
|
||||
|
||||
record B {
|
||||
u32 x;
|
||||
A a;
|
||||
}
|
||||
|
||||
@section(".data");
|
||||
|
||||
B rec:;
|
||||
|
||||
@section(".text");
|
||||
|
||||
rec.x = 5;
|
||||
rec.a.x = 10;
|
||||
rec.a.z = 9;
|
||||
145
examples/mandelbrot.b
Normal file
145
examples/mandelbrot.b
Normal file
@@ -0,0 +1,145 @@
|
||||
A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
|
||||
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
|
||||
>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+
|
||||
<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>>
|
||||
>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>>
|
||||
>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>>
|
||||
>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>
|
||||
[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<<<<<<<[<<<<<<<
|
||||
<<]>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<<<]>>>>>>>>>+++++++++++++++[[
|
||||
>>>>>>>>>]+>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]>[-]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>-]+[
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>>>>>>>>>]<<<<<<<<<[>[-]<-
|
||||
>>>>>>>>[-<<<<<<<<+>[<->-<<+>>]<[->+<]>>>>>>>>]<<<<<<<[->>>>>>>+<<<<<<<]<+<<<<<<
|
||||
<<<]>>>>>>>>-<<<<<[-]+<<<]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>>->[>>>
|
||||
>>>[->>+<<]>>>]<<<<<<<<<[>[-]<->>>>>>>>[-<<<<<<<<+>[<->-<<+>>]<[->+<]>>>>>>>>]<<
|
||||
<<<<<[->>>>>>>+<<<<<<<]<+<<<<<<<<<]>+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>
|
||||
+>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<[<<<<<<<<<]>>>>>>>>>[>>>>>>[-<<<<<<->>>>>>]+<
|
||||
<<<<<[->>>>>>->>[-<<<<<<<<+>>>>>>>>]<<<<<<<<[->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<<
|
||||
<<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>>
|
||||
-<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>>
|
||||
>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++
|
||||
+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<
|
||||
<<<<<]]>>>]
|
||||
22
examples/mbr.nct
Normal file
22
examples/mbr.nct
Normal file
@@ -0,0 +1,22 @@
|
||||
@org(16r7C00);
|
||||
|
||||
u8* dest = 16rB8000;
|
||||
u8* src = &string;
|
||||
|
||||
loop {
|
||||
if(*src == 0) {
|
||||
break;
|
||||
}
|
||||
*dest = *src;
|
||||
dest = dest + 1;
|
||||
*dest = "_";
|
||||
dest = dest + 1;
|
||||
src = src + 1;
|
||||
}
|
||||
|
||||
loop {}
|
||||
|
||||
u8[19] string: "Hello from Nectar!\0";
|
||||
|
||||
@align(510);
|
||||
u16 bootsig: 16rAA55;
|
||||
9
examples/ops.nct
Normal file
9
examples/ops.nct
Normal file
@@ -0,0 +1,9 @@
|
||||
u16 a = 12;
|
||||
u16 b = a & 6;
|
||||
u16 c = b ^ a | 3;
|
||||
u16 o = 5;
|
||||
u16 d = o * 2;
|
||||
|
||||
if(a == 0) {
|
||||
u16 e = b + c + d;
|
||||
}
|
||||
23
examples/parsenum.nct
Normal file
23
examples/parsenum.nct
Normal file
@@ -0,0 +1,23 @@
|
||||
@section(".data");
|
||||
|
||||
u8 buf: 0;
|
||||
|
||||
@section(".text");
|
||||
|
||||
extern u0(u32) exit;
|
||||
extern s32(u32, u8*, u32) read;
|
||||
|
||||
_start: u0() -> {
|
||||
u16 value = 0;
|
||||
|
||||
loop {
|
||||
if(read(0, &buf, 1) != 1) {
|
||||
break;
|
||||
}
|
||||
buf = buf - 48;
|
||||
value = value * 10;
|
||||
value = value + buf;
|
||||
}
|
||||
|
||||
exit(value);
|
||||
};
|
||||
5
examples/scoping.nct
Normal file
5
examples/scoping.nct
Normal file
@@ -0,0 +1,5 @@
|
||||
u8 a = 5;
|
||||
if(a != 0) {
|
||||
u8 a = 10; /* Should not cause scoping errors. */
|
||||
}
|
||||
u8 b = 15; /* `a` in the if statement scope should be free'd. */
|
||||
6
examples/spill.nct
Normal file
6
examples/spill.nct
Normal file
@@ -0,0 +1,6 @@
|
||||
u8 a = 4;
|
||||
u8 b = 1;
|
||||
u8 c = 9;
|
||||
u8 d = 5;
|
||||
u8 e = 22;
|
||||
u8 f = a + b + c + d + e;
|
||||
1
examples/stack.nct
Normal file
1
examples/stack.nct
Normal file
@@ -0,0 +1 @@
|
||||
@stack = @stack - 123;
|
||||
Reference in New Issue
Block a user