Package lepl :: Package core :: Module rewriters :: Class OptimizeOr
[hide private]
[frames] | no frames]

Class OptimizeOr

source code


A rewriter that re-arranges Or matcher contents for left--recursive loops.

When a left-recursive rule is used, it is much more efficient if it appears last in an Or statement, since that forces the alternates (which correspond to the terminating case in a recursive function) to be tested before the LMemo limit is reached.

This rewriting may change the order in which different results for an ambiguous grammar are returned.

conservative refers to the algorithm used to detect loops; False may classify some left--recursive loops as right--recursive.

Instance Methods [hide private]
 
__init__(self, conservative=True)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__call__(self, graph) source code

Inherited from Rewriter: __eq__, __ge__, __gt__, __hash__, __le__, __lt__, __ne__, __str__

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, conservative=True)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

__call__(self, graph)
(Call operator)

source code 
Overrides: Rewriter.__call__