June 2019, rev. March 2020
I want the programming language to be able to create at runtime a locally scoped stack whose total size is unknown. I want to push on the stack an unknown number of items and free all of this space when I'm done.
The reason I want this ability is to parse an unknown number of items in a Lisp expression without calling malloc. eg
Languages support to some degree locally scoped stacks whose total size is unknown. They calculate the total size at runtime instead of compile time, and in one shot before the stack is allocated. For example C can allocate in a local scope an array whose size is a variable that is set at runtime.
I want something different: to calculate and allocate the stack at runtime, but to do both incrementally, not in one shot. Because the total stack size could be unknown and therefore impossible to calculate and allocate in one shot. eg
The reason I want the stack to be locally scoped is that this abstraction may be at odds with loops. To find how much space to allocate, the code will probably need to run in a loop. But unlike an ordinary loop that frees its stack space at the end of each iteration, I want this loop to not free its stack during each iteration, and to also not free it when the whole loop is done. I want freeing to happen in a separate step, when a local scope ends.
What I think I want is to call an assembly