# parsing package

## `bast` module

Brian AST representation

This is a standard Python AST representation with additional information added.

Exported members: `BrianASTRenderer`, `brian_ast`, `dtype_hierarchy`

Classes

`BrianASTRenderer`(variables[, copy_variables]) | This class is modelled after `NodeRenderer` - see there for details.

Functions

`brian_ast`(expr, variables) | Returns an AST tree representation with additional information

`brian_dtype_from_dtype`(dtype) | Returns 'boolean', 'integer' or 'float'

`brian_dtype_from_value`(value) | Returns 'boolean', 'integer' or 'float'

`is_boolean`(value) |

`is_boolean_dtype`(obj) |

`is_float`(value) |

`is_float_dtype`(obj) |

`is_integer`(value) |

`is_integer_dtype`(obj) |

## `dependencies` module

Exported members: `abstract_code_dependencies`

Functions

`abstract_code_dependencies`(code[, ...]) | Analyses identifiers used in abstract code blocks

`get_read_write_funcs`(parsed_code) |

## `expressions` module

AST parsing based analysis of expressions

Exported members: `parse_expression_dimensions`

Functions

`is_boolean_expression`(expr, variables) | Determines if an expression is of boolean type or not

`parse_expression_dimensions`(expr, variables) | Returns the unit value of an expression, and checks its validity

## `functions` module

Exported members: `AbstractCodeFunction`, `abstract_code_from_function`, `extract_abstract_code_functions`, `substitute_abstract_code_functions`

Classes

`AbstractCodeFunction`(name, args, code, ...) | The information defining an abstract code function

`FunctionRewriter`(func[, numcalls]) | Inlines a function call using temporary variables

`VarRewriter`(pre) | Rewrites all variable names in names by prepending pre

Functions

`abstract_code_from_function`(func) | Converts the body of the function to abstract code

`extract_abstract_code_functions`(code) | Returns a set of abstract code functions from function definitions.

`substitute_abstract_code_functions`(code, funcs) | Performs inline substitution of all the functions in the code

## `rendering` module

Exported members: `CPPNodeRenderer`, `NodeRenderer`, `NumpyNodeRenderer`, `SympyNodeRenderer`

Classes

`CPPNodeRenderer`([auto_vectorise]) |

`NodeRenderer`([auto_vectorise]) |

`NumpyNodeRenderer`([auto_vectorise]) |

`SympyNodeRenderer`([auto_vectorise]) |

## `statements` module

Functions

`parse_statement`(code) | Parses a single line of code into "var op expr".

## `sympytools` module

Utility functions for parsing expressions and statements.

Classes

`CustomSympyPrinter`([settings]) | Printer that overrides the printing of some basic sympy objects.

Functions

`check_expression_for_multiple_stateful_functions`(...) |

`expression_complexity`(expr[, complexity]) | Returns the complexity of an expression (either string or sympy)

`str_to_sympy`(expr[, variables]) | Parses a string into a sympy expression.

`sympy_to_str`(sympy_expr) | Converts a sympy expression into a string.

Objects

`PRINTER` | Printer that overrides the printing of some basic sympy objects.