Fix a bunch of warnings from -Wall and -Wextra

I also added another error code for the case where someone tries to do a
lookup of a negative int as an array index.

We might want to actually support that in the future though.