concepts.pdsketch.parsers.pdsketch_v3_parser.FunctionCallTracker#

class FunctionCallTracker[source]#

Bases: object

This class is used to track the function calls and other statements in a suite. It supports simulating the execution of the program and generating the post-condition of the program.

Methods

run()

Simulate the execution of the program and generates an equivalent return statement.

Attributes

local_variables_stack

The assignments of local variables.

assign_expressions

A list of assign expressions.

assign_expression_signatures

A dictionary of assign expressions, indexed by their signatures.

check_expressions

A list of check expressions.

expr_expressions

A list of expr expressions (i.e.

return_expression

The return expression.

use_runtime_assign

Whether to use runtime assign expressions.

regression_expressions

__init__(suite, init_local_variables=None, use_runtime_assign=False)[source]#
Parameters:
  • suite (Suite) –

  • init_local_variables (Dict[str, Any] | None) –

  • use_runtime_assign (bool) –

__new__(**kwargs)#
run()[source]#

Simulate the execution of the program and generates an equivalent return statement. This function handles if-else conditions. However, loops are not allowed.

assign_expression_signatures: Dict[Tuple[str, ...], VariableAssignmentExpression]#

A dictionary of assign expressions, indexed by their signatures.

assign_expressions: List[Tuple[VariableAssignmentExpression, Dict[str, Any]]]#

A list of assign expressions.

check_expressions: List[ValueOutputExpression]#

A list of check expressions.

expr_expressions: List[ValueOutputExpression]#

A list of expr expressions (i.e. bare expressions in the body).

local_variables_stack: List[Dict[str, Any]]#

The assignments of local variables.

regression_expressions: List[OperatorApplicationExpression | FindExpression | AchieveExpression | RuntimeAssignExpression | ListExpansionExpression | RegressionCommitFlag | RegressionRuleApplicationExpression | ConditionalRegressionRuleBodyExpression | LoopRegressionRuleBodyExpression]#
return_expression: ValueOutputExpression | None#

The return expression. This is either None or a single expression.

use_runtime_assign: bool#

Whether to use runtime assign expressions. If this is set to True, assignment expressions for local variables will be converted into runtime assign expressions.