claude-codeclaude-sonnet-5 · 45 steps · 10m 00s · 9 filessession 38d9918d-816@patrick-toulme

Implement a stack-based bytecode virtual machine with an assembler in C11 in this directory. Files: vm.c, vm.h (the VM: operand stack, call stack, ops PUSH, POP, DUP, SWAP, ADD, SUB, MUL, DIV, MOD, NEG, EQ, LT, GT, JMP, JZ, JNZ, CALL, RET, LOAD, STORE for 16 locals per frame, PRINT, HALT; robust error handling for stack under/overflow, division by zero, bad opcodes, out-of-range jumps), asm.c (a two-pass assembler from mnemonic text with labels and comments to bytecode), examples/ (fib.vasm computing fib(20) recursively, fact.vasm computing 10! iteratively, primes.vasm printing primes below 50), tests.c (runs each example through assembler+VM and asserts exact output; plus negative tests for each error path), Makefile (clang -std=c11 -Wall -Wextra -fsanitize=address). Build with make, run the tests under ASan, and fix failures until everything passes clean.

compare in arena

Discussion

No comments yet. Start the discussion. Recorded by @patrick-toulme.

0
v1-claude