elliptic.Kernel.Expression module

class elliptic.Kernel.Expression.EllipticNode[source]

Bases: anytree.node.nodemixin.NodeMixin

Base class for representing a node in the DSL tree.

export_tree(filename)[source]

Exports a graphical representation of the DSL tree.

This method can be called from any tree node. The tree root will always be used.

Parameters:filename (str) – Name for the exported image file.
Return type:None
class elliptic.Kernel.Expression.Expression(context_delegate, display_name='', display_args=None)[source]

Bases: elliptic.Kernel.Expression.EllipticNode

Base class for building DSL expressions.

Parameters:
  • context_delegate (Type[ContextDelegate]) – A context delegate object responsible for generating some Cython code.
  • display_name – The name that will be displayed when this Expression is rendered into a picture.
  • display_args – The arguments that will be displayed below this Expression name in the rendered picture.
render(template_manager, child, context_delegate)[source]

Render the expression generated code.

Parameters:
  • template_manager – A TemplateManagerBase instance.
  • child (str) – The rendered template corresponding to this node’s child.
  • context_delegate (ContextDelegate) – The context delegate for the DSL.
Return type:

str

visit(context)[source]

Context manager used when an expression node is visited in the DSL tree.

Calls the context delegate context_enter() and context_exit() methods.

Parameters:context (Context) – A context object.
Return type:Iterator[ContextDelegate]