@plurnk/plurnk-grammar 0.30.0 → 0.32.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 +13 -6
- package/dist/plurnk-closed.gbnf +837 -0
- package/dist/plurnk-strict.gbnf +6 -3
- package/dist/plurnk.gbnf +7 -4
- package/dist/schema/LineMarker.json +3 -3
- package/dist/src/AstBuilder.d.ts.map +1 -1
- package/dist/src/AstBuilder.js +7 -2
- package/dist/src/AstBuilder.js.map +1 -1
- package/dist/src/generated/plurnkLexer.d.ts.map +1 -1
- package/dist/src/generated/plurnkLexer.js +155 -148
- package/dist/src/generated/plurnkLexer.js.map +1 -1
- package/package.json +3 -2
- package/plurnk.md +8 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Exit `0` on clean parse, `1` on any error or unparsed tail.
|
|
|
42
42
|
| `suffix` | `[A-Za-z0-9_]*` glued to `OP`; used for nesting |
|
|
43
43
|
| `[…]` | optional CSV; per-OP semantics |
|
|
44
44
|
| `(…)` | optional URI |
|
|
45
|
-
| `<L>` | optional `<N>` or `<N-M>`; N, M ∈ signed
|
|
45
|
+
| `<L>` | optional `<N>` or `<N-M>`; N, M ∈ signed numbers — decimals mean insert-between (lines) or score threshold (results) |
|
|
46
46
|
| `:body:` | optional; opaque between fences |
|
|
47
47
|
|
|
48
48
|
| OP | signal | body | line marker |
|
|
@@ -176,7 +176,13 @@ Nesting: outer body may contain inner `<<OP:…:OP` statements; outer must use a
|
|
|
176
176
|
33. Think aloud — reasoning recorded to the log
|
|
177
177
|
<<PLAN:Need the capital fact; discover via wiki, record to known, deliver.:PLAN
|
|
178
178
|
|
|
179
|
-
34.
|
|
179
|
+
34. Insert a line between lines 2 and 3 (decimal = between; replaces nothing)
|
|
180
|
+
<<EDIT(known://plan)<2.5>:- [ ] Verify against a second source:EDIT
|
|
181
|
+
|
|
182
|
+
35. Semantic search with a similarity threshold (decimal = minimum score)
|
|
183
|
+
<<FIND(known://**)<0.7>:~territorial concessions:FIND
|
|
184
|
+
|
|
185
|
+
36. Quote a plurnk operation inside another (nesting via suffix discipline)
|
|
180
186
|
<<EDITouter(known://demo):
|
|
181
187
|
The following is a quoted plurnk operation, preserved verbatim:
|
|
182
188
|
<<EDIT(known://inner):hello world:EDIT
|
|
@@ -188,12 +194,13 @@ Errors are JSON-serializable. Shape: `{ line, column, source, message }` where `
|
|
|
188
194
|
|
|
189
195
|
## gbnf
|
|
190
196
|
|
|
191
|
-
|
|
197
|
+
Three generated [GBNF](https://github.com/ggml-org/llama.cpp/blob/master/grammars/README.md) grammars ship in the package for llama.cpp constrained sampling, most→least permissive. All dictate the canonical statement form (digit suffixes, comma line markers, three-digit SEND signals); free text can never contain a complete `<<OP` opener — emitting one commits the sampler into statement mode, so operations stay fully enforced everywhere.
|
|
192
198
|
|
|
193
|
-
- **`plurnk.gbnf` (default,
|
|
194
|
-
- **`plurnk-
|
|
199
|
+
- **`plurnk.gbnf` (default, open)** — free reasoning text and statements interleave; EOS is admissible at any boundary, so termination is the model's own choice. The grammar filter sits below the reasoning/content split on llama.cpp; the open root lets reasoning-tuned models think — including reasoning *about* concluding without being forced to conclude.
|
|
200
|
+
- **`plurnk-closed.gbnf`** — text allowed, but the turn must close with a final pathless `SEND[102]`/`SEND[200]` status update, after which nothing is admissible (forced EOS). For models that ramble past optional stopping points.
|
|
201
|
+
- **`plurnk-strict.gbnf`** — ops only, bounded newline separators. The tightest rail, for models that don't reason.
|
|
195
202
|
|
|
196
|
-
The parser remains the permissive contract — everything
|
|
203
|
+
The parser remains the permissive contract — everything any of the three can generate, the parser accepts (interstatement text surfaces as `kind: "text"` items).
|
|
197
204
|
|
|
198
205
|
```ts
|
|
199
206
|
import.meta.resolve("@plurnk/plurnk-grammar/plurnk.gbnf")
|