That is an absolutely brilliant QA report from your dev-chat. Designing a
cellular automata grid to circumvent the lack of multiplication by using
addition and manual row-tracking is exactly the kind of battle-testing a
custom compiler needs.
However, if we look under the hood at the MVP architecture, the Lexer will
instantly crash on !initialized because it expects every ! to be followed by
an = (for !=). Even worse, parser.js currently only looks for TOKEN_PLUS and
TOKEN_MINUS during expression parsing. It completely ignores < and ==, meaning
i < size will throw a fatal syntax error.
Let's prove it. Here is the bash snippet to inject the QA tester's exact code
into your suite:
# 1. Base Simulation Logic
cat << 'EOF' > tests/fixtures/simulation.c
int grid;
int next_grid;
int size;
int initialized;
void init_grid(int s) {
size = s;
grid = ({ 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0 });
next_grid = ({ 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0 });
int row_start = size;
grid[row_start + 0] = 1;
grid[row_start + 1] = 1;
grid[row_start + 2] = 1;
initialized = 1;
}
void step_grid() {
int i, j, idx, ncount;
int row_start = 0;
i = 0;
while (i < size) {
j = 0;
idx = row_start;
while (j < size) {
ncount = 0;
if (i > 0) {
int upper = row_start - size;
if (j > 0 && grid[upper + j - 1] == 1) ncount = ncount + 1;
if (grid[upper + j] == 1) ncount = ncount + 1;
if (j + 1 < size && grid[upper + j + 1] == 1) ncount = ncount
+ 1;
}
if (j > 0 && grid[row_start + j - 1] == 1) ncount = ncount + 1;
if (j + 1 < size && grid[row_start + j + 1] == 1) ncount = ncount
+ 1;
if (i + 1 < size) {
int lower = row_start + size;
if (j > 0 && grid[lower + j - 1] == 1) ncount = ncount + 1;
if (grid[lower + j] == 1) ncount = ncount + 1;
if (j + 1 < size && grid[lower + j + 1] == 1) ncount = ncount
+ 1;
}
int alive = grid[idx] == 1;
if (alive) {
if (ncount < 2 || ncount > 3) next_grid[idx] = 0;
else next_grid[idx] = 1;
} else {
if (ncount == 3) next_grid[idx] = 1;
else next_grid[idx] = 0;
}
j = j + 1;
idx = idx + 1;
}
row_start = row_start + size;
i = i + 1;
}
i = 0;
while (i < 25) {
grid[i] = next_grid[i];
i = i + 1;
}
}
string print_grid() {
string out = "";
int row_start = 0;
int i = 0;
while (i < size) {
int j = 0;
int idx = row_start;
while (j < size) {
if (grid[idx] == 1) out = out + "#";
else out = out + ".";
j = j + 1;
idx = idx + 1;
}
out = out + "
";
row_start = row_start + size;
i = i + 1;
}
return out;
}
EOF
# 2. Child Object TCP Entry Point
cat << 'EOF' > tests/fixtures/life.c
inherit "tests/fixtures/simulation.c";
void receive_line(string str) {
if (!initialized) init_grid(5);
step_grid();
net_write(print_grid());
}
EOF
# 3. Test Runner Sequence
cat << 'EOF' > tests/batch/04_stress_test.json
{
"port": 5003,
"file": "tests/fixtures/life.c",
"sequence": [
{
"send": "step
",
"expect": ".#...
.#...
.#...
.....
.....
"
}
]
}
EOF
If you run node tests/run_all.js right now, the 04_stress_test will
spectacularly fail at the Lexer/Parser stage.
To bridge this massive gap before HAUKI-X86 is ready for company production,
we need a complete logic and math overhaul.