repos / gbc

GBC - Go B Compiler
git clone https://github.com/xplshn/gbc.git

gbc / tests
xplshn  ·  2025-09-10

bxDecls.bx

Bx
 1extrn printf;
 2
 3puts(arg string){
 4    printf("%s\n", arg);
 5}
 6
 7global_short := 10;
 8
 9auto global_auto = 20;
10auto global_multi_1, global_multi_2 = 30, 40;
11
12auto global_multi_3, global_multi_4 = 80, 100;
13
14main() {
15    auto local_auto;
16    local_auto = 50;
17
18    local_short := 60;
19    local_multi_short_1, local_multi_short_2 := 70, 80;
20
21    if (global_short != 10) {
22        puts("FAIL: global_short");
23        return (1);
24    }
25    if (global_auto != 20) {
26        puts("FAIL: global_auto");
27        return (1);
28    }
29    if (global_multi_1 != 30 || global_multi_2 != 40) {
30        puts("FAIL: global_multi");
31        return (1);
32    }
33    if (local_auto != 50) {
34        puts("FAIL: local_auto");
35        return (1);
36    }
37    if (local_short != 60) {
38        puts("FAIL: local_short");
39        return (1);
40    }
41    if (local_multi_short_1 != 70 || local_multi_short_2 != 80) {
42        puts("FAIL: local_multi_short");
43        return (1);
44    }
45
46    puts("PASS: All Bx declaration syntax works.\n");
47    return (0);
48}