Determinism and Error Reporting
How CNL-PL guarantees a single parse and how errors are explained without guessing.
Why determinism matters
CNL-PL is built around a strict promise: every valid sentence produces exactly one AST. If multiple parses are possible, the input is rejected. This avoids subtle differences between implementations and prevents hidden semantics from sneaking into the runtime.
Determinism is not just a parsing detail. It makes compilation reproducible, reasoning explainable, and evaluation suites reliable. The same input always produces the same KB updates and plan structures.
Determinism rules in practice
The syntax rules below are enforced at parse time. If a rule is violated, the parser emits a structured error instead of guessing.
Boolean grouping
There is no implicit precedence between AND and OR. Grouping must be explicit.
Valid:
Either the user is active or the user is an admin.
Both the user is active and the user is an admin.
(the user is active and the user is an admin) or the user is suspended.
Invalid:
The user is active or the user is an admin and the user is suspended.
Noun phrase vs name
Noun phrases must start with determiners or quantifiers. A bare word is a Name. This avoids ambiguity between proper names and general categories.
Valid:
A driver is assigned to a route.
Truck_A is assigned to Route_9.
Invalid:
Driver is assigned to a route.
Disambiguating "has"
The word "has" is possessive only when followed by a determiner. Otherwise it is treated as an auxiliary.
Possessive:
Truck_A has a capacity of 1000.
Auxiliary:
The user has logged in today.
Relative clauses
Each clause must repeat the pronoun to avoid ambiguous chains.
Valid:
A user who is active and who knows python.
Invalid:
A user who is active and knows python.
Error reporting
Errors are explicit and source-aligned. Each error includes a code, a message, and the exact span that triggered it. The system does not attempt recovery or fuzzy fixes.
- MixedBooleanOperatorsError: AND and OR appear at the same level without grouping.
- InvalidNounPhraseStartError: a noun phrase did not start with a determiner or quantifier.
- HasFormDeterminismError: "has" used in a position that is ambiguous by rule.
- RelativePronounRepetitionError: relative chains missing pronoun repetition.
These codes are defined in DS07 and must be stable. Tooling can use them to provide targeted suggestions without changing the language rules.