diff options
Diffstat (limited to '')
| -rw-r--r-- | libparser.7 | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libparser.7 b/libparser.7 index 7157769..2d921a7 100644 --- a/libparser.7 +++ b/libparser.7 @@ -88,6 +88,7 @@ integer = _decimal | _hexadecimal; (* May not exceed 255. *) _low = character | integer; _high = character | integer; +committed = \(dq+\(dq, _, _operand; rejection = \(dq!\(dq, _, _operand; concatenation = _operand, {_, \(dq,\(dq, _, _operand}; alternation = concatenation, {_, \(dq|\(dq, _, concatenation}; @@ -100,7 +101,7 @@ embedded-rule = identifier; _literal = char-range | exception | string; _group = optional | repeated | group | embedded-rule; -_operand = _group | _literal | rejection; +_operand = _group | _literal | rejection | committed; _expression = alternation; @@ -135,6 +136,15 @@ have no semantic meaning and are useful only to put a alternation inside a concatenation without creating a new rule for that. .PP +The parser is non-deterministic, which can make it really +slow. The speed up parsing, you can add commits. Once the +committed sentence has been matched, the branching-points +inside it are unrecorded, so when the parser backtracks, +it will not try different choices inside the committed +sentence. Commit sentences are undone by the parser when +it backtracks to a branching-point outside the committed +sentence. +.PP In character ranges, the .B _high and @@ -150,12 +160,14 @@ the rules will appear in the tree-formatted result. .PP Left recursion is illegal (it will cause stack overflow at runtime as the empty condition before the -recursion is always met). +recursion is always met). Likewise, repeated optional +sentences are illegal; a repeated sentence must always +consume input, otherwise it gets stuck. .SS Right-context-sensitive grammar libparser originally used context-free grammar, but with introduction of the rejection rule, specifically the ability -to reject a rejection, it became a phrase for +to reject a rejection, it became a parser for right-context-sensitive grammar which is a grammar that is that can generate any context-sensitive language, it is however weakly equivalent to context-sensitive grammar. |
