pe icon indicating copy to clipboard operation
pe copied to clipboard

lazy value stack

Open goodmami opened this issue 5 years ago • 1 comments

Values are now computed as soon as an expression succeeds, even if that value will later be discarded. Since a parse is inherently a tree, a stack should be able to compute the full derivation. Thus we could have a value stack with (start, end, function) triples. This means that a new tuple is created for each expression that emits values, but that is already the case as the emitted values args is an immutable tuple and not a list. The difference then is that the function is not computed until it is needed. Since there are now callables for Capture and Bind, all features can be represented this way (although in some tests, Capture and Bind were a bit slower than the ~ and : operators).

goodmami avatar May 14 '20 02:05 goodmami

Adding to this: a flat stack needs both start and end markers to recreate "branches" so it knows how many arguments go with an action.

goodmami avatar May 22 '20 06:05 goodmami