concepts.dm.crow.parsers.cdl_parser.CDLExpressionInterpreter#
- class CDLExpressionInterpreter[source]#
Bases:
InterpreterThe 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
return_stmt
achieve_stmt
if_stmt
foreach_stmt
foreach_in_stmt
while_stmt
forall_test
exists_test
findall_test
forall_in_test
exists_in_test
Methods
achieve_hold_stmt(value)achieve_once_stmt(value)and_test(*values)annotated_assign_stmt(annotations, target, ...)annotated_compound_stmt(annotations, stmt)arguments(args)Captures the argument list.
arith_expr(*values)assert_hold_stmt(value)assert_once_stmt(value)assign_stmt(target, op, value)assign_stmt_inner(op, target, value, annotations)atom(value)Captures the atom.
atom_expr_do_funccall(name, annotations, args)atom_expr_funccall(name, annotations, args)Captures function calls, such as func_name(arg1, arg2, ...).
atom_subscript(name, annotations, index)Captures subscript expressions such as name[index1, index2, ...].
atom_varname(name)Captures variable names such as var_name.
batched_test(cs_list, suite)bind_stmt(cs_list, suite)bind_stmt_no_where(cs_list)Captures bind statements without a body.
bitand_expr(*values)bitor_expr(*values)bitxor_expr(*values)commit_stmt(kwargs)comparison_expr(*values)compound_expr_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)findall_test(variable, suite)findone_test(variable, suite)forall_in_test(cs_list, suite)forall_test(cs_list, suite)foreach_in_stmt(variables_cs_list, ...)foreach_stmt(cs_list, suite)if_stmt(cond, suite[, else_suite])let_assign_stmt(target[, dtype, value])list(*values)mem_query_stmt(expression)mul_expr(*values)not_test(value)or_test(*values)ordered_suite(ordering_op, body)ordering_op(*ordering_op)pachieve_hold_stmt(value)pachieve_once_stmt(value)power(base[, exp])The highest-priority expression.
return_stmt(value)set_domain(domain)set_generator_impl_outputs(outputs)shift_expr(*values)suite(*values[, activate_variable_guard])symbol_assign_stmt(target, value)test(value)test_nocond(value)tuple(*values)unary_op_expr(op, value)untrack_stmt(value)visit(tree)visit_children(tree)while_stmt(cond, suite)Attributes
- __init__(domain, state, expression_def_ctx, auto_constant_guess=False)[source]#
- Parameters:
domain (CrowDomain | None)
state (CrowState | 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 the atom. This is used in the base case of the expression, including literal constants, variables, and subscript expressions.
- Parameters:
value (FunctionCall | Variable)
- Return type:
- atom_expr_do_funccall(name, annotations, args)[source]#
- Parameters:
- Return type:
CrowBehaviorCommit | CrowAchieveExpression | CrowUntrackExpression | CrowAssertExpression | CrowBindExpression | CrowMemQueryExpression | CrowControllerApplicationExpression | CrowRuntimeAssignmentExpression | CrowFeatureAssignmentExpression | CrowBehaviorConditionSuite | CrowBehaviorWhileLoopSuite | CrowBehaviorForeachLoopSuite | CrowBehaviorOrderingSuite | CrowBehaviorApplicationExpression
- atom_expr_funccall(name, annotations, args)[source]#
Captures function calls, such as func_name(arg1, arg2, …).
- Parameters:
- Return type:
FunctionApplicationExpression | CrowBehaviorCommit | CrowAchieveExpression | CrowUntrackExpression | CrowAssertExpression | CrowBindExpression | CrowMemQueryExpression | CrowControllerApplicationExpression | CrowRuntimeAssignmentExpression | CrowFeatureAssignmentExpression | CrowBehaviorConditionSuite | CrowBehaviorWhileLoopSuite | CrowBehaviorForeachLoopSuite | CrowBehaviorOrderingSuite | CrowBehaviorApplicationExpression | CrowBehaviorApplicationExpression | CrowGeneratorApplicationExpression
- atom_subscript(name, annotations, index)[source]#
Captures subscript expressions such as name[index1, index2, …].
- Parameters:
- Return type:
- atom_varname(name)[source]#
Captures variable names such as var_name.
- Parameters:
name (str)
- Return type:
VariableExpression | ObjectConstantExpression | ValueOutputExpression
- bind_stmt_no_where(cs_list)[source]#
Captures bind statements without a body. For example:
bind x: int, y: int
- Parameters:
cs_list (Any)
- 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 (FunctionCall | Variable | None)
- Return type:
- set_domain(domain)[source]#
- Parameters:
domain (CrowDomain)
- unary_op_expr(op, value)[source]#
- Parameters:
op (str)
value (FunctionCall | Variable)
- domain: CrowDomain#
- expression_def_ctx: ExpressionDefinitionContext#