Expand description
elenchus-parser — parses the English-like elenchus DSL into an AST.
Style mirrors vsm-parser: zero-copy over &str, nom + nom_locate
for line/column tracking, and a human-friendly ^--- here error display.
Syntax is line/keyword-oriented (not S-expressions) so small models cannot
trip on parentheses or indentation.
Grammar (see docs/SPEC.md, “Grammar (EBNF)”):
- statements are newline-terminated; indentation is cosmetic, not significant;
- keywords are ALWAYS CAPS (ASCII); identifiers are content (case-sensitive,
verbatim, any-script letters — e.g.
условие,名前); - block boundaries (PREMISE/RULE bodies) are found by keywords, never by indent.
Structs§
- Atom
- An atom is the triple
(subject, predicate, object?)— the unit of identity.Creature.A has flyingandCreature.A has swimmingare DIFFERENT atoms. - Literal
- A literal is an atom, optionally negated (
NOT ...). - Located
- Container for data associated with its source location.
- Parse
Error - A friendly error structure that can be displayed to the user.
- Program
- A parsed program: a flat sequence of statements.
Enums§
- Body
- The body of an
PREMISEorRULE. - Conn
- How the literals in a
WHEN/THENgroup combine. A single-literal group is alwaysConn::And(the connective is irrelevant with one literal). - ListOp
- List constraint operators (body of a list-style
PREMISE). - Statement
- A top-level statement.
Constants§
- RESERVED
- Reserved words — always CAPS, in full. An identifier may not equal any of these.
Functions§
- is_
reserved - Whether
wordis a reserved keyword. - parse
- Parse a full
.vrfsource into aProgram.
Type Aliases§
- Span
- Source code fragment with line and column tracking.