Grammar.LosslessShiftReduce (Ichor v0.7.2)

Copy Markdown View Source

The lossless match of the interpreted shift-reduce backends, Grammar.LR and Grammar.GLR (design/lossless-mode.md): tokenize, run the table with the rules recording, place an error against the input, weave the tree.

The two differ only in the run -- Grammar.LR.Lossless.run/6, or Grammar.GLR.Runtime.run/7 building with Ichor.Syntax.Record.reduced/3 -- so it is handed in, and the surrounding steps are each backend's ordinary ones, in the same order: the lossless parse fails exactly where and how the ordinary one does.

Summary

Types

A run over a table, as Grammar.LR.Lossless.run/6 takes its arguments.

Functions

{:ok, value, tree} from a matched/5 result, value evaluated as the backend's run/4 evaluates it.

The lossless tree of input under grammar, whose table is table, and the ordinary captures beside it with the locator of their recorded positions, for evaluated/5.

Types

Functions

evaluated(matched, grammar, actions_module, initial_context, capture_shapes)

{:ok, value, tree} from a matched/5 result, value evaluated as the backend's run/4 evaluates it.

matched(grammar, table, input, context, run)

The lossless tree of input under grammar, whose table is table, and the ordinary captures beside it with the locator of their recorded positions, for evaluated/5.