3 ms·
I was unclear I'm afraid, I was elaborating on your comment about lisp allocating madly, so lisp and not programs in general. Moving to a stack costs, in that
by throwaway_pdp09 6y ago
I was unclear I'm afraid, I was elaborating on your comment about lisp allocating madly, so lisp and not programs in general.
Moving to a stack costs, in that you can't do some things, per my original comment. You gain efficiency for what you can do though.
> used a stack to parse expressions and generate machine code for them
Prob this https://html.duckduckgo.com/html?q=dijkstra%20shunting%20yard%20algorithm https://html.duckduckgo.com/html?q=dijkstra%20shunting%20yar... which I thought came from dijkstra but your digging suggests not, didn't know! (edit: it did https://en.wikipedia.org/wiki/Shunting-yard_algorithm https://en.wikipedia.org/wiki/Shunting-yard_algorithm) infix -> rpn which matches a stack very well (can evaluate as an interpreter, or emit code as a compiler. Not very efficient but it works).
Edit: much credit for digging and reading before posting, wish I could give you several upvotes for that.