Mercurial > pysmcl
changeset 106:ee8991b037b9
Wrapped long lines in docstrings.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Fri, 17 Jul 2009 11:49:56 +0200 |
parents | 47d11f038cd4 |
children | 12f0d470f970 |
files | pysmcl/range_analysis.py |
diffstat | 1 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/pysmcl/range_analysis.py Fri Jul 17 11:49:37 2009 +0200 +++ b/pysmcl/range_analysis.py Fri Jul 17 11:49:56 2009 +0200 @@ -6,8 +6,9 @@ """ This module implements a range analysis of expressions in the core PySMCL language. -The lattice is the power set lattice over all variables and their range in a given -function. A range is represented as a tuple of two numbers or the bottom element. +The lattice is the power set lattice over all variables and their +range in a given function. A range is represented as a tuple of two +numbers or the bottom element. """ # Import system packages. @@ -20,7 +21,8 @@ debug = False class Bottom(object): - """The element used to represent intervals that are not between -(p//2) and p//2. + """The element used to represent intervals that are not between + -(p//2) and p//2. e.g. for p=7 the expression x = 2-5 yields the range for x Bottom() """ @@ -50,7 +52,8 @@ class RangeAnalysis(object): """The class which defines the range analysis. - Call the apply method to perform the range analysis on a FunctionDef object. + Call the apply method to perform the range analysis on a + FunctionDef object. """ # The key used in the flow framework for our analysis @@ -138,8 +141,8 @@ return rangeVisitor.visit(node) class RangeVisitor(ast.NodeVisitor): - """RangeVisitor is the visitor which actually implements the - range computation.""" + """RangeVisitor is the visitor which actually implements the range + computation.""" def __init__(self, prime, env): """ @@ -192,7 +195,8 @@ return (0, 1) def visit_Call(self, node): - # TODO: Check that random and random_bit are bound to the expected functions + # TODO: Check that random and random_bit are bound to the + # expected functions if node.func.id == "random": return full_range(self.prime) if node.func.id == "random_bit": @@ -200,7 +204,8 @@ return full_range(self.prime) class TargetVisitor(ast.NodeVisitor): - """TargetVisitor update range of target of an assignment in the given environment. + """TargetVisitor update range of target of an assignment in the + given environment. The following expression can appear in assignment contexts: Attribute, Subscript, Name, List, Tuple.