aboutsummaryrefslogtreecommitdiffstats
path: root/csc/list.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-07-22 12:02:25 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-07-22 12:02:25 -0700
commit555519b85ded4a8fefd9c217e6acfb529ac67432 (patch)
tree1b030258c276b15427cb3a214b484eaa7d8f9eb5 /csc/list.csc
parentSlightly clean up the indentation in hash-map. (diff)
downloadchromatopelma-555519b85ded4a8fefd9c217e6acfb529ac67432.tar.zst
Handle global variables.
Global variables will be stored in an array which is kept in register 0. The linker will later translate each library-ref into an integer, which is used as an index into the globals table. This design makes implementing eval quite straightforward, the eval bytecode will accept a globals table and a bytevector of bytecode, save the current set of registers, set register 0 to the new globals table, and begin executing the given bytecode. When eval is finished, it will restore the saved registers and return to the previous instruction pointer. In this way, calling eval can create a call stack. We could think about implementing function calls with eval, and it's cool that it would work, but the CPS transformation mostly makes this irrelevant. It's interesting to think about implementing an interpreter, where a function call would simply eval the function's bytecode, and the function call stack would be handled automatically.
Diffstat (limited to 'csc/list.csc')
0 files changed, 0 insertions, 0 deletions