parser_oper_defs

Function parser_oper_defs 

Source
pub fn parser_oper_defs(arena: &mut Arena) -> OperDefs
Expand description

Constructs the default operator definitions used by the TermParser.

This function populates an OperDefs table in the given Arena, defining built-in operators such as - (prefix), ++ (infix), and = (infix), along with their precedence and associativity rules.

[ op(-(x), prefix, 800, right, none, false),
  op(++(x, y), infix, 500, left, none, false),
  op(=(x, y), infix, 100, right, none, false),
  op(op(f,
        =(type, fun),
        =(prec, 0),
        =(assoc, none),
        =(rename_to, none),
        =(embed_type, false)),
     fun, 0, none, none, false)
]

The resulting definitions form the standard operator environment available to the parser when no user-defined operator table is provided.

§Parameters

  • arena: The Arena used for allocating operator term structures.

§Returns

An initialized OperDefs instance containing the default operator set.