@plurnk/plurnk-grammar 0.34.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/plurnk-closed.gbnf +0 -6
- package/dist/plurnk-free.gbnf +832 -0
- package/dist/plurnk-strict.gbnf +0 -43
- package/dist/plurnk.gbnf +7 -45
- package/dist/schema/PlurnkStatement.json +2 -2
- package/dist/src/AstBuilder.d.ts.map +1 -1
- package/dist/src/AstBuilder.js +4 -2
- package/dist/src/AstBuilder.js.map +1 -1
- package/dist/src/types.generated.d.ts +1 -1
- package/dist/src/types.generated.d.ts.map +1 -1
- package/package.json +3 -2
- package/plurnk.md +4 -0
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Exit `0` on clean parse, `1` on any error or unparsed tail.
|
|
|
50
50
|
| FIND | tag filter | matcher | result-set range |
|
|
51
51
|
| READ | tag filter | matcher | per-entry lines |
|
|
52
52
|
| EDIT | tags | content (empty=clear) | entry lines |
|
|
53
|
-
| COPY | tags-to-apply | destination URI
|
|
53
|
+
| COPY | tags-to-apply | destination URI / fork prompt | entry lines |
|
|
54
54
|
| MOVE | tags-to-apply | destination URI | entry lines |
|
|
55
55
|
| OPEN | tag filter | matcher | result-set range |
|
|
56
56
|
| FOLD | tag filter | matcher | result-set range |
|
|
@@ -194,10 +194,11 @@ Errors are JSON-serializable. Shape: `{ line, column, source, message }` where `
|
|
|
194
194
|
|
|
195
195
|
## gbnf
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
Four generated [GBNF](https://github.com/ggml-org/llama.cpp/blob/master/grammars/README.md) grammars ship in the package for llama.cpp constrained sampling. All dictate the canonical statement form (digit suffixes, comma line markers, three-digit SEND signals); operations are fully enforced everywhere.
|
|
198
198
|
|
|
199
|
-
- **`plurnk.gbnf` (default
|
|
200
|
-
- **`plurnk-
|
|
199
|
+
- **`plurnk.gbnf` (default)** — free reasoning text and statements interleave, EOS at any boundary, **but `<<` is a hard commit**: prose may contain a lone `<` and never `<<`, so the only way to produce `<<` is to begin a real operation. Operation-lookalike garbage (`<<RANDOM`) can't exist even as text — at `<<` the sampler is forced into a valid op. Leanest text automaton (2 states). Tradeoff: a fumbled verb is coerced toward a real op, and `<<` is unwritable in prose.
|
|
200
|
+
- **`plurnk-free.gbnf`** — free text and statements interleave with `<<` escapable to text: an opener-lookalike that never completes a real keyword stays inert text. The permissive fallback if the hard commit bites.
|
|
201
|
+
- **`plurnk-closed.gbnf`** — free-style text, but the turn must close with a final pathless `SEND[102]`/`SEND[200]` (forced EOS). For models that ramble past optional stopping points.
|
|
201
202
|
- **`plurnk-strict.gbnf`** — ops only, bounded newline separators. The tightest rail, for models that don't reason.
|
|
202
203
|
|
|
203
204
|
The parser remains the permissive contract — everything any of the three can generate, the parser accepts (interstatement text surfaces as `kind: "text"` items).
|
package/dist/plurnk-closed.gbnf
CHANGED
|
@@ -769,8 +769,6 @@ plan-9-b3 ::= ("A" plan-9-b4 | ":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F
|
|
|
769
769
|
plan-9-b4 ::= ("N" plan-9-b5 | ":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:N] plan-9-b0)?
|
|
770
770
|
plan-9-b5 ::= (":" plan-9-b1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7F:9] plan-9-b0)?
|
|
771
771
|
plan-9 ::= "<<PLAN9" ":" plan-9-b0 ":PLAN9"
|
|
772
|
-
root-open ::= text open-step*
|
|
773
|
-
open-step ::= statement text-after?
|
|
774
772
|
root-closed ::= text closed-step* send-final-any "\n"?
|
|
775
773
|
closed-step ::= mid-statement text-after?
|
|
776
774
|
text-after ::= "\n" text
|
|
@@ -810,14 +808,10 @@ text-s32 ::= ("A" text-s33 | "<" text-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7FA<]
|
|
|
810
808
|
text-s33 ::= ("<" text-s1 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7FN<] text-s0)?
|
|
811
809
|
text-s34 ::= "F" text-s3 | "R" text-s6 | "E" text-s9 | "C" text-s12 | "M" text-s15 | "O" text-s18 | "S" text-s23 | "K" text-s28 | "P" text-s31 | "<" text-s2 | [^\x00-\x08\x0B-\x0C\x0E-\x1F\x7FFRECMOSKP<] text-s0
|
|
812
810
|
text ::= text-s0
|
|
813
|
-
root-strict ::= "\n"? batch-step* send-final-any "\n"?
|
|
814
|
-
batch-step ::= mid-statement "\n" "\n"?
|
|
815
811
|
mid-statement ::= op-statement | send-mid-any
|
|
816
812
|
op-statement ::= find | find-1 | find-2 | find-3 | find-4 | find-5 | find-6 | find-7 | find-8 | find-9 | read | read-1 | read-2 | read-3 | read-4 | read-5 | read-6 | read-7 | read-8 | read-9 | edit | edit-1 | edit-2 | edit-3 | edit-4 | edit-5 | edit-6 | edit-7 | edit-8 | edit-9 | copy | copy-1 | copy-2 | copy-3 | copy-4 | copy-5 | copy-6 | copy-7 | copy-8 | copy-9 | move | move-1 | move-2 | move-3 | move-4 | move-5 | move-6 | move-7 | move-8 | move-9 | open | open-1 | open-2 | open-3 | open-4 | open-5 | open-6 | open-7 | open-8 | open-9 | fold | fold-1 | fold-2 | fold-3 | fold-4 | fold-5 | fold-6 | fold-7 | fold-8 | fold-9 | exec | exec-1 | exec-2 | exec-3 | exec-4 | exec-5 | exec-6 | exec-7 | exec-8 | exec-9 | kill | kill-1 | kill-2 | kill-3 | kill-4 | kill-5 | kill-6 | kill-7 | kill-8 | kill-9 | plan | plan-1 | plan-2 | plan-3 | plan-4 | plan-5 | plan-6 | plan-7 | plan-8 | plan-9
|
|
817
813
|
send-mid-any ::= send-mid | send-1-mid | send-2-mid | send-3-mid | send-4-mid | send-5-mid | send-6-mid | send-7-mid | send-8-mid | send-9-mid
|
|
818
814
|
send-final-any ::= send-final | send-1-final | send-2-final | send-3-final | send-4-final | send-5-final | send-6-final | send-7-final | send-8-final | send-9-final
|
|
819
|
-
send-statement ::= send-mid-any | send-final-any
|
|
820
|
-
statement ::= op-statement | send-statement
|
|
821
815
|
status-final ::= "102" | "200"
|
|
822
816
|
status-mid ::= "10" [0-13-9] | "1" [1-9] [0-9] | "20" [1-9] | "2" [1-9] [0-9] | [03-9] [0-9] [0-9]
|
|
823
817
|
tags ::= "[" tag tag-rest* "]"
|