Table of Contents

Module: optimize Martel/optimize.py

Optimize an expression tree

  • remove Group nodes with no name - merge successive Str, single character positive Any nodes and positive Literals

Imported modules   
import Expression
Functions   
get_merge_text
is_mergeable
merge_strings
optimize
optimize_unnamed_groups
optimize_unnamed_groups_recursive
skip_empty_group
  get_merge_text 
get_merge_text ( exp )

Exceptions   
AssertionError, "unknown exp: %s" % repr( exp )
  is_mergeable 
is_mergeable ( exp )

  merge_strings 
merge_strings ( exp )

merge successive strings and string-like terms into a single Str

WARNING: has side-effects

  optimize 
optimize ( exp )

expression tree -> optimized expression tree

Apply various optimizations to the expression tree.

  optimize_unnamed_groups 
optimize_unnamed_groups ( exp )

return an equivalent expression tree but without unnamed groups

WARNING: has side-effect

  optimize_unnamed_groups_recursive 
optimize_unnamed_groups_recursive ( exp )

The only thing this does is remove Groups with no names

  skip_empty_group 
skip_empty_group ( exp )


Table of Contents

This document was automatically generated on Mon Jul 1 12:03:20 2002 by HappyDoc version 2.0.1