Package Martel :: Module optimize
[hide private]
[frames] | no frames]

Module optimize

source code

Optimize an expression tree

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

Functions [hide private]
 
skip_empty_group(exp) source code
 
optimize_unnamed_groups_recursive(exp) source code
 
optimize_unnamed_groups(exp)
return an equivalent expression tree but without unnamed groups
source code
 
is_mergeable(exp) source code
 
get_merge_text(exp) source code
 
merge_strings(exp)
merge successive strings and string-like terms into a single Str
source code
 
optimize(exp)
expression tree -> optimized expression tree
source code
Function Details [hide private]

optimize_unnamed_groups(exp)

source code 

return an equivalent expression tree but without unnamed groups

WARNING: has side-effect

merge_strings(exp)

source code 

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

WARNING: has side-effects

optimize(exp)

source code 

expression tree -> optimized expression tree

Apply various optimizations to the expression tree.