A parse stack is used in a SymbolParser to hold references to ContinuationParseStateTransformer
functions, along with their Continuation and ParseState object, which are supposed to be passed to them
so that they do not need to be called immediately. Instead, their execution can be deferred for later execution, if needed.
When a ContinuationParseStateTransformer needs to be dispatched, it is instead pushed to the ParseStack
with the Continuation and ParseStack that was to be passed to it.
Then, when new parse results are requested, those state transformers are popped from the parse stack to be executed
The stack nature of the parser storage implies that DFS is implemented in the grammar space. If this parser storage
were to be implemented with a queue, then BFS would be implemented but that would lead severe perfornamce losses
on the general cases.
The type of a parse stack
A parse stack is used in a SymbolParser to hold references to ContinuationParseStateTransformer functions, along with their Continuation and ParseState object, which are supposed to be passed to them so that they do not need to be called immediately. Instead, their execution can be deferred for later execution, if needed.
When a ContinuationParseStateTransformer needs to be dispatched, it is instead pushed to the ParseStack with the Continuation and ParseStack that was to be passed to it. Then, when new parse results are requested, those state transformers are popped from the parse stack to be executed
The stack nature of the parser storage implies that DFS is implemented in the grammar space. If this parser storage were to be implemented with a queue, then BFS would be implemented but that would lead severe perfornamce losses on the general cases.
See