Here are the slides of my presentation at SLE 2015, in which I explain that current parsers fail at a variety of tasks, and how to make parsers extensible so that users may overcome these hurdles by writing custom extensions.
that happened in branches discarded through backtracking? • Identifying and rolling back state changes • Things that are both inputs and outputs (position, indentation level)
• Roughly, committed = input & uncommitted = output • When invoking an expression: no uncommitted state • When returning from an expression: committed state the same as when invoked.
p, and a map M: (node, position) —> output. 1. M[R,p] = failure 2. Parse the expression, when encountering left- recursion, return M[R,p]. 3. If more input was consumed than in M[R,p], overwrite M[R,p] and go to (2). Else, finish.
output • In reality: a node —> output map tied to the current input position • commit(): discards the map when advancing the input position • snapshot(), uncommit(), restore(): restore the old map