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])mul_expr
(*values)not_test
(value)or_test
(*values)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
- __init__(domain, state, expression_def_ctx, auto_constant_guess=False)[source]#
- Parameters:
domain (Domain | None) –
state (State | None) –
expression_def_ctx (ExpressionDefinitionContext) –
auto_constant_guess (bool) –
- __new__(**kwargs)#
- arguments(args)[source]#
Captures the argument list. This is used in function calls.
- Parameters:
args (Tree) –
- Return type:
- 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:
- atom_expr_funccall(annotations, name, args)[source]#
Captures function calls, such as func_name(arg1, arg2, …).
- 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
- comparison_expr(*values)[source]#
- Parameters:
values (ValueOutputExpression | VariableExpression) –
- Return type:
- factor(value)[source]#
- Parameters:
value (FunctionCall | Variable) –
- Return type:
- 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:
base (FunctionCall | Variable) –
exp (float | None) –
- Return type:
- unary_op_expr(op, value)[source]#
- Parameters:
op (str) –
value (FunctionCall | Variable) –
- Return type:
- expression_def_ctx: ExpressionDefinitionContext#