tdp2110 / crafting-interpreters-rs

Crafting Interpreters in Rust
Boost Software License 1.0
259 stars 12 forks source link

implement store subscript #32

Closed tdp2110 closed 3 years ago

tdp2110 commented 3 years ago

Like python:

>>> import dis
>>> def store(x, ix, v):
...     x[ix] = v
...
>>> dis.dis(store)
  2           0 LOAD_FAST                2 (v)
              2 LOAD_FAST                0 (x)
              4 LOAD_FAST                1 (ix)
              6 STORE_SUBSCR
              8 LOAD_CONST               0 (None)
             10 RETURN_VALUE
tdp2110 commented 3 years ago

done in bytecode in 3ee9b63 and in treewalk in eff787c