Ichor.Conformance.Toolkits (Ichor v0.7.2)

Copy Markdown View Source

This implementation's answers to the Ichor Conformance Suite's toolkit cases: Ichor.Toolkit.Pratt, Ichor.Backtrack.Bindings, Ichor.Backtrack.Tree and Ichor.Toolkit.TermWalk, each run on data a case gives and answering data.

The callbacks are the suite's, not a grammar's. Each toolkit takes callbacks or a term module, which are host code; every adapter supplies the same small standard set, so what is compared is the toolkit's own behaviour:

  • A term is {:var, name} for a variable, {:term, functor, args} for a compound, and anything else for an atomic term (Ichor.Conformance.Toolkits.Term).
  • Pratt reads a list of tokens. An operand is one token that is not an operator; a node is {fixity, op, operands...}; an operand can start where the next token is an operand or a prefix operator.

The operations:

  • "pratt" -- "operators" (op => %{prefix: prec, infix: [prec, assoc], postfix: prec}) and "tokens"; answers "tree", or "error": :fail, or {:"left-over", index} of the first token not read.
  • "unify" -- "left", "right", "occurs-check"; answers "result": the bindings it made, each variable to what it was bound to, or :fail.
  • "solve" -- "goal": :succeed, :fail, {:unify, a, b}, {:and, g, g}, {:or, g, g}, {:once, g}; answers "solutions": every solution's bindings, in order.
  • "walk" -- "term" and "walk": :visit, the terms visited in order, or {:rename, %{from => to}}, the term with those functors renamed; answers "result".

Summary

Functions

The outcome of one toolkit case, its inputs already decoded.

Functions

outcome(binary, map)

@spec outcome(String.t(), map()) :: map()

The outcome of one toolkit case, its inputs already decoded.