xfrp/envs/operators

(Binary) operator precedence controller and environments.

Types

XfrpOpBody = object
  args: seq[WithCodeInfo[XfrpIdAndType]]
  retType: WithCodeInfo[XfrpType]
  body: WithCodeInfo[XfrpExpr]
  Source Edit
XfrpOpDescription = object
  symbol: XfrpOperator
  precedence: XfrpInfixPrecedence
  body: TableRef[seq[XfrpType], XfrpOpBody]
  Source Edit
XfrpOpId = tuple[moduleId: XfrpModuleId, op: XfrpOperator]
  Source Edit
XfrpOpEnv = distinct TableRef[XfrpOpId, XfrpOpDescription]
  Source Edit

Procs

proc reparseBinaryExpression(opEnv: XfrpOpEnv; exp: WithCodeInfo[XfrpExpr];
                             definedIn: XfrpModuleId; materialTbl: XfrpMaterials): WithCodeInfo[
    XfrpExpr] {...}{.raises: [KeyError, XfrpDefinitionError, XfrpSyntaxError],
                tags: [].}
Reepase an expression. When finding a binary expression, the operator environment will convert to a binary tree by exact operator precedence.   Source Edit
proc makeOperatorEnvironment(materialTbl: XfrpMaterials): XfrpOpEnv {...}{.
    raises: [KeyError, XfrpDefinitionError, XfrpReferenceError], tags: [].}
Construct new operator environment.   Source Edit
proc getOperator(opEnv: XfrpOpEnv; id: XfrpOpId): XfrpOpDescription {...}{.
    raises: [KeyError], tags: [].}
  Source Edit
proc findOpId(opEnv: XfrpOpEnv; op: XfrpOperator; termTypes: seq[XfrpType];
              definedIn: XfrpModuleId; materialTbl: XfrpMaterials): XfrpOpId {...}{.
    raises: [KeyError, XfrpLanguageError], tags: [].}
Search available operator ID of given term types in given module.   Source Edit
proc symbol(desc: XfrpOpDescription): XfrpOperator {...}{.raises: [], tags: [].}
  Source Edit
proc getBody(desc: XfrpOpDescription; argTypes: seq[XfrpType]): XfrpOpBody {...}{.
    raises: [KeyError], tags: [].}
  Source Edit
proc args(opBody: XfrpOpBody): seq[WithCodeInfo[XfrpIdAndType]] {...}{.raises: [],
    tags: [].}
  Source Edit
proc retType(opBody: XfrpOpBody): WithCodeInfo[XfrpType] {...}{.raises: [], tags: [].}
  Source Edit
proc body(opBody: XfrpOpBody): WithCodeInfo[XfrpExpr] {...}{.raises: [], tags: [].}
  Source Edit

Iterators

iterator items(opEnv: XfrpOpEnv): XfrpOpId {...}{.raises: [], tags: [].}
Iterate all operators by ID.   Source Edit
iterator availableArgTypes(desc: XfrpOpDescription): seq[XfrpType] {...}{.raises: [],
    tags: [].}
Iterates available term types.   Source Edit