rust-hosted-langs / book

Writing Interpreters in Rust: a Guide
https://rust-hosted-langs.github.io/book/
Creative Commons Attribution 4.0 International
479 stars 27 forks source link

Support for range-limited integer arithmetic #22

Open pliniker opened 4 years ago

pliniker commented 4 years ago

The TaggedPtr type allows for size_of::<isize>() * 8 - 2 bits of integer to be stored in a pointer.

Support for numbers needs to be implemented:

  1. in the parser
  2. in the compiler (+, -, integer div, *) opcodes
  3. in the VM

This initial implementation should return RuntimeError for values and results that fall outside of the supported TaggedPtr range.

A short chapter of the book might be written to describe this.

Consider splitting this issue into multiple issues to break it up, perhaps an issue for each area of the code and one for documentation.