Parsing constructor tokens in prefix order #
A token describes a leaf, a unary constructor, or a binary constructor. parseFuel reads one
value and returns the unconsumed suffix, or none on an invalid token, missing operand, or
exhausted fuel. No default value or inhabitance assumption is needed. parse uses the input
length as fuel, and decode additionally rejects trailing tokens.
Syntax-specific round-trip proofs imply append_injective: a value's tokens determine both the
value and the following suffix. This avoids comparing every pair of constructors when proving
injectivity of a flat syntax encoding. No machine resource bound is asserted for these parsers.
The constructor represented by a token, with zero, one, or two operands.
- atom {α : Type u_1} (value : α) : Step α
A leaf value.
- unary {α : Type u_1} (make : α → α) : Step α
A constructor with one operand.
- binary {α : Type u_1} (make : α → α → α) : Step α
A constructor with two operands, in input order.
Instances For
A prefix round-trip determines the encoded value and every following token.
Parsing an encoded value leaves the supplied suffix unchanged.
A complete encoded value decodes to itself.