curry.backends.generic.compiler module
- class curry.backends.generic.compiler.CompilerBase(interp, iroot)[source]
Bases:
ABC- CODE_TYPE = None
- EXCLUDED_METADATA = None
- HOIST_DEPTH = None
- compile()[source]
Performs compilation.
- Returns:
A target object containing the generated object code.
- compileE(expr, primary=False)[source]
Compile an expression into a string. For primary expressions, the string evaluates to a value (boxed or unboxed). For non-primary expressions, it contains comma-separated arguments that may be passed to the Node constructor or Node->forward_to.
The walk runs on the trampoline (utility.trampoline): the case of a node with arguments is a generator that yields the walk of each argument, so the depth of the expression costs no frame of Python. A nested call per level ran out of frames at about 4000 elements of a literal list under maxrecursion (issue #125). The symbols are imported in the order of the recursive walk: the node’s own before those of its arguments.
- compileEx(icy)[source]
Compiles an ICurry object.
Updates the TargetObject and returns a new ICurry ‘interface’ object in which each function body has been replaced with IMaterial.
- Parameters:
icy – An IPackage, IModule, or IFunction to compile.
- Returns:
The ICurry interface.
- hoist(text, primary)[source]
The text of a primary node, or the name of a temporary that holds it. A backend with
HOIST_DEPTHmoves a node at that nesting under the statement, and at every multiple of it, into a temporary assigned before the statement (vEmitHoisted), so the nesting of the generated text stays bounded whatever the depth of the expression. The Python backend needs it: the parser of Python refuses more than 200 nested parentheses, and a literal list of 1200 elements is one nested call (issue #125).
- hoisting()[source]
Collects the lines hoisted out of the statement compiled inside the context (see
hoist): a list, complete when the context ends, that the caller emits before the statement.
- property root_isa_module
- property symtab
- abstractmethod vBackendFunctionKey()
- abstractmethod vEmitConstructorInfotab()
- abstractmethod vEmitDataType()
- abstractmethod vEmitDataTypeLink()
- abstractmethod vEmitFunctionInfotab()
- abstractmethod vEmitHeader()
- abstractmethod vEmitImported()
- abstractmethod vEmitInfotabLink()
- abstractmethod vEmitMetadata()
- abstractmethod vEmitModuleDefinition()
- abstractmethod vEmitModuleImport()
- abstractmethod vEmitStepfuncEntry()
- abstractmethod vEmitStepfuncHeader()
- abstractmethod vEmitStepfuncLink()
- abstractmethod vEmitStringLiteral()
- abstractmethod vEmitSynthesizedStepfunc()
- abstractmethod vEmitValueSetLiteral()
- abstractmethod vEmit_compileE_ICall()
- abstractmethod vEmit_compileE_ILiteral()
- abstractmethod vEmit_compileE_IOr()
- abstractmethod vEmit_compileE_IPartialCall()
- abstractmethod vEmit_compileE_IString()
- abstractmethod vEmit_compileE_IUnboxedLiteral()
- abstractmethod vEmit_compileE_IVar()
- abstractmethod vEmit_compileE_IVarAccess()
- abstractmethod vEmit_compileS_ICaseCons()
- abstractmethod vEmit_compileS_ICaseLit()
- abstractmethod vEmit_compileS_IExempt()
- abstractmethod vEmit_compileS_IFreeDecl()
- abstractmethod vEmit_compileS_INodeAssign()
- abstractmethod vEmit_compileS_IReturn()
- abstractmethod vEmit_compileS_IVarAssign()
- abstractmethod vEmit_compileS_IVarDecl()
- abstractmethod vIsBuiltin()
- abstractmethod vIsSynthesized()
- class curry.backends.generic.compiler.TargetObject(codetype, unitname)[source]
Bases:
object- SECTIONS = ('.header', '.imports', '.stepfuncs.link', '.infotabs.link', '.datatypes.link', '.strings', '.valuesets', '.primitives', '.metadata', '.stepfuncs', '.infotabs', '.datatypes', '.moduledef', '.moduleimp', '.footer')