This was only tested with gcc on Arch (WSL)
- Cell wrapping. A negative cell index or cell index > U_SMALL will throw an exception
- Accomodate for mismatched parenthesis. Mismatched parenthesis will throw an exception
- Each cell is an unsigned char per this spec
- The maximum codesize and number of cells total is 65535, macro'd to U_SMALL. This is to make a reasonably sized
cells
andcode
arrays, since this implementation does not want do deal with actual pointers pointing to actual memory. - The interpreter lazily deals with new cells being defaulted to zero. This hasn't broken yet, but I usually don't trust what I write.
I compile with gcc gcc -o bf main.c
, and use it on some file with valid code ./bf test.bf
, or send code in stdin echo "++[>++<-]." | ./bf
. Errors will be detailed at interpret time if they are present (sorry adox, I disagree with you here)
unmatched evaluated ]
unmatched evaluated [
cell pointer out of bounds (0 to 65535)