curry.backends.py.graph package

class curry.backends.py.graph.DataType(name, ctorinfos)[source]

Bases: object

property constructors
class curry.backends.py.graph.InfoTable(name, arity, tag, flags, step, pyformat)[source]

Bases: object

Runtime info for a node. Every Curry node stores an InfoTable` instance, which contains instance-independent data.

property is_bool
property is_char
property is_float
property is_int
property is_io
property is_list
property is_monadic
property is_operator
property is_partial
property is_primitive
property is_special
property is_tuple
property step
property typedef
property typetag
class curry.backends.py.graph.Node(info, *args, target=None, partial_info=None, **kwds)[source]

Bases: object

A node in a Curry expression graph.

copy()[source]
static create_partial_applic(cls, info, *args, target=None, partial_info=None)[source]
forward_to(target)[source]
id()[source]
info
rewrite(info, *args, **kwds)[source]
set_successor(i, value)[source]
successor(i)[source]
successors
walk(path=None)[source]

See walkexpr.walk.

curry.backends.py.graph.iterexpr(expr)[source]

Generate each node in a Curry expression exactly once.

curry.backends.py.graph.walk(root, realpath=None)[source]

Walk a Curry expression.

This yields a “state” objects for each successor of the given root. The state consists of a cursor pointing to a subexpression, current path to the cursor, and other attributes. Iteration may be pruned or deepened by modifying the state. The subexpression under the cursor may be modified.

Variables:
  • stack – The remaining iteration state. May be modified to control the search. Call push to add the successors of the node under the cursor.

  • realpath – A list of integers giving the real path from the root to the cursor. Not to be modified.

  • spine – A list of nodes, equal in length to realpath, giving the node at each point along the path. Not to be modified.

  • cursor – The node currently being visited. Equivalent to spine[-1].

  • parent – The parent of the node at the cursor. Equivalent to spine[-2].

Submodules