pynestml.codegeneration.printers package

Submodules

pynestml.codegeneration.printers.ast_printer module

class pynestml.codegeneration.printers.ast_printer.ASTPrinter

Bases: object

Printer for ``ASTNode``s.

Printers are instantiated rather than having only static methods. This is the “compositionality over inheritance” pattern, chosen because “lower” grammar elements need to be printed in different ways (for instance, references to variables which could live in different data structures depending on the context) while the “higher” grammar element printers stay the same (for instance, printing a composite expression).

Some printers have internal parameters/settings, like the with_vector_parameter attribute of the NESTVariablePrinter.

abstract print(node: ASTNode) str

pynestml.codegeneration.printers.c_simple_expression_printer module

class pynestml.codegeneration.printers.c_simple_expression_printer.CSimpleExpressionPrinter(variable_printer: VariablePrinter, constant_printer: ConstantPrinter, function_call_printer: FunctionCallPrinter)

Bases: SimpleExpressionPrinter

Printer for ASTSimpleExpressions in C syntax.

print(node: ASTNode) str
print_simple_expression(node: ASTSimpleExpression) str

Print a simple expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.c_variable_printer module

class pynestml.codegeneration.printers.c_variable_printer.CVariablePrinter(expression_printer: ExpressionPrinter)

Bases: VariablePrinter

print_variable(node: ASTVariable) str

Print a variable. :param node: a single variable symbol or variable :return: a string representation

pynestml.codegeneration.printers.constant_printer module

class pynestml.codegeneration.printers.constant_printer.ConstantPrinter

Bases: object

print_constant(const: str | float | int) str

Converts a single handed over constant. :param constant_name: a constant as string. :type constant_name: str :return: the corresponding nest representation

pynestml.codegeneration.printers.cpp_expression_printer module

class pynestml.codegeneration.printers.cpp_expression_printer.CppExpressionPrinter(simple_expression_printer: SimpleExpressionPrinter)

Bases: ExpressionPrinter

Printer for ASTExpression nodes in C++ syntax.

print(node: ASTNode) str
print_expression(node: ASTExpressionNode) str

Print an expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.cpp_function_call_printer module

class pynestml.codegeneration.printers.cpp_function_call_printer.CppFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: FunctionCallPrinter

Printer for ASTFunctionCall in C++ syntax.

print(node: ASTNode) str
print_function_call(function_call: ASTFunctionCall) str

Print a function call, including bracketed arguments list.

Parameters:

node – The function call node to print.

Returns:

The function call string.

Return type:

s

pynestml.codegeneration.printers.cpp_printer module

class pynestml.codegeneration.printers.cpp_printer.CppPrinter(expression_printer: ExpressionPrinter)

Bases: ModelPrinter

This class can be used to print any ASTNode to C++ syntax.

print_assignment(node: ASTAssignment) str
print_comparison_operator(node: ASTComparisonOperator) str
print_delay_parameter(variable: VariableSymbol) str

Prints the delay parameter :param variable: Variable with delay parameter :return: the corresponding delay parameter

print_expression(node: ASTExpressionNode) str

Prints the handed over rhs to a nest readable format. :param node: a single meta_model node. :return: the corresponding string representation

print_function_call(node: ASTFunctionCall) str
print_simple_expression(node: ASTSimpleExpression) str
print_small_stmt(node) str
print_stmt(node) str
print_variable(node: ASTVariable) str

pynestml.codegeneration.printers.cpp_simple_expression_printer module

class pynestml.codegeneration.printers.cpp_simple_expression_printer.CppSimpleExpressionPrinter(variable_printer: VariablePrinter, constant_printer: ConstantPrinter, function_call_printer: FunctionCallPrinter)

Bases: CSimpleExpressionPrinter

Printer for ASTSimpleExpressions in C++ syntax.

print_simple_expression(node: ASTSimpleExpression) str

Print a simple expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.cpp_type_symbol_printer module

class pynestml.codegeneration.printers.cpp_type_symbol_printer.CppTypeSymbolPrinter

Bases: TypeSymbolPrinter

Returns a C++ syntax version of the handed over type.

print(type_symbol: TypeSymbol) str

Converts the name of the type symbol to a corresponding nest representation. :param type_symbol: a single type symbol :return: the corresponding string representation.

pynestml.codegeneration.printers.cpp_variable_printer module

class pynestml.codegeneration.printers.cpp_variable_printer.CppVariablePrinter(expression_printer: ExpressionPrinter)

Bases: VariablePrinter

print_variable(node: ASTVariable) str

Print a variable. :param node: a single variable symbol or variable :return: a string representation

pynestml.codegeneration.printers.expression_printer module

class pynestml.codegeneration.printers.expression_printer.ExpressionPrinter(simple_expression_printer: SimpleExpressionPrinter)

Bases: ASTPrinter

Converts expressions to the executable platform dependent code.

This class is used to transform only parts of the grammar and not NESTML as a whole.

abstract print_expression(node: ASTExpressionNode) str

Print an expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.function_call_printer module

class pynestml.codegeneration.printers.function_call_printer.FunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: ASTPrinter

Converts function calls to the executable platform dependent code.

This class is used to transform only parts of the grammar and not NESTML as a whole.

print(node: ASTNode) str
abstract print_function_call(node: ASTFunctionCall) str

Print a function call.

Parameters:

node – The node to print.

Returns:

The string representation.

Return type:

s

pynestml.codegeneration.printers.gsl_variable_printer module

class pynestml.codegeneration.printers.gsl_variable_printer.GSLVariablePrinter(expression_printer: ExpressionPrinter)

Bases: CppVariablePrinter

Reference converter for C++ syntax and using the GSL (GNU Scientific Library) API from inside the extern "C" stepping function.

print_variable(node: ASTVariable) str

Converts a single name reference to a gsl processable format. :param node: a single variable :return: a gsl processable format of the variable

pynestml.codegeneration.printers.latex_expression_printer module

class pynestml.codegeneration.printers.latex_expression_printer.LatexExpressionPrinter(simple_expression_printer: SimpleExpressionPrinter)

Bases: ExpressionPrinter

Expressions printer for LaTeX. Assumes to be printing in a LaTeX environment where math mode is already on.

print(node: ASTExpressionNode) str
print_expression(node: ASTExpressionNode) str

Print an expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

print_function_call(function_call) str

Print function call.

Parameters:

function_call (ASTFunctionCall) – a function call

Returns:

the corresponding string representation

pynestml.codegeneration.printers.latex_function_call_printer module

class pynestml.codegeneration.printers.latex_function_call_printer.LatexFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: FunctionCallPrinter

Printer for ASTFunctionCall in LaTeX syntax.

print(node: ASTNode) str
print_function_call(function_call: ASTFunctionCall) str

Print a function call.

Parameters:

node – The node to print.

Returns:

The string representation.

Return type:

s

pynestml.codegeneration.printers.latex_simple_expression_printer module

class pynestml.codegeneration.printers.latex_simple_expression_printer.LatexSimpleExpressionPrinter(variable_printer: VariablePrinter, constant_printer: ConstantPrinter, function_call_printer: FunctionCallPrinter)

Bases: SimpleExpressionPrinter

Printer for ASTSimpleExpressions in LaTeX syntax.

print(node: ASTNode) str
print_simple_expression(node: ASTSimpleExpression) str

Print a simple expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.latex_variable_printer module

class pynestml.codegeneration.printers.latex_variable_printer.LatexVariablePrinter(expression_printer: ExpressionPrinter)

Bases: VariablePrinter

print_variable(node: ASTVariable) str

Convert name reference.

Parameters:

ast_variable – a single variable

Returns:

the corresponding string representation

pynestml.codegeneration.printers.model_printer module

class pynestml.codegeneration.printers.model_printer.ModelPrinter

Bases: ASTPrinter

Generic base class for printing any ASTNode.

print(node: ASTNode) str
print_arithmetic_operator(node: ASTArithmeticOperator) str
print_assignment(node: ASTAssignment) str
print_bit_operator(node: ASTBitOperator) str
print_block(node: ASTBlock) str
print_block_with_variables(node: ASTBlockWithVariables) str
print_comparison_operator(node: ASTComparisonOperator) str
print_compilation_unit(node: ASTNestMLCompilationUnit) str
print_compound_stmt(node: ASTCompoundStmt) str
print_data_type(node: ASTDataType) str
print_declaration(node: ASTDeclaration) str
print_elif_clause(node: ASTElifClause) str
print_else_clause(node: ASTElseClause) str
print_equations_block(node: ASTEquationsBlock) str
print_for_stmt(node: ASTForStmt) str
print_function(node: ASTFunction) str
print_if_clause(node: ASTIfClause) str
print_if_stmt(node: ASTIfStmt) str
print_inline_expression(node: ASTInlineExpression) str
print_input_block(node: ASTInputBlock) str
print_input_port(node: ASTInputPort) str
print_input_qualifier(node: ASTInputQualifier) str
print_kernel(node: ASTKernel) str
print_logical_operator(node: ASTLogicalOperator) str
print_model(node: ASTModel) str
print_model_body(node: ASTModelBody) str
print_neuron(node: ASTModel) str
print_ode_equation(node: ASTOdeEquation) str
print_on_condition_block(node: ASTOnConditionBlock) str
print_on_receive_block(node: ASTOnReceiveBlock) str
print_output_block(node: ASTOutputBlock) str
print_parameter(node: ASTParameter) str
print_return_stmt(node: ASTReturnStmt) str
print_small_stmt(node: ASTSmallStmt) str
print_stmt(node: ASTStmt) str
print_unary_operator(node: ASTUnaryOperator) str
print_unit_type(node: ASTUnitType) str
print_update_block(node: ASTUpdateBlock) str
print_variable(node: ASTVariable) str
print_while_stmt(node: ASTWhileStmt) str

pynestml.codegeneration.printers.nest2_cpp_function_call_printer module

class pynestml.codegeneration.printers.nest2_cpp_function_call_printer.NEST2CppFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: NESTCppFunctionCallPrinter

This class is used to convert function calls to the GSL (GNU Scientific Library) syntax.

pynestml.codegeneration.printers.nest2_gsl_function_call_printer module

class pynestml.codegeneration.printers.nest2_gsl_function_call_printer.NEST2GSLFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: NEST2CppFunctionCallPrinter

This class is used to convert function calls to the GSL (GNU Scientific Library) syntax.

pynestml.codegeneration.printers.nest_cpp_function_call_printer module

class pynestml.codegeneration.printers.nest_cpp_function_call_printer.NESTCppFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: CppFunctionCallPrinter

Printer for ASTFunctionCall in C++ syntax.

pynestml.codegeneration.printers.nest_cpp_type_symbol_printer module

class pynestml.codegeneration.printers.nest_cpp_type_symbol_printer.NESTCppTypeSymbolPrinter

Bases: CppTypeSymbolPrinter

Returns a C++ syntax version of the handed over type.

print(type_symbol: TypeSymbol) str

Converts the name of the type symbol to a corresponding nest representation. :param type_symbol: a single type symbol :return: the corresponding string representation.

pynestml.codegeneration.printers.nest_gsl_function_call_printer module

class pynestml.codegeneration.printers.nest_gsl_function_call_printer.NESTGSLFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: NESTCppFunctionCallPrinter

This class is used to convert function calls to the GSL (GNU Scientific Library) syntax.

pynestml.codegeneration.printers.nest_variable_printer module

class pynestml.codegeneration.printers.nest_variable_printer.NESTVariablePrinter(expression_printer: ExpressionPrinter, with_origin: bool = True, with_vector_parameter: bool = True, enforce_getter: bool = True)

Bases: CppVariablePrinter

Variable printer for C++ syntax and the NEST API.

print_variable(variable: ASTVariable) str

Converts a single variable to nest processable format. :param variable: a single variable. :return: a nest processable format.

pynestml.codegeneration.printers.nestml_printer module

class pynestml.codegeneration.printers.nestml_printer.NESTMLPrinter

Bases: ModelPrinter

This class can be used to print any ASTNode to NESTML syntax.

dec_indent()
inc_indent()
print_arithmetic_operator(node: ASTArithmeticOperator) str
print_assignment(node: ASTAssignment) str
print_bit_operator(node: ASTBitOperator) str
print_block(node: ASTBlock) str
print_block_with_variables(node: ASTBlockWithVariables) str
print_comparison_operator(node: ASTComparisonOperator) str
print_compilation_unit(node: ASTNestMLCompilationUnit) str
print_compound_stmt(node: ASTCompoundStmt) str
print_data_type(node: ASTDataType) str
print_declaration(node: ASTDeclaration) str
print_elif_clause(node: ASTElifClause) str
print_else_clause(node: ASTElseClause) str
print_equations_block(node: ASTEquationsBlock) str
print_expression(node: ASTExpression) str
print_for_stmt(node: ASTForStmt) str
print_function(node: ASTFunction) str
print_function_call(node: ASTFunctionCall) str
print_if_clause(node: ASTIfClause) str
print_if_stmt(node: ASTIfStmt) str
print_inline_expression(node: ASTInlineExpression) str
print_input_block(node: ASTInputBlock) str
print_input_port(node: ASTInputPort) str
print_input_qualifier(node: ASTInputQualifier) str
print_kernel(node: ASTKernel) str
print_logical_operator(node: ASTLogicalOperator) str
print_model(node: ASTModel) str
print_model_body(node: ASTModelBody) str
print_ode_equation(node: ASTOdeEquation) str
print_on_condition_block(node: ASTOnConditionBlock) str
print_on_receive_block(node: ASTOnReceiveBlock) str
print_output_block(node: ASTOutputBlock) str
print_parameter(node: ASTParameter) str
print_return_stmt(node: ASTReturnStmt)
print_simple_expression(node: ASTSimpleExpression) str
print_small_stmt(node: ASTSmallStmt) str
print_stmt(node: ASTStmt)
print_unary_operator(node: ASTUnaryOperator) str
print_unit_type(node: ASTUnitType) str
print_update_block(node: ASTUpdateBlock)
print_variable(node: ASTVariable)
print_while_stmt(node: ASTWhileStmt) str
tab_size: int = 4
pynestml.codegeneration.printers.nestml_printer.print_ml_comments(comments, indent=0, newline=False) str
pynestml.codegeneration.printers.nestml_printer.print_n_spaces(n) str
pynestml.codegeneration.printers.nestml_printer.print_sl_comment(comment) str

pynestml.codegeneration.printers.nestml_variable_printer module

class pynestml.codegeneration.printers.nestml_variable_printer.NestMLVariablePrinter(expression_printer: ExpressionPrinter)

Bases: VariablePrinter

Print ``ASTVariable``s in NESTML syntax.

print_variable(node: ASTVariable) str

Print a variable node :param node: the node to print :return: string representation

pynestml.codegeneration.printers.ode_toolbox_expression_printer module

class pynestml.codegeneration.printers.ode_toolbox_expression_printer.ODEToolboxExpressionPrinter(simple_expression_printer: SimpleExpressionPrinter)

Bases: CppExpressionPrinter

Printer for ASTExpression nodes in ODE-toolbox syntax.

pynestml.codegeneration.printers.ode_toolbox_function_call_printer module

class pynestml.codegeneration.printers.ode_toolbox_function_call_printer.ODEToolboxFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: FunctionCallPrinter

Printer for ASTFunctionCall in sympy syntax.

print(node: ASTNode) str
print_function_call(function_call: ASTFunctionCall) str

Print a function call, including bracketed arguments list.

Parameters:

node – The function call node to print.

Returns:

The function call string.

Return type:

s

pynestml.codegeneration.printers.ode_toolbox_variable_printer module

class pynestml.codegeneration.printers.ode_toolbox_variable_printer.ODEToolboxVariablePrinter(expression_printer: ExpressionPrinter)

Bases: VariablePrinter

Convert into a format accepted by ODE-toolbox as input.

print_variable(node: ASTVariable) str

Print variable. :param node: the node to print :return: string representation

pynestml.codegeneration.printers.python_expression_printer module

class pynestml.codegeneration.printers.python_expression_printer.PythonExpressionPrinter(simple_expression_printer: SimpleExpressionPrinter)

Bases: ExpressionPrinter

Printer for ASTExpression nodes in Python syntax.

print(node: ASTNode) str
print_arithmetic_operator(node: ASTExpressionNode) str

Prints an arithmetic operator. :param op: an arithmetic operator object :return: a string representation

print_bit_operator(node: ASTExpressionNode) str

Prints a bit operator in NEST syntax. :param op: a bit operator object :return: a string representation

print_comparison_operator(node: ASTExpressionNode) str

Prints a comparison operator. :param op: a comparison operator object :return: a string representation

print_expression(node: ASTExpressionNode) str

Print an expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

print_logical_not(node: ASTExpression) str

Prints a logical NOT operator. :return: a string representation

print_logical_operator(node: ASTExpressionNode) str

Prints a logical operator. :param op: a logical operator object :return: a string representation

pynestml.codegeneration.printers.python_function_call_printer module

class pynestml.codegeneration.printers.python_function_call_printer.PythonFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: FunctionCallPrinter

Printer for ASTFunctionCall in Python syntax.

print(node: ASTNode) str
print_function_call(function_call: ASTFunctionCall) str

Print a function call, including bracketed arguments list.

Parameters:

node – The function call node to print.

Returns:

The function call string.

Return type:

s

pynestml.codegeneration.printers.python_simple_expression_printer module

class pynestml.codegeneration.printers.python_simple_expression_printer.PythonSimpleExpressionPrinter(variable_printer: VariablePrinter, constant_printer: ConstantPrinter, function_call_printer: FunctionCallPrinter)

Bases: SimpleExpressionPrinter

Printer for ASTSimpleExpressions in Python syntax.

print(node: ASTNode) str
print_simple_expression(node: ASTSimpleExpression) str

Print a simple expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.python_standalone_printer module

class pynestml.codegeneration.printers.python_standalone_printer.PythonStandalonePrinter(expression_printer: ExpressionPrinter)

Bases: ModelPrinter

This class can be used to print any ASTNode to Python syntax.

print_assignment(node: ASTAssignment) str
print_comparison_operator(node: ASTComparisonOperator) str
print_delay_parameter(variable: VariableSymbol) str

Prints the delay parameter :param variable: Variable with delay parameter :return: the corresponding delay parameter

print_expression(node: ASTExpressionNode) str

Prints the handed over rhs to a nest readable format. :param node: a single meta_model node. :return: the corresponding string representation

print_function_call(node: ASTFunctionCall) str
print_simple_expression(node: ASTSimpleExpression) str
print_small_stmt(node) str
print_stmt(node) str
print_variable(node: ASTVariable) str

pynestml.codegeneration.printers.python_stepping_function_function_call_printer module

class pynestml.codegeneration.printers.python_stepping_function_function_call_printer.PythonSteppingFunctionFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: PythonFunctionCallPrinter

Printer for ASTFunctionCall in Python syntax.

pynestml.codegeneration.printers.python_stepping_function_variable_printer module

class pynestml.codegeneration.printers.python_stepping_function_variable_printer.PythonSteppingFunctionVariablePrinter(expression_printer: ExpressionPrinter)

Bases: VariablePrinter

Printer for variables in Python syntax and in the context of an ODE solver stepping function.

print_delay_variable(variable: ASTVariable) str

Print a delay variable. :param variable: the variable to be printed :return: the string representation

print_variable(node: ASTVariable) str

Print a variable. :param node: the variable to be printed :return: the string representation

pynestml.codegeneration.printers.python_type_symbol_printer module

class pynestml.codegeneration.printers.python_type_symbol_printer.PythonTypeSymbolPrinter

Bases: TypeSymbolPrinter

Returns a Python syntax version of the handed over type.

print(type_symbol: TypeSymbol) str

Converts the name of the type symbol to a corresponding Python syntax representation. :param type_symbol: a single type symbol :return: the corresponding string representation.

pynestml.codegeneration.printers.python_variable_printer module

class pynestml.codegeneration.printers.python_variable_printer.PythonVariablePrinter(expression_printer: ExpressionPrinter, with_origin: bool = True, with_vector_parameter: bool = True)

Bases: VariablePrinter

Variable printer for Python syntax.

print_variable(variable: ASTVariable) str

Converts a single variable to nest processable format. :param variable: a single variable. :return: a string representation

pynestml.codegeneration.printers.simple_expression_printer module

class pynestml.codegeneration.printers.simple_expression_printer.SimpleExpressionPrinter(variable_printer: VariablePrinter, constant_printer: ConstantPrinter, function_call_printer: FunctionCallPrinter)

Bases: ASTPrinter

Converts expressions to the executable platform dependent code.

This class is used to transform only parts of the grammar and not NESTML as a whole.

abstract print_simple_expression(node: ASTSimpleExpression) str

Print a simple expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.spinnaker_c_function_call_printer module

class pynestml.codegeneration.printers.spinnaker_c_function_call_printer.SpinnakerCFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: FunctionCallPrinter

Printer for ASTFunctionCall in C Spinnaker API syntax.

print_function_call(node: ASTFunctionCall) str

Converts a single handed over function call to C Spinnaker API syntax.

Parameters:

function_call – The function call node to convert.

Returns:

The function call string in C syntax.

Return type:

s

pynestml.codegeneration.printers.spinnaker_c_type_symbol_printer module

class pynestml.codegeneration.printers.spinnaker_c_type_symbol_printer.SpinnakerCTypeSymbolPrinter

Bases: TypeSymbolPrinter

Returns a Spinnaker C API syntax version of the handed over type.

print(type_symbol: TypeSymbol) str

Converts the name of the type symbol to a corresponding nest representation. :param type_symbol: a single type symbol :return: the corresponding string representation.

pynestml.codegeneration.printers.spinnaker_c_variable_printer module

class pynestml.codegeneration.printers.spinnaker_c_variable_printer.SpinnakerCVariablePrinter(expression_printer: ExpressionPrinter, with_origin: bool = True, with_vector_parameter: bool = True)

Bases: CppVariablePrinter

Variable printer for C syntax and the Spinnaker API.

print_variable(variable: ASTVariable) str

Converts a single variable to Spinnaker processable format. :param variable: a single variable. :return: a Spinnaker processable format.

pynestml.codegeneration.printers.spinnaker_gsl_function_call_printer module

class pynestml.codegeneration.printers.spinnaker_gsl_function_call_printer.SpinnakerGSLFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: SpinnakerCFunctionCallPrinter

This class is used to convert function calls to the GSL (GNU Scientific Library) syntax.

pynestml.codegeneration.printers.spinnaker_python_function_call_printer module

class pynestml.codegeneration.printers.spinnaker_python_function_call_printer.SpinnakerPythonFunctionCallPrinter(expression_printer: ExpressionPrinter)

Bases: PythonFunctionCallPrinter

Printer for ASTFunctionCall in Python syntax.

pynestml.codegeneration.printers.spinnaker_python_simple_expression_printer module

pynestml.codegeneration.printers.spinnaker_python_type_symbol_printer module

class pynestml.codegeneration.printers.spinnaker_python_type_symbol_printer.SpinnakerPythonTypeSymbolPrinter

Bases: TypeSymbolPrinter

Returns a Python syntax version of the handed over type.

print(type_symbol: TypeSymbol) str

Converts the name of the type symbol to a corresponding Python syntax representation. :param type_symbol: a single type symbol :return: the corresponding string representation.

pynestml.codegeneration.printers.symbol_printer module

class pynestml.codegeneration.printers.symbol_printer.SymbolPrinter

Bases: object

Returns a string format of ``Symbol``s.

abstract classmethod print(element: Symbol) str

pynestml.codegeneration.printers.type_symbol_printer module

class pynestml.codegeneration.printers.type_symbol_printer.TypeSymbolPrinter

Bases: SymbolPrinter

Returns a string format of ``TypeSymbol``s.

abstract classmethod print(element: Symbol) str

pynestml.codegeneration.printers.unitless_c_simple_expression_printer module

class pynestml.codegeneration.printers.unitless_c_simple_expression_printer.UnitlessCSimpleExpressionPrinter(variable_printer: VariablePrinter, constant_printer: ConstantPrinter, function_call_printer: FunctionCallPrinter)

Bases: CSimpleExpressionPrinter

An adjusted version of the printer which prints in the units of the target platform (XXX: just nest?)

print_simple_expression(node: ASTSimpleExpression) str

Print an expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.unitless_cpp_simple_expression_printer module

class pynestml.codegeneration.printers.unitless_cpp_simple_expression_printer.UnitlessCppSimpleExpressionPrinter(variable_printer: VariablePrinter, constant_printer: ConstantPrinter, function_call_printer: FunctionCallPrinter)

Bases: CppSimpleExpressionPrinter

An adjusted version of the printer which prints in the units of the target platform (XXX: just nest?)

print_simple_expression(node: ASTSimpleExpression) str

Print an expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.unitless_sympy_simple_expression_printer module

class pynestml.codegeneration.printers.unitless_sympy_simple_expression_printer.UnitlessSympySimpleExpressionPrinter(variable_printer: VariablePrinter, constant_printer: ConstantPrinter, function_call_printer: FunctionCallPrinter)

Bases: CppSimpleExpressionPrinter

Printer for ASTSimpleExpressions in Sympy syntax.

print(node: ASTNode) str
print_simple_expression(node: ASTSimpleExpression) str

Print a simple expression.

Parameters:

node – The expression node to print.

Returns:

The expression string.

Return type:

s

pynestml.codegeneration.printers.variable_printer module

class pynestml.codegeneration.printers.variable_printer.VariablePrinter(expression_printer: ExpressionPrinter)

Bases: ASTPrinter

Converts variables to the executable platform dependent code.

This class is used to transform only parts of the grammar and not NESTML as a whole.

print(node: ASTNode) str
abstract print_variable(node: ASTVariable) str

Print a variable.

Parameters:

node – The node to print.

Returns:

The string representation.

Return type:

s