XFRP abstract syntax trees (ASTs).
Types
XfrpId = string
- Source Edit
XfrpModuleId = string
- Source Edit
XfrpIdAndType = tuple[id: WithCodeInfo[XfrpId], ty: WithCodeInfo[XfrpType]]
- Source Edit
XfrpIdAndTypeOptKind {...}{.pure.} = enum IdWithExplicitType, IdWithoutAnyTypeAnnot
- Source Edit
XfrpIdAndTypeOpt = object case kind*: XfrpIdAndTypeOptKind of XfrpIdAndTypeOptKind.IdWithExplicitType: idExplicit*: WithCodeInfo[XfrpId] tyExplicit*: WithCodeInfo[XfrpType] of XfrpIdAndTypeOptKind.IdWithoutAnyTypeAnnot: idImplicit*: WithCodeInfo[XfrpId]
- Source Edit
XfrpAnnotationKind {...}{.pure.} = enum AnnotAtLast
- Source Edit
XfrpAnnotation = object case kind*: XfrpAnnotationKind of XfrpAnnotationKind.AnnotAtLast: nil
- Source Edit
XfrpLiteralKind {...}{.pure.} = enum LitBool, LitInt, LitFloat
- Source Edit
XfrpLiteral = object case kind*: XfrpLiteralKind of XfrpLiteralKind.LitBool: boolVal*: bool of XfrpLiteralKind.LitInt: intVal*: int of XfrpLiteralKind.LitFloat: floatVal*: float
- Source Edit
XfrpOperator = string
- Source Edit
XfrpOperatorPrecedenceLevel = Natural
- Source Edit
XfrpOperatorAssociativity = enum assocLeft, assocRight, assocNone
- Source Edit
XfrpExprKind {...}{.pure.} = enum ExprLiteral, ExprId, ExprAnnot, ExprBin, ExprIf, ExprApp, ExprMagic
- Source Edit
XfrpExpr = object case kind*: XfrpExprKind of XfrpExprKind.ExprLiteral: litVal*: WithCodeInfo[XfrpLiteral] of XfrpExprKind.ExprId: id*: WithCodeInfo[XfrpId] of XfrpExprKind.ExprAnnot: annotId*: WithCodeInfo[XfrpId] annot*: WithCodeInfo[XfrpAnnotation] of XfrpExprKind.ExprBin: binOps*: seq[WithCodeInfo[XfrpOperator]] binTerms*: seq[WithCodeInfo[XfrpExpr]] of XfrpExprKind.ExprIf: ifExpr*: ref WithCodeInfo[XfrpExpr] thenExpr*: ref WithCodeInfo[XfrpExpr] elseExpr*: ref WithCodeInfo[XfrpExpr] of XfrpExprKind.ExprApp: appId*: WithCodeInfo[XfrpId] appArgs*: seq[WithCodeInfo[XfrpExpr]] of XfrpExprKind.ExprMagic: magicIdAndType*: WithCodeInfo[XfrpIdAndType] magicArgs*: seq[WithCodeInfo[XfrpExpr]]
- Source Edit
XfrpDefinitionKind {...}{.pure.} = enum DefNode, DefFunc, DefOp, DefInfix, DefInit
- Source Edit
XfrpDefinition = object case kind*: XfrpDefinitionKind of XfrpDefinitionKind.DefNode: nodeIdAndTypeOpt*: WithCodeInfo[XfrpIdAndTypeOpt] nodeInit*: Option[WithCodeInfo[XfrpExpr]] nodeBody*: WithCodeInfo[XfrpExpr] of XfrpDefinitionKind.DefFunc: funId*: WithCodeInfo[XfrpId] funRetType*: WithCodeInfo[XfrpType] funArgs*: seq[WithCodeInfo[XfrpIdAndType]] funBody*: WithCodeInfo[XfrpExpr] of XfrpDefinitionKind.DefOp: operator*: WithCodeInfo[XfrpOperator] opRetType*: WithCodeInfo[XfrpType] opArgs*: seq[WithCodeInfo[XfrpIdAndType]] opBody*: WithCodeInfo[XfrpExpr] of XfrpDefinitionKind.DefInfix: infixOp*: WithCodeInfo[XfrpOperator] infixLevel*: XfrpOperatorPrecedenceLevel infixAssoc*: XfrpOperatorAssociativity of XfrpDefinitionKind.DefInit: initId*: WithCodeInfo[XfrpId] initBody*: WithCodeInfo[XfrpExpr]
- Source Edit
XfrpInputKind {...}{.pure.} = enum InputWithoutInit, InputWithInit
- Source Edit
XfrpInput = object case kind*: XfrpInputKind of XfrpInputKind.InputWithoutInit: idAndTypeNoInit*: WithCodeInfo[XfrpIdAndType] of XfrpInputKind.InputWithInit: idAndTypeWithInit*: WithCodeInfo[XfrpIdAndType] init*: WithCodeInfo[XfrpExpr]
- Source Edit
XfrpEmit = tuple[target, body: string]
- Source Edit
XfrpModuleKind = enum modModule, modMaterial
- Source Edit
XfrpModule = tuple[kind: XfrpModuleKind, moduleId: WithCodeInfo[XfrpModuleId], ins: seq[WithCodeInfo[XfrpInput]], outs: seq[WithCodeInfo[XfrpIdAndTypeOpt]], uses: seq[WithCodeInfo[XfrpModuleId]], emits: seq[WithCodeInfo[XfrpEmit]], defs: seq[WithCodeInfo[XfrpDefinition]]]
- Either module or material. Source Edit
Procs
proc `==`(a: XfrpIdAndTypeOpt; b: XfrpIdAndTypeOpt): bool {...}{.used, raises: [], tags: [].}
- Source Edit
proc IdWithExplicitType(idExplicit: WithCodeInfo[XfrpId]; tyExplicit: WithCodeInfo[XfrpType]): XfrpIdAndTypeOpt {...}{. used, raises: [], tags: [].}
- Source Edit
proc IdWithoutAnyTypeAnnot(idImplicit: WithCodeInfo[XfrpId]): XfrpIdAndTypeOpt {...}{. used, raises: [], tags: [].}
- Source Edit
proc `==`(a: XfrpAnnotation; b: XfrpAnnotation): bool {...}{.used, raises: [], tags: [].}
- Source Edit
proc AnnotAtLast(): XfrpAnnotation {...}{.used, raises: [], tags: [].}
- Source Edit
proc `==`(a: XfrpLiteral; b: XfrpLiteral): bool {...}{.used, raises: [], tags: [].}
- Source Edit
proc LitBool(boolVal: bool): XfrpLiteral {...}{.used, raises: [], tags: [].}
- Source Edit
proc LitInt(intVal: int): XfrpLiteral {...}{.used, raises: [], tags: [].}
- Source Edit
proc LitFloat(floatVal: float): XfrpLiteral {...}{.used, raises: [], tags: [].}
- Source Edit
proc `==`(a: XfrpExpr; b: XfrpExpr): bool {...}{.used, raises: [], tags: [].}
- Source Edit
proc ExprLiteral(litVal: WithCodeInfo[XfrpLiteral]): XfrpExpr {...}{.used, raises: [], tags: [].}
- Source Edit
proc ExprId(id: WithCodeInfo[XfrpId]): XfrpExpr {...}{.used, raises: [], tags: [].}
- Source Edit
proc ExprAnnot(annotId: WithCodeInfo[XfrpId]; annot: WithCodeInfo[XfrpAnnotation]): XfrpExpr {...}{.used, raises: [], tags: [].}
- Source Edit
proc ExprBin(binOps: seq[WithCodeInfo[XfrpOperator]]; binTerms: seq[WithCodeInfo[XfrpExpr]]): XfrpExpr {...}{.used, raises: [], tags: [].}
- Source Edit
proc ExprIf(ifExpr: ref WithCodeInfo[XfrpExpr]; thenExpr: ref WithCodeInfo[XfrpExpr]; elseExpr: ref WithCodeInfo[XfrpExpr]): XfrpExpr {...}{.used, raises: [], tags: [].}
- Source Edit
proc ExprApp(appId: WithCodeInfo[XfrpId]; appArgs: seq[WithCodeInfo[XfrpExpr]]): XfrpExpr {...}{. used, raises: [], tags: [].}
- Source Edit
proc ExprMagic(magicIdAndType: WithCodeInfo[XfrpIdAndType]; magicArgs: seq[WithCodeInfo[XfrpExpr]]): XfrpExpr {...}{.used, raises: [], tags: [].}
- Source Edit
proc `==`(a: XfrpDefinition; b: XfrpDefinition): bool {...}{.used, raises: [], tags: [].}
- Source Edit
proc DefNode(nodeIdAndTypeOpt: WithCodeInfo[XfrpIdAndTypeOpt]; nodeInit: Option[WithCodeInfo[XfrpExpr]]; nodeBody: WithCodeInfo[XfrpExpr]): XfrpDefinition {...}{.used, raises: [], tags: [].}
- Source Edit
proc DefFunc(funId: WithCodeInfo[XfrpId]; funRetType: WithCodeInfo[XfrpType]; funArgs: seq[WithCodeInfo[XfrpIdAndType]]; funBody: WithCodeInfo[XfrpExpr]): XfrpDefinition {...}{.used, raises: [], tags: [].}
- Source Edit
proc DefOp(operator: WithCodeInfo[XfrpOperator]; opRetType: WithCodeInfo[XfrpType]; opArgs: seq[WithCodeInfo[XfrpIdAndType]]; opBody: WithCodeInfo[XfrpExpr]): XfrpDefinition {...}{.used, raises: [], tags: [].}
- Source Edit
proc DefInfix(infixOp: WithCodeInfo[XfrpOperator]; infixLevel: XfrpOperatorPrecedenceLevel; infixAssoc: XfrpOperatorAssociativity): XfrpDefinition {...}{.used, raises: [], tags: [].}
- Source Edit
proc DefInit(initId: WithCodeInfo[XfrpId]; initBody: WithCodeInfo[XfrpExpr]): XfrpDefinition {...}{. used, raises: [], tags: [].}
- Source Edit
proc `==`(a: XfrpInput; b: XfrpInput): bool {...}{.used, raises: [], tags: [].}
- Source Edit
proc InputWithoutInit(idAndTypeNoInit: WithCodeInfo[XfrpIdAndType]): XfrpInput {...}{. used, raises: [], tags: [].}
- Source Edit
proc InputWithInit(idAndTypeWithInit: WithCodeInfo[XfrpIdAndType]; init: WithCodeInfo[XfrpExpr]): XfrpInput {...}{.used, raises: [], tags: [].}
- Source Edit
proc makeXfrpModule(moduleId: WithCodeInfo[XfrpModuleId]; ins: seq[WithCodeInfo[XfrpInput]]; outs: seq[WithCodeInfo[XfrpIdAndTypeOpt]]; uses: seq[WithCodeInfo[XfrpModuleId]] = @[]; emits: seq[WithCodeInfo[XfrpEmit]] = @[]; defs: seq[WithCodeInfo[XfrpDefinition]]): XfrpModule {...}{. raises: [], tags: [].}
- Construct a normal module. Source Edit
proc makeXfrpMaterial(moduleId: WithCodeInfo[XfrpModuleId]; uses: seq[WithCodeInfo[XfrpModuleId]] = @[]; emits: seq[WithCodeInfo[XfrpEmit]] = @[]; defs: seq[WithCodeInfo[XfrpDefinition]]): XfrpModule {...}{. raises: [], tags: [].}
- Construct a material module. Source Edit
proc split(idAndTypeOpt: XfrpIdAndTypeOpt): tuple[id: WithCodeInfo[XfrpId], typeOpt: Option[WithCodeInfo[XfrpType]]] {...}{.raises: [], tags: [].}
- Source Edit
proc split(input: XfrpInput): tuple[id: WithCodeInfo[XfrpId], ty: WithCodeInfo[XfrpType], initOpt: Option[WithCodeInfo[XfrpExpr]]] {...}{. raises: [], tags: [].}
- Source Edit