cmsc430 / cmsc430.github.io

CMSC 430 Design and Implementation of Programming Languages
https://cmsc430.github.io/
45 stars 33 forks source link

`read_byte` should wrap an unsigned char #144

Open dvanhorn opened 1 year ago

dvanhorn commented 1 year ago

Currently read_byte returns val_wrap_int(c) where c is the char that was read, but this will encode the byte as a signed integer, whereas a byte should be in (0,256]. The fix is to add a new function to the run-time:

val_t val_wrap_byte(unsigned char b)

and have read_byte return val_wrap_byte(c). The definition is the same as val_wrap_int.