provide forensic examination and critique of the language spec sections detailed below prior to publication for the books:
Below are six self-contained draft artefacts, each living in its own “isolation folder.”
Once you confirm or amend them we can merge the final versions into U-NLRS v0.3.
📁 A1 — Lexer & Escape Rules Addendum (draft 1)
# Lexer & Escape Rules (A1)
## 1 Longest-Match Principle
The lexer MUST pick the longest possible sequence of characters that
constitutes a valid token before continuing.
Example
text >=10
is tokenised as `ID "text"`, `OPERATOR ">="`, `NUMBER "10"`
—not `">"` + `"="`.
## 2 Escape Sequences for STRING
Syntax `\"` `\\` `\n` `\t`
• Strings are UTF-8 after escape decoding.
• Illegal escapes raise **E06** (see A4).
## 3 Embedded Quotes
STRING ::= '"' ( ESC | [^"\n] )* '"'
ESC ::= '' ["\ntr]
## 4 Comment Ambiguity Resolution
`##` starts a comment **only** when it is the first non-space character
on the line.
## 5 Bidi-Safe Tokenisation
Lexer MUST apply Unicode BiDi algorithm **after** escape decoding but
**before** token classification.
📁 A2 — Runtime Semantics (WAIT + External Calls) (draft 1)
# Runtime Semantics Addendum (A2)
## 1 WAIT
Syntax `- WAIT <duration>`
Duration • ISO-8601 (`PT30S`, `PT2M`) • Plain seconds (`30s`)
Semantics • Workflow clock pauses; no tokens are billed.
• LLM may sleep or yield control.
## 2 STEP Concurrency
Process engine executes list **in order** unless `PARALLEL` is used
(non-normative extension planned for v0.4).
## 3 EvaluateDecision
Atomic; MUST return value (string/number/boolean) synchronously.
## 4 External Calls
Any verb phrase that starts with `Call` MUST:
a. declare required RESOURCES entry,
b. return within PARAMS.timeout (default 30 s).
Failure ⇒ **E07 ExternalCallTimeout**.
📁 A3 — JSON Schema (Level L3 Minimal) (draft 0.8)
File: unlrs.schema.json
{
"$schema": "http://json-schema.org/draft/2020-12/schema",
"$id": "https://unlrs.org/schemas/unlrs.schema.json",
"title": "U-NLRS Document",
"type": "object",
"required": ["OBJECTIVE", "CONTEXT", "PROCESS"],
"properties": {
"OBJECTIVE": {
"type": "object",
"required": ["text"],
"properties": {
"text": { "type": "string" },
"PRE": { "type": "string" },
"SUCCESS": { "type": "string" }
},
"additionalProperties": false
},
"CONTEXT": { "type": "string" },
"RESOURCES": {
"type": "array",
"items": { "type": "string" }
},
"PARAMS": {
"type": "object",
"additionalProperties": { "type": ["string","number","boolean"] }
},
"PROCESS": {
"type": "array",
"items": { "type": "string" }
},
"DECISIONS": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": { "type": "string" }
}
},
"REFLECTION": { "type": "array", "items": { "type": "string" } },
"OUTPUT": { "type": "string" }
},
"additionalProperties": false
}
Minimal pass; will expand with regex patterns and tag validation after review.
📁 A4 — Extended Error Catalogue (draft 1)
| Code | Message | Severity |
|---|
| E04 | Macro recursion guard exceeded | fatal |
| E05 | Unknown MACRO referenced | fatal |
| E06 | Illegal string escape sequence | fatal |
| E07 | External call timed-out | fatal |
| W12 | Inline-IF exceeds 120 chars | warning |
📁 A5 — Pocket Spec + Translation Ref + Extra Examples (draft 0.9)
A5-1 Pocket Spec (≤ 2 pp)
OBJ (goal) – one sentence
CTX (context)– free text
PRE / SUCCESS– optional sub-keys under OBJ
RES – list of tools or data
PAR – k=v settings (temp, style …)
PRC – ordered steps; allow simple IF
DEC – tables: IF … -> result
OUT – describe or link schema
A5-2 Translation Reference v0.3
• Mirrors Tag Dictionary from spec
• Adds escaped string examples
• Ships as translation_map.csv
A5-3 Two Extra Worked Examples
- Multilingual FAQ Builder (Arabic interface)
- Research-Paper Summariser (Hindi context)
(full text in separate file examples/)
📁 A6 — Versioning & Deprecation Policy (draft 1)
# Versioning & Deprecation (A6)
## 1 Semantic Versioning
MAJOR.MINOR.PATCH
• MAJOR – backwards-incompatible grammar change
• MINOR – backwards-compatible feature (e.g., new tag)
• PATCH – editorial / error-code additions only
## 2 Deprecation Window
• Feature announced in MINOR release N.
• Remains “deprecated” for ≥2 subsequent MINOR versions.
• Tooling MAY warn; MUST still accept until removal.
## 3 Removal
Occurs only in next MAJOR release.
## 4 Document Header
Each spec MUST contain
Version: 0.3.0
Next Step
- Review each artefact above.
- Mark items accept / revise.
- After approval we will fold the final texts into the v0.3 master spec and bump to 0.3.1-RC1.