repos / gbc

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

gbc / tests
xplshn  ·  2025-08-13

gbc.b

B
 1G[10];
 2V[5];
 3B; C;
 4
 5/* Function to demonstrate G[B](C) and G[B][C] */
 6demo() {
 7    G[B](C); /* Call function pointer at G[B] with C */
 8    V[1] = G[B][C]; /* Assign G[B][C] to V[1] */
 9    printf("%s\n", V[1] + '0'); /* Output result */
10}
11
12main() {
13    B = 2; /* Set index */
14    C = 2; /* Set value */
15    G[2] = printf; /* Store function pointer */
16    G[3] = V; /* Store vector pointer */
17    V[2] = 2; /* Set V[2] for G[3][2] */
18    G[B] = C; /* Assign C to G[2] */
19    demo(); /* Call demo function */
20}