Skip to main content

Crate elenchus_parser

Crate elenchus_parser 

Source
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 flying and Creature.A has swimming are DIFFERENT atoms.
Literal
A literal is an atom, optionally negated (NOT ...).
Located
Container for data associated with its source location.
ParseError
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 PREMISE or RULE.
Conn
How the literals in a WHEN/THEN group combine. A single-literal group is always Conn::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 word is a reserved keyword.
parse
Parse a full .vrf source into a Program.

Type Aliases§

Span
Source code fragment with line and column tracking.