diff options
| author | Mattias Andrée <m@maandree.se> | 2026-01-05 14:35:26 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-02-23 07:53:08 +0100 |
| commit | 208594ca9f95a87f60ff052490a4d5824dc23801 (patch) | |
| tree | 915a17b51f62b289ba4115214a057610416d755e /libparser.7 | |
| parent | Add committed-operator (diff) | |
| download | libparser-208594ca9f95a87f60ff052490a4d5824dc23801.tar.gz libparser-208594ca9f95a87f60ff052490a4d5824dc23801.tar.bz2 libparser-208594ca9f95a87f60ff052490a4d5824dc23801.tar.xz | |
Make deterministic the default
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libparser.7')
| -rw-r--r-- | libparser.7 | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/libparser.7 b/libparser.7 index 2d921a7..c50b5c9 100644 --- a/libparser.7 +++ b/libparser.7 @@ -88,12 +88,14 @@ integer = _decimal | _hexadecimal; (* May not exceed 255. *) _low = character | integer; _high = character | integer; +nondeterministic = \(dq?\(dq; + committed = \(dq+\(dq, _, _operand; rejection = \(dq!\(dq, _, _operand; concatenation = _operand, {_, \(dq,\(dq, _, _operand}; -alternation = concatenation, {_, \(dq|\(dq, _, concatenation}; -optional = \(dq[\(dq, _, _expression, _, \(dq]\(dq; -repeated = \(dq{\(dq, _, _expression, _, \(dq}\(dq; +alternation = concatenation, {_, [nondeterministic], \(dq|\(dq, _, concatenation}; +optional = [nondeterministic], \(dq[\(dq, _, _expression, _, \(dq]\(dq; +repeated = [nondeterministic], \(dq{\(dq, _, _expression, _, \(dq}\(dq; group = \(dq(\(dq, _, _expression, _, \(dq)\(dq; char-range = \(dq<\(dq, _, _low, _, \(dq,\(dq, _, _high, \(dq_\(dq, \(dq>\(dq; exception = \(dq-\(dq; @@ -132,18 +134,18 @@ Optional symbols are taken whenever possible. Concatenation has higher precedence than alternation, groups .RB (\(dq ( "\(dq, ..., \(dq" ) \(dq) -have no semantic meaning and are useful only to put a -alternation inside a concatenation without creating a -new rule for that. +have no semantic meaning and are useful only for including +alternations inside concatenations or put alternations +or concatenations inside a commitment or rejection. .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. +The parser has the ability to be 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 |
