Aletheia.Reader.ControlSyntax (Aletheia v0.1.1)

Copy Markdown View Source

Translates a parsed goal from Aletheia.Reader's own ISO-punctuation term shape (,/2, ;/2, ->/2, !, =/2, ...) into the plain-English control-construct/comparison names Episteme.Engine dispatches on (and/2, or/2, if_then/2, cut, unify/2, ...) -- see episteme's own CHANGELOG.md under its 0.1.0 release: as of its first Hex publish, Episteme no longer accepts ISO punctuation directly, since it has no reader of its own for that punctuation to be conventional syntax against. Bridging that gap is squarely this reader's job, not the engine's.

Only applied to goals (rule bodies, directive/query goals) -- never to fact terms or rule heads, which are plain data matched structurally by the engine, not dispatched as goals.

Summary

Functions

Rewrites goal from ISO-punctuation control/comparison names to Episteme's own. Recognizes the ISO (Cond -> Then ; Else) nested pattern (;/2 wrapping ->/2 as its first argument) and rewrites it to the explicit if_then_else/3 Episteme now requires -- a plain per-node translation would instead produce or(if_then(Cond, Then), Else), which wrongly retries Else if Cond succeeds but Then fails.

Functions

to_goal(goal)

@spec to_goal(term()) :: term()

Rewrites goal from ISO-punctuation control/comparison names to Episteme's own. Recognizes the ISO (Cond -> Then ; Else) nested pattern (;/2 wrapping ->/2 as its first argument) and rewrites it to the explicit if_then_else/3 Episteme now requires -- a plain per-node translation would instead produce or(if_then(Cond, Then), Else), which wrongly retries Else if Cond succeeds but Then fails.