concepts.dm.crow.parsers.cdl_parser.CDLExpressionInterpreter#

class CDLExpressionInterpreter[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

  • 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_colon()

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)

local_variable_guard()

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)

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[, 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:
__new__(**kwargs)#
achieve_hold_stmt(value)[source]#
Parameters:

value (CSList)

achieve_once_stmt(value)[source]#
Parameters:

value (CSList)

and_test(*values)[source]#
Parameters:

values (Any)

Return type:

AndExpression

annotated_assign_stmt(annotations, target, op, value)[source]#
Parameters:
annotated_compound_stmt(annotations, stmt)[source]#
Parameters:
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)

assert_hold_stmt(value)[source]#
Parameters:

value (Any)

assert_once_stmt(value)[source]#
Parameters:

value (Any)

assign_stmt(target, op, value)[source]#
Parameters:
assign_stmt_inner(op, target, value, annotations)[source]#
Parameters:
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:

FunctionCall | Variable

atom_colon()[source]#
atom_expr_do_funccall(name, annotations, args)[source]#
Parameters:
  • name (str)

  • annotations (dict)

  • args (Tree)

Return type:

CrowBehaviorCommit | CrowAchieveExpression | CrowUntrackExpression | CrowAssertExpression | CrowBindExpression | 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:
  • name (str)

  • annotations (dict)

  • args (Tree)

Return type:

FunctionApplicationExpression | CrowBehaviorCommit | CrowAchieveExpression | CrowUntrackExpression | CrowAssertExpression | CrowBindExpression | 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:
  • name (str)

  • annotations (dict)

  • index (Tree)

Return type:

FunctionApplicationExpression

atom_varname(name)[source]#

Captures variable names such as var_name.

Parameters:

name (str)

Return type:

VariableExpression | ObjectConstantExpression | ValueOutputExpression

batched_test(cs_list, suite)[source]#
Parameters:
bind_stmt(cs_list, suite)[source]#
Parameters:
bind_stmt_no_where(cs_list)[source]#

Captures bind statements without a body. For example:

bind x: int, y: int
Parameters:

cs_list (Any)

bitand_expr(*values)#
Parameters:

values (Any)

bitor_expr(*values)#
Parameters:

values (Any)

bitxor_expr(*values)#
Parameters:

values (Any)

commit_stmt(kwargs)[source]#
Parameters:

kwargs (dict)

comparison_expr(*values)[source]#
Parameters:

values (ValueOutputExpression | VariableExpression)

Return type:

ValueOutputExpression

compound_expr_stmt(value)[source]#
Parameters:

value (Tree)

cond_test(value1, cond, value2)[source]#
Parameters:
Return type:

ConditionExpression

cs_list(*values)[source]#
Parameters:

values (Any)

exists_in_test(cs_list, suite)[source]#
Parameters:
exists_test(cs_list, suite)[source]#
Parameters:
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

findall_test(variable, suite)[source]#
Parameters:
findone_test(variable, suite)[source]#
Parameters:
forall_in_test(cs_list, suite)[source]#
Parameters:
forall_test(cs_list, suite)[source]#
Parameters:
foreach_in_stmt(variables_cs_list, values_cs_list, suite)[source]#
Parameters:
  • variables_cs_list (Any)

  • values_cs_list (Any)

  • suite (Any)

Return type:

object

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

  • suite (Any)

  • else_suite (Any | None)

let_assign_stmt(target, dtype=None, value=None)[source]#
Parameters:
list(*values)[source]#
Parameters:

values (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

ordered_suite(ordering_op, body)[source]#
Parameters:
  • ordering_op (Any)

  • body (Any)

ordering_op(*ordering_op)[source]#
Parameters:

ordering_op (Any)

pachieve_hold_stmt(value)[source]#
Parameters:

value (CSList)

pachieve_once_stmt(value)[source]#
Parameters:

value (CSList)

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 (CrowDomain)

set_generator_impl_outputs(outputs)[source]#
Parameters:

outputs (List[Variable])

shift_expr(*values)#
Parameters:

values (Any)

suite(*values, activate_variable_guard=True)[source]#
Parameters:
  • values (Tree)

  • activate_variable_guard (bool)

Return type:

Suite

symbol_assign_stmt(target, value)[source]#
Parameters:
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:
untrack_stmt(value)[source]#
Parameters:

value (CSList)

visit(tree)[source]#
Parameters:

tree (Any)

Return type:

Any

visit_children(tree)#
Parameters:

tree (Tree[_Leaf_T])

Return type:

List

while_stmt(cond, suite)[source]#
Parameters:
domain: CrowDomain#
expression_def_ctx: ExpressionDefinitionContext#