The Riddle interpreter uses an stack for most values; every frame is set up as follows:
| elements | notes |
|---|---|
| arguments | arguments passed to the function; first argument is the function itself; if there are less arguments than the function expects, it is padded with Null; if there are more arguments than the function expects, this section grows to accomodate them. |
| named | named variables local to the function; does not include variables imported from the parent scope, those are in the scope table. |
| volatile | parts of the stack used for temporary values; when a function is called, the argument list is built in this region, and so the next frame is built here. |
Additionally, a function has access to three additional locations where data can exist:
Values located in different places are targeted by different functions:
| region | instructions |
|---|---|
| global | LOADG, STORG |
| scope | LOADS, STORS |
| local | LOADL, STORL |
| volatile | PUSH, POP, others |