concepts.pdsketch.parsers.pdsketch_v3_parser.PDSketch3ExpressionInterpreter#

class PDSketch3ExpressionInterpreter[source]#

Bases: Interpreter

The transformer for expressions. Including:

  • typename

  • sized_vector_typename

  • unsized_vector_typename

  • typed_argument

  • is_typed_argument

  • in_typed_argument

  • arguments_def

  • atom_expr_funccall

  • atom_varname

  • atom

  • power

  • factor

  • unary_op_expr

  • mul_expr

  • arith_expr

  • shift_expr

  • bitand_expr

  • bitxor_expr

  • bitor_expr

  • comparison_expr

  • not_test

  • and_test

  • or_test

  • cond_test

  • test

  • test_nocond

  • tuple

  • list

  • cs_list

  • suite

  • expr_stmt

  • expr_list_expansion_stmt

  • assign_stmt

  • annotated_assign_stmt

  • local_assign_stmt

  • pass_stmt

  • check_stmt

  • return_stmt

  • achieve_stmt

  • compound_assign_stmt

  • compound_check_stmt

  • compound_return_stmt

  • compound_achieve_stmt

  • if_stmt

  • forall_stmt

  • forall_test

  • exists_test

  • findall_test

  • forall_in_test

  • exists_in_test

Methods

achieve_stmt(value)

and_test(*values)

annotated_assign_stmt(annotations, target, value)

annotated_compound_stmt(annotations, stmt)

arguments(args)

Captures the argument list.

arith_expr(*values)

assign_stmt(target, value)

atom(value)

Captures atoms.

atom_expr_funccall(annotations, name, args)

Captures function calls, such as func_name(arg1, arg2, ...).

atom_subscript(name, index)

Captures subscript expressions such as name[index1, index2, ...].

atom_varname(name)

Captures variable names such as var_name.

bitand_expr(*values)

bitor_expr(*values)

bitxor_expr(*values)

check_stmt(value)

comparison_expr(*values)

compound_achieve_stmt(value)

compound_assign_stmt(target, value)

compound_check_stmt(value)

compound_return_stmt(value)

cond_test(value1, cond, value2)

cs_list(*values)

exists_in_test(cs_list, suite)

exists_test(cs_list, suite)

expr_list_expansion_stmt(value)

expr_stmt(value)

factor(value)

find_stmt(cs_list, suite)

findall_test(variable, suite)

forall_in_stmt(variables_cs_list, ...)

forall_in_test(cs_list, suite)

forall_stmt(cs_list, suite)

forall_test(cs_list, suite)

if_stmt(cond, suite[, else_suite])

list(*values)

local_assign_stmt(target[, value])

local_variable_guard()

mul_expr(*values)

not_test(value)

or_test(*values)

pass_stmt()

power(base[, exp])

The highest-priority expression.

return_stmt(value)

set_domain(domain)

set_generator_impl_outputs(outputs)

shift_expr(*values)

suite(*values)

test(value)

test_nocond(value)

tuple(*values)

unary_op_expr(op, value)

visit(tree)

visit_children(tree)

Attributes

domain

expression_def_ctx

__init__(domain, state, expression_def_ctx, auto_constant_guess=False)[source]#
Parameters:
__new__(**kwargs)#
achieve_stmt(value)[source]#
Parameters:

value (CSList) –

and_test(*values)[source]#
Parameters:

values (Any) –

Return type:

AndExpression

annotated_assign_stmt(annotations, target, value)[source]#
Parameters:
  • annotations (dict) –

  • target (Any) –

  • value (Any) –

annotated_compound_stmt(annotations, stmt)[source]#
Parameters:
  • annotations (dict) –

  • stmt (Any) –

arguments(args)[source]#

Captures the argument list. This is used in function calls.

Parameters:

args (Tree) –

Return type:

ArgumentsList

arith_expr(*values)#
Parameters:

values (Any) –

assign_stmt(target, value)[source]#
Parameters:
  • target (Any) –

  • value (Any) –

atom(value)[source]#

Captures atoms. This is used to Captures the base case of the expression, including literal constants, variables, and subscript expressions.

Parameters:

value (FunctionCall | Variable) –

Return type:

FunctionCall | Variable

atom_expr_funccall(annotations, name, args)[source]#

Captures function calls, such as func_name(arg1, arg2, …).

Parameters:
  • annotations (dict) –

  • name (str) –

  • args (Tree) –

Return type:

FunctionApplicationExpression | ListFunctionApplicationExpression | Implementation | OperatorApplicationExpression | GeneratorApplicationExpression | RegressionRuleApplicationExpression

atom_subscript(name, index)[source]#

Captures subscript expressions such as name[index1, index2, …].

Parameters:
  • name (str) –

  • index (Tree) –

Return type:

FunctionApplicationExpression | ListFunctionApplicationExpression

atom_varname(name)[source]#

Captures variable names such as var_name.

Parameters:

name (str) –

Return type:

VariableExpression | ObjectConstantExpression | ValueOutputExpression

bitand_expr(*values)#
Parameters:

values (Any) –

bitor_expr(*values)#
Parameters:

values (Any) –

bitxor_expr(*values)#
Parameters:

values (Any) –

check_stmt(value)[source]#
Parameters:

value (Any) –

comparison_expr(*values)[source]#
Parameters:

values (ValueOutputExpression | VariableExpression) –

Return type:

ValueOutputExpression

compound_achieve_stmt(value)[source]#
Parameters:

value (Any) –

compound_assign_stmt(target, value)[source]#
Parameters:
compound_check_stmt(value)[source]#
Parameters:

value (Any) –

compound_return_stmt(value)[source]#
Parameters:

value (Any) –

cond_test(value1, cond, value2)[source]#
Parameters:
  • value1 (Any) –

  • cond (Any) –

  • value2 (Any) –

Return type:

ConditionExpression

cs_list(*values)[source]#
Parameters:

values (Any) –

exists_in_test(cs_list, suite)[source]#
Parameters:
  • cs_list (Any) –

  • suite (Any) –

exists_test(cs_list, suite)[source]#
Parameters:
  • cs_list (Any) –

  • suite (Any) –

expr_list_expansion_stmt(value)[source]#
Parameters:

value (Any) –

expr_stmt(value)[source]#
Parameters:

value (Tree) –

factor(value)[source]#
Parameters:

value (FunctionCall | Variable) –

Return type:

FunctionCall | Variable

find_stmt(cs_list, suite)[source]#
Parameters:
  • cs_list (Any) –

  • suite (Any) –

findall_test(variable, suite)[source]#
Parameters:
forall_in_stmt(variables_cs_list, values_cs_list, suite)[source]#
Parameters:
  • variables_cs_list (Any) –

  • values_cs_list (Any) –

  • suite (Any) –

forall_in_test(cs_list, suite)[source]#
Parameters:
  • cs_list (Any) –

  • suite (Any) –

forall_stmt(cs_list, suite)[source]#
Parameters:
  • cs_list (Any) –

  • suite (Any) –

forall_test(cs_list, suite)[source]#
Parameters:
  • cs_list (Any) –

  • suite (Any) –

if_stmt(cond, suite, else_suite=None)[source]#
Parameters:
  • cond (Any) –

  • suite (Any) –

  • else_suite (Any | None) –

list(*values)[source]#
Parameters:

values (Any) –

local_assign_stmt(target, value=None)[source]#
Parameters:
  • target (str) –

  • value (Any) –

local_variable_guard()[source]#
mul_expr(*values)#
Parameters:

values (Any) –

not_test(value)[source]#
Parameters:

value (Any) –

Return type:

NotExpression

or_test(*values)[source]#
Parameters:

values (Any) –

Return type:

OrExpression

pass_stmt()[source]#
power(base, exp=None)[source]#

The highest-priority expression. This is used to capture the power expression, such as base ** exp. If exp is None, it is treated as base ** 1.

Parameters:
Return type:

FunctionCall | Variable

return_stmt(value)[source]#
Parameters:

value (Any) –

set_domain(domain)[source]#
Parameters:

domain (Domain) –

set_generator_impl_outputs(outputs)[source]#
Parameters:

outputs (List[Variable]) –

shift_expr(*values)#
Parameters:

values (Any) –

suite(*values)[source]#
Parameters:

values (Tree) –

Return type:

Suite

test(value)[source]#
Parameters:

value (Any) –

test_nocond(value)[source]#
Parameters:

value (Any) –

tuple(*values)[source]#
Parameters:

values (Any) –

unary_op_expr(op, value)[source]#
Parameters:
Return type:

FunctionCall

visit(tree)[source]#
Parameters:

tree (Any) –

Return type:

Any

visit_children(tree)#
Parameters:

tree (Tree[_Leaf_T]) –

Return type:

List

domain: Domain#
expression_def_ctx: ExpressionDefinitionContext#