pub enum ParseError {
Show 57 variants
EmptyProgram,
MultipleExpressions,
EmptyChain,
AbsWithoutBody,
BadBinder,
UnexpectedBinder,
BadSymbol,
CombinatorDeferred,
DiscardReference,
ReservedName,
MalformedNumber,
PunctAtAtom,
MalformedMapKey,
LetMissingBinders,
LetMissingBody,
RecurMissingBinders,
RecurMissingBody,
RecurShadowsOuter(Text),
MalformedBinding,
ReservedKeyword,
BadPattern,
ComparandNotAtom,
BareLiteralHeader,
LoneSurrogate,
LetOrUnparenthesized,
UnknownType,
OrBindersMismatch,
MalformedPipe,
UnboundName(Text),
BadModuleItemName,
DuplicateModuleItem,
MalformedImport,
MisplacedImport,
MalformedConst,
MisplacedConst,
ShadowsImport(Text),
ShadowsIota(Text),
MalformedLocal,
MisplacedLocal,
ShadowsLocal(Text),
ShadowsItem(Text),
UnknownReserved(Text),
DuplicateReserved(Text),
MisplacedReserved,
OutsideModule(Text),
NotAPrototype(Text),
BinderRunGlued,
FloatLiteralUnsupported,
ReservedLiteralForm,
BareListLiteral,
BareMapLiteral,
BlockTrailingBinding,
CaseMissingArms,
CaseSubjectExtra,
ArmNotBinder,
ArmMissingBody,
WhenMissingCond,
}Expand description
A parse failure: the input is a valid Muon tree but not a well-formed Elly program in this subset.
Variants§
EmptyProgram
The top-level sequence held no chain (nothing to evaluate).
MultipleExpressions
The top-level sequence held more than one chain; top-level sequencing is deferred (a program is a single expression).
EmptyChain
A chain reduced to nothing (e.g. only comments).
AbsWithoutBody
A & binder with no body — &x alone is ill-formed (yet).
BadBinder
A & prefix on something that is not a well-formed binder header (see
BadPattern for the pattern content itself).
UnexpectedBinder
A binder appeared where an atomic expression was expected. Not reachable via the split logic, kept so parsing never panics.
BadSymbol
A . sigil on something that is not a single name/number segment (e.g.
.(…), .&x). .foo / .0 are symbols; the record sugar .(…) and
other prefixed items are deferred / ill-formed.
CombinatorDeferred
A bare . used as an atom (f . g, a lone .). At the Muon layer this
is a <punct>; Elly reserves it for a future . / |> application
combinator, which is deferred.
DiscardReference
_ used as a reference. _ is the discard pattern (a binder that binds
nothing), never a name that can be read back.
ReservedName
A &-binder tried to introduce a name starting with __. Such names are
reserved for builtins / special forms and may be referenced but not bound.
MalformedNumber
A <sym> that begins like a number but is not a valid integer literal
(1a, 0xZZ, 1__2, 0x). Since a <name> may not start with a digit,
a digit-leading sym must be a well-formed <int> or it is an error.
PunctAtAtom
A stray : / = (or other) <punct> item at atom position. Muon parses
this punctuation, but outside a let binding (=) or a map entry (:)
it has no atomic reading. (A #{…} map literal and a #[…] list value are
their own atoms; the bare {…} / […] forms are rejected, not deferred.)
MalformedMapKey
A map entry (<braces> chain) whose key is missing or malformed: no :
after the key, or a key item that is not a bare atom, a .-symbol, a (…)
computed key, or a #[…] / #{…} literal key ({ : 1 }, { foo }).
LetMissingBinders
A let not followed by a binder group — let 1 e. An empty group is not
an error: let () e binds nothing and is e (see parse_let).
LetMissingBody
A let (…) with nothing after the binder group; the body is required.
RecurMissingBinders
A recur not followed by a binder group — recur 1 e. As with let, an
empty group is not an error: recur () e is e.
RecurMissingBody
A recur (…) with nothing after the binder group; the body is required.
RecurShadowsOuter(Text)
A recur binding whose name is already in scope. The group’s bindings are
simultaneous, so inside it the name would mean the group’s own binding and
never the outer one — the opposite of what the identical let line means.
Detected by the resolution pass (resolve.rs); carries the offending name.
MalformedBinding
A binding inside a let (…) group is not <pattern> "=" <expr>: missing
or repeated top-level =, an empty pattern, or an empty value.
ReservedKeyword
A keyword (let, with) used as a reference or a binder. Keywords are
syntax, not names: they may be neither read nor bound.
BadPattern
A malformed pattern: an empty pattern, a comma-grouped (a, b) used as a
single pattern, a misplaced ...rest, or any item with no pattern reading.
ComparandNotAtom
A comparand after = / < / > that is not a single atom (a name or
a literal). A pattern is a closed grammar — = f x, < (f x), = [a]
have no reading; write = x, = 5, or .foo.
BareLiteralHeader
A bare matching literal used as an entire &-header or let binding
LHS: a number (&42), a symbol (&.foo), or a string (&"foo").
Parenthesize it — &(42), &(.foo), &("foo"), let ((42) = v) — so the
“match this literal” intent is explicit (a bare literal reads as a value, or
as an intended binder). A literal nested in […] / {…} / (…) / an
or-pattern needs no parens.
LoneSurrogate
A <str> literal with an unpaired UTF-16 surrogate escape ("\uD83D",
a high or low \uXXXX not completing a pair). Muon accepts it lexically,
but UTF-8 cannot represent it, so Elly’s decode rejects it at parse.
LetOrUnparenthesized
A bare top-level | in a let binding’s LHS: let ((x=.a) | (x=.b) = v).
Wrap the or-pattern — let (((x=.a) | (x=.b)) = v) e — so it does not
visually compete with the binding’s own =.
UnknownType
An as <Type> whose <Type> is not one of the closed kinds
Int Sym List Map Fun.
OrBindersMismatch
An or-pattern (p | q) whose arms bind different sets of names.
MalformedPipe
A |> pipe combinator with a missing operand — |> f, x |>, or
x |> |> f. Both sides of |> must be non-empty.
UnboundName(Text)
A name reference that resolves to no enclosing &-binding — a free
variable. Detected by the resolution pass (resolve.rs) after parsing,
so it is a static error: the program is rejected before it runs, rather
than raising .unbound_name at eval. Carries the offending name (spans
are still a TODO). __-names never reach here — they are resolved to
Expr::Builtin at parse.
BadModuleItemName
A module (parse_module) binding whose left-hand side is not a single bare
name: a destructuring pattern, a literal, a discard, or a digit-leading
token. Module top-level keys are plain names in v0. A __… or keyword LHS
reports ParseError::ReservedName / ParseError::ReservedKeyword instead.
DuplicateModuleItem
A module defines the same item name twice, or an import’s local name is
also an item name. A name means one thing inside a module, so both are
rejected here. The Foo = import "spec" form is the one place a name is
both an import and an item: it is a single declaration, and it makes them
the same thing.
MalformedImport
An import that is neither import "<spec>" as <Name> nor
<Name> = import "<spec>": a missing as, a spec that is not a string
literal, or trailing items. The spec is a literal in a fixed position —
which is what makes a module’s imports a static, auditable list — so there
is nothing to compute here.
MisplacedImport
An import somewhere other than a module’s top level — today, inside a
recur group. An import is a frame slot the const
stage fills before the module exists, so it can only be written in a
module’s own source. Written anywhere else, import is an ordinary keyword
and reports ParseError::ReservedKeyword.
MalformedConst
A const declaration that is neither const <name>, const (<name> …)
nor <name> = const: a declaration that is not a bare name, a group whose
chains are not bare names, or a payload — const x = 1, x = const 1.
The payload forms are reserved for const-time expressions and rejected
until those exist (see docs/done/2026-08-13_elly-modules-iotas.md).
MisplacedConst
A const somewhere other than a module’s top level — today, inside a
recur group. A group is built while a program runs
and has no instance of its own to mint against, so an iota can only be
declared in a module’s source. Written anywhere else, const is an
ordinary keyword and reports ParseError::ReservedKeyword.
ShadowsImport(Text)
A binder — a pattern binder, a let binding, a recur binding — taking a
name the enclosing module declares as an import. A declaration’s name
means one thing over the whole module, so it may not be shadowed from
inside (see docs/done/2026-08-13_elly-modules-iotas.md). Carries the name.
ShadowsIota(Text)
A binder taking a name the enclosing module declares as a const
iota. Carries the name.
MalformedLocal
A local declaration that is neither local <name> = <expr> nor the
group local (<name> = <expr> …): a left-hand side that is not a bare
name, a group chain that is not a binding, or a missing body. The
head-with-arguments form local f x = <expr> lands here too — it is a
template moditem, left open (see docs/done/2026-08-13_elly-modules-local.md).
MisplacedLocal
A local somewhere other than a module’s top level — today, inside a
recur group, where every binding is private
already, so the keyword would say nothing. Written anywhere else, local
is an ordinary keyword and reports ParseError::ReservedKeyword.
ShadowsLocal(Text)
A binder taking a name the enclosing module declares as a
local. Carries the name.
ShadowsItem(Text)
A binder taking a name the enclosing module — or an enclosing
recur group — declares as an item. Carries the
name. This is the direction opposite to
RecurShadowsOuter, which stops a group
binding from shadowing a name already in scope; together they make a
declared name unshadowable from either side.
UnknownReserved(Text)
A __ name the language does not define, in either position it can be
written: a module top-level left-hand side (__mian = …) or a reference
in an expression (__mian). The __ namespace belongs to the language —
a source may write the builtins and the reserved moditems it defines
and nothing else — so a misspelling fails here, naming the namespace,
rather than becoming an item nobody reads or a name nothing binds.
Carries the name as written.
DuplicateReserved(Text)
A module declaring the same reserved moditem twice (two __mains). A
reserved moditem is a single slot, not a table, so there is no second one
to hold. Carries the name.
MisplacedReserved
A reserved moditem somewhere other than a module’s top level — today,
inside a recur group. A group is an item table,
not a module source, and nothing would ever read the slot. Written
anywhere else, __main is an ordinary __ name and reports
UnknownReserved.
OutsideModule(Text)
A home-module leaf — Self, #Self(…), x.Self, or
the Self <pat> pattern — outside a module body. Each reads the module
its body is written in, and there is none: the term is not a module’s, or
it is a recur group in a program that is not a
module. One test covers both, since a group is not a module either.
Carries the name — Self, the one word every form is spelled with.
NotAPrototype(Text)
An as <Proto> pattern whose reference is a __ name that is not a
prototype: a builtin that is no module at all (as __eq), or __Err,
which is a namespace of operations that no value answers __proto with —
so the check could never hold. Rejected here rather than compiled into a
pattern that always refutes. Carries the name.
BinderRunGlued
A &-headed run (&x.0, &(a, b).0) — a
binder glued to a following atom with no whitespace. A binder is one
prefixed atom, so the glued tail has no reading; write it spaced
(&x .0) to apply, or restructure. See docs/todo/elly-parse-runs.md §C.
FloatLiteralUnsupported
An <int>-then-.<digits> run — the float-like run 3.14 (Muon groups
the two atoms, see docs/done/2026-09-08_muon-runs.md). Float literals do
not exist yet; this holds the notation open for them (a real float is a
later Num extension) while giving a clear error now instead of the
runtime .not_applicable a spaced 3 .14 projection raises.
ReservedLiteralForm
A #-prefixed form other than the three that
read: #[…] (a list), #{…} (a map), and #Self(…) / #Self …
(construction). The # sigil marks a literal notation, and the
remaining shapes — #<sym>, #<str>, #(…), #.name — are reserved
for future literal kinds with no reading yet. A bare #Self lands here
as well: construction is a form, not a value, so it may only head a
spine (see parse_app_spine). See docs/todo/elly-syntax-v1.md §2.
BareListLiteral
A bare […] where a list literal or list pattern is written. After the
reshuffle (phase 3), the list literal uses the #-prefixed spelling
exclusively: write #[…]. See docs/todo/elly-syntax-v1.md § 3–5.
BareMapLiteral
A bare {…} carrying a :-clause where a map literal or map pattern is
written. After the reshuffle, the map literal uses the #-prefixed
spelling exclusively: write #{…}. A :-clause has no reading in a block
(nothing legal in a block starts <key> :), so a brace group with one is
this error in every position; a brace group without a :-clause is a
block (step 6), and the empty {} is the unit value.
See docs/todo/elly-syntax-v1.md § 3–5.
BlockTrailingBinding
A block {…} whose final clause is a binding ({ …, x = v }). A block’s
value is its last clause’s value and its bindings do not escape, so a
trailing binding would bind a name nothing can read and leave no value to
return — as a let with no body does. End the block with an expression.
See docs/todo/elly-syntax-v1.md § 5 (review) and step 6.
CaseMissingArms
A case with no {…} arm block — case x or case alone, or a trailing
item that is not a brace group. The block is where the clauses live, so a
case without one has nothing to match against and no reading.
CaseSubjectExtra
A case subject that is more than one item — case f x { … }. The subject
is exactly one item so the arm block’s {…} is unambiguous; group a
compound subject (case (f x) { … }) or pipe it in (f x |> case { … }).
ArmNotBinder
A case arm whose chain is not headed by & — a clause that is not a
binder. Every arm is & <pattern> … <body>; a bare expression is not one.
ArmMissingBody
A case arm with a pattern (and any guards) but no body after them —
& x or & x when (c) alone. An arm’s body is required.
WhenMissingCond
A when guard with no (…) condition group — when at the end of a
header, or when followed by something other than a parenthesized group.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
impl Eq for ParseError
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
Source§fn eq(&self, other: &ParseError) -> bool
fn eq(&self, other: &ParseError) -> bool
self and other values to be equal, and is used by ==.