mipsy
mipsy copied to clipboard
print with array syntax
currently there is no support for printing arrays, other than getting the address of the array and printing the specific addresses manually.
adding a print label[offset]
format would be nice if we can determine the size of the data stored at the label (should be easily achievable with .byte/word/etc)
a loftier but more ergonomic goal would be including the ability to detect and print an entire 'array' all at once, but this gets very complex very quickly.
I believe that (@insou22 can confirm) that once we get to runtime we have already lost .byte/.half/.word and only have the raw memory. Witch makes even the first option difficult.
But extending this idea to array slices would be nice.
print label[start:stop]
Yeah I had a suspicion that might be the case, but we might be able to modify the compiler to include this information in compile time as additional data associated with the label. Doing it nicely could take some effort though
Including additional data with labels is probably required anyway to fix #100
we can parameterize the runtime by the lifetime of the binary if we want to borrow stuff from there -- might pose some potential challenges for mipsy_interactive / mipsy_web though, since iirc they may store the runtime and binary alongside in the same struct. could pull in stable_deref to fix something like that possibly