Aletheia.Reader.Pratt (Aletheia v0.1.1)

Copy Markdown View Source

The @native(...) callback lib/aletheia/reader/grammar.aether's term/arg_term rules delegate to -- precedence-climbing over context.operators (an Ichor.Toolkit.Pratt table), mirroring ichor's own test/support/prolog_grammar.ex worked example, with one addition: parse_arg_term/4 raises the floor to @arg_min_prec, ISO's real "an argument is a term of priority =< 999" rule (Ichor.Toolkit.Pratt.parse/4's own min_prec parameter), so , -- a genuine operator here, unlike that fixture's grammar-structural comma -- never gets swallowed into a single argument or list element.

Summary

Functions

ISO Prolog priority (bigger number = looser binding) -> Ichor.Toolkit.Pratt precedence (bigger = tighter).

Restricted-priority parse (ISO's argument/list-element rule) -- compound arguments, list elements.

Full-priority parse -- rule bodies, directive goals, parenthesized sub-terms.

Functions

iso_to_pratt(iso_prec)

@spec iso_to_pratt(non_neg_integer()) :: non_neg_integer()

ISO Prolog priority (bigger number = looser binding) -> Ichor.Toolkit.Pratt precedence (bigger = tighter).

parse_arg_term(stream, pos, context, deps)

Restricted-priority parse (ISO's argument/list-element rule) -- compound arguments, list elements.

parse_term(stream, pos, context, deps)

Full-priority parse -- rule bodies, directive goals, parenthesized sub-terms.