nickoncrack/c-subset ? reverse-engineered prompt
Reverse engineered prompt
Build me a small compiler in C for a subset of the C language that turns source files into casm machine code.
I already have the basic project structure and some parsing work done, but I want it finished into something I can actually use on the sample test file and similar small programs. Please make sure it can handle variables, functions, arrays, structs, control flow like if, else, while, for, break, continue, unary and binary operators, casts, sizeof, and the other common bits already hinted at in the project. If there are missing pieces around errors, symbols, scopes, type checking, or code generation, please add those too in a clean way.
Keep the command line usage simple, so I can build it with gcc and run it against a .c file from the tests folder. If you need to check anything about the casm output format or compiler behavior, look up current docs online if needed and keep the output aligned with the existing sample output.
Are you gonna build this?
make sure you review the code using coderabbit