dace.frontend.octave package

Submodules

dace.frontend.octave.ast_arrayaccess module

class dace.frontend.octave.ast_arrayaccess.AST_ArrayAccess(context, arrayname, accdims)

Bases: AST_Node

generate_code(sdfg, state)
get_basetype()
get_children()
get_dims()
is_data_dependent_access()
make_range_from_accdims()
replace_child(old, new)

dace.frontend.octave.ast_assign module

class dace.frontend.octave.ast_assign.AST_Assign(context, lhs, rhs, op)

Bases: AST_Node

defined_variables()
generate_code(sdfg, state)
get_children()
print_nodes(state)
provide_parents(parent)
replace_child(old, new)

dace.frontend.octave.ast_expression module

class dace.frontend.octave.ast_expression.AST_BinExpression(context, lhs, rhs, op)

Bases: AST_Node

generate_code(sdfg, state)
get_basetype()
get_children()
get_dims()
matrix2d_matrix2d_mult(sdfg, state)
matrix2d_matrix2d_plus_or_minus(sdfg, state, op)
matrix2d_scalar(sdfg, state, op)
provide_parents(parent)
replace_child(old, new)
scalar_scalar(sdfg, state, op)
vec_mult_vect(sdfg, state, op)
class dace.frontend.octave.ast_expression.AST_UnaryExpression(context, arg, op, order)

Bases: AST_Node

get_children()
replace_child(old, new)
specialize()

Some nodes can be simplified after parsing the complete AST and before actually generating code, i.e., AST_FunCall nodes could be function calls or array accesses, and we don’t really know unless we know the context of the call.

This function traverses the AST and tries to specialize nodes after completing the AST. It should be called on the top-level AST_Statements node, and a node that wants to be specialized should return its new instance. If no specialzation should take place, it should return None.

dace.frontend.octave.ast_function module

class dace.frontend.octave.ast_function.AST_Argument(context, name, default=None)

Bases: AST_Node

get_children()
class dace.frontend.octave.ast_function.AST_BuiltInFunCall(context, funname, args)

Bases: AST_Node

generate_code(sdfg, state)
get_basetype()
get_children()
get_dims()
replace_child(old, new)
specialize()

Some nodes can be simplified after parsing the complete AST and before actually generating code, i.e., AST_FunCall nodes could be function calls or array accesses, and we don’t really know unless we know the context of the call.

This function traverses the AST and tries to specialize nodes after completing the AST. It should be called on the top-level AST_Statements node, and a node that wants to be specialized should return its new instance. If no specialzation should take place, it should return None.

class dace.frontend.octave.ast_function.AST_EndFunc(context)

Bases: AST_Node

generate_code(sdfg, state)
get_children()
replace_child(old, new)
class dace.frontend.octave.ast_function.AST_FunCall(context, funname, args)

Bases: AST_Node

get_children()
replace_child(old, new)
specialize()

Some nodes can be simplified after parsing the complete AST and before actually generating code, i.e., AST_FunCall nodes could be function calls or array accesses, and we don’t really know unless we know the context of the call.

This function traverses the AST and tries to specialize nodes after completing the AST. It should be called on the top-level AST_Statements node, and a node that wants to be specialized should return its new instance. If no specialzation should take place, it should return None.

class dace.frontend.octave.ast_function.AST_Function(context, name, args, retvals)

Bases: AST_Node

generate_code(sdfg, state)
get_children()
replace_child(old, new)
set_statements(stmtlist)

dace.frontend.octave.ast_loop module

class dace.frontend.octave.ast_loop.AST_ForLoop(context, var, initializer, stmts)

Bases: AST_Node

generate_code(sdfg, state)
generate_code_proper(sdfg, state)
get_children()
replace_child(old, new)

dace.frontend.octave.ast_matrix module

class dace.frontend.octave.ast_matrix.AST_Matrix(context, rows)

Bases: AST_Node

generate_code(sdfg, state)
get_basetype()
get_children()
get_dims()
get_values_row_major()
is_constant()
provide_parents(parent)
replace_child(old, new)
class dace.frontend.octave.ast_matrix.AST_Matrix_Row(context, elements)

Bases: AST_Node

get_children()
get_dims()
is_constant()
provide_parents(parent)
replace_child(old, new)
class dace.frontend.octave.ast_matrix.AST_Transpose(context, arg, op)

Bases: AST_Node

generate_code(sdfg, state)
get_basetype()
get_children()
get_dims()
replace_child(old, new)

dace.frontend.octave.ast_node module

class dace.frontend.octave.ast_node.AST_Node(context)

Bases: object

defined_variables()
find_data_node_in_sdfg_state(sdfg, state, nodename=None)
generate_code(*args)
get_children()
get_datanode(sdfg, state)
get_initializers(sdfg)
get_name_in_sdfg(sdfg)

If this node has no name assigned yet, create a new one of the form __tmp_X where X is an integer, such that this node does not yet exist in the given SDFG.

Note:

We assume that we create exactly one SDFG from each AST, otherwise we need to store the hash of the SDFG the name was created for (would be easy but seems useless at this point).

get_new_tmpvar(sdfg)
get_parent()
print_as_tree()
provide_parents(parent)
replace_child(old, new)
replace_parent(newparent)
search_vardef_in_scope(name)
shortdesc()
specialize()

Some nodes can be simplified after parsing the complete AST and before actually generating code, i.e., AST_FunCall nodes could be function calls or array accesses, and we don’t really know unless we know the context of the call.

This function traverses the AST and tries to specialize nodes after completing the AST. It should be called on the top-level AST_Statements node, and a node that wants to be specialized should return its new instance. If no specialzation should take place, it should return None.

class dace.frontend.octave.ast_node.AST_Statements(context, stmts)

Bases: AST_Node

append_statement(stmt)
generate_code(sdfg=None, state=None)
get_children()
provide_parents(parent=None)
replace_child(old, new)
specialize()

Some nodes can be simplified after parsing the complete AST and before actually generating code, i.e., AST_FunCall nodes could be function calls or array accesses, and we don’t really know unless we know the context of the call.

This function traverses the AST and tries to specialize nodes after completing the AST. It should be called on the top-level AST_Statements node, and a node that wants to be specialized should return its new instance. If no specialzation should take place, it should return None.

dace.frontend.octave.ast_nullstmt module

class dace.frontend.octave.ast_nullstmt.AST_Comment(context, text)

Bases: AST_Node

generate_code(sdfg, state)
get_children()
replace_child(old, new)
class dace.frontend.octave.ast_nullstmt.AST_EndStmt(context)

Bases: AST_Node

get_children()
replace_child(old, new)
class dace.frontend.octave.ast_nullstmt.AST_NullStmt(context)

Bases: AST_Node

generate_code(sdfg, state)
get_children()
replace_child(old, new)

dace.frontend.octave.ast_range module

class dace.frontend.octave.ast_range.AST_RangeExpression(context, lhs, rhs)

Bases: AST_Node

generate_code(sdfg, state)
get_basetype()
get_children()
get_dims()
replace_child(old, new)
specialize()

Some nodes can be simplified after parsing the complete AST and before actually generating code, i.e., AST_FunCall nodes could be function calls or array accesses, and we don’t really know unless we know the context of the call.

This function traverses the AST and tries to specialize nodes after completing the AST. It should be called on the top-level AST_Statements node, and a node that wants to be specialized should return its new instance. If no specialzation should take place, it should return None.

dace.frontend.octave.ast_values module

class dace.frontend.octave.ast_values.AST_Constant(context, value)

Bases: AST_Node

generate_code(sdfg, state)
get_basetype()
get_children()
get_dims()
get_value()
is_constant()
replace_child(old, new)
class dace.frontend.octave.ast_values.AST_Ident(context, value)

Bases: AST_Node

generate_code(sdfg, state)
get_basetype()

Check in the scope if this is defined and return the basetype of the corresponding SDFG access node this currently maps to.

get_children()
get_dims()
get_name()
get_name_in_sdfg(sdfg)

If this node has no name assigned yet, create a new one of the form __tmp_X where X is an integer, such that this node does not yet exist in the given SDFG.

Note:

We assume that we create exactly one SDFG from each AST, otherwise we need to store the hash of the SDFG the name was created for (would be easy but seems useless at this point).

get_propagated_value()
is_constant()
replace_child(old, new)
specialize()

Some nodes can be simplified after parsing the complete AST and before actually generating code, i.e., AST_FunCall nodes could be function calls or array accesses, and we don’t really know unless we know the context of the call.

This function traverses the AST and tries to specialize nodes after completing the AST. It should be called on the top-level AST_Statements node, and a node that wants to be specialized should return its new instance. If no specialzation should take place, it should return None.

dace.frontend.octave.lexer module

dace.frontend.octave.lexer.main()
dace.frontend.octave.lexer.new()
dace.frontend.octave.lexer.raise_exception(error_type, message, my_lexer)

dace.frontend.octave.parse module

dace.frontend.octave.parse.p_arg1(p)

arg1 : IDENT

dace.frontend.octave.parse.p_arg2(p)
arg1NUMBER
STRING
dace.frontend.octave.parse.p_arg_list(p)
arg_listident_init_opt
arg_list COMMA ident_init_opt
dace.frontend.octave.parse.p_args(p)
argsarg1
args arg1
dace.frontend.octave.parse.p_break_stmt(p)

break_stmt : BREAK SEMI

dace.frontend.octave.parse.p_case_list(p)
case_list :
CASE expr sep stmt_list_opt case_list
CASE expr error stmt_list_opt case_list
OTHERWISE stmt_list
dace.frontend.octave.parse.p_cellarray(p)
cellarrayLBRACE RBRACE
LBRACE matrix_row RBRACE
LBRACE matrix_row SEMI RBRACE
dace.frontend.octave.parse.p_cellarray_2(p)

cellarray : LBRACE expr_list RBRACE

dace.frontend.octave.parse.p_cellarrayref(p)

expr : expr LBRACE expr_list RBRACE | expr LBRACE RBRACE

dace.frontend.octave.parse.p_command(p)

command : ident args SEMI

dace.frontend.octave.parse.p_comment_stmt(p)

comment_stmt : COMMENT

dace.frontend.octave.parse.p_concat_list1(p)

matrix_row : expr_list SEMI expr_list

dace.frontend.octave.parse.p_concat_list2(p)

matrix_row : matrix_row SEMI expr_list

dace.frontend.octave.parse.p_continue_stmt(p)

continue_stmt : CONTINUE SEMI

dace.frontend.octave.parse.p_elseif_stmt(p)
elseif_stmt :
ELSE stmt_list_opt
ELSEIF expr sep stmt_list_opt elseif_stmt
ELSEIF LPAREN expr RPAREN stmt_list_opt elseif_stmt
dace.frontend.octave.parse.p_end(p)

top : top END_STMT

dace.frontend.octave.parse.p_end_function(p)

top : top END_FUNCTION

dace.frontend.octave.parse.p_error(p)
dace.frontend.octave.parse.p_error_stmt(p)

error_stmt : ERROR_STMT SEMI

dace.frontend.octave.parse.p_expr(p)

expr : ident | end | number | string | colon | NEG | matrix | cellarray | expr2 | expr1 | lambda_expr

dace.frontend.octave.parse.p_expr1(p)

expr1 : MINUS expr %prec UMINUS | PLUS expr %prec UMINUS | NEG expr | HANDLE ident | PLUSPLUS ident | MINUSMINUS ident

dace.frontend.octave.parse.p_expr2(p)

expr2 : expr AND expr | expr ANDAND expr | expr BACKSLASH expr | expr COLON expr | expr DIV expr | expr DOT expr | expr DOTDIV expr | expr DOTDIVEQ expr | expr DOTEXP expr | expr DOTMUL expr | expr DOTMULEQ expr | expr EQEQ expr | expr POW expr | expr EXP expr | expr EXPEQ expr | expr GE expr | expr GT expr | expr LE expr | expr LT expr | expr MINUS expr | expr MUL expr | expr NE expr | expr OR expr | expr OROR expr | expr PLUS expr | expr EQ expr | expr MULEQ expr | expr DIVEQ expr | expr MINUSEQ expr | expr PLUSEQ expr | expr OREQ expr | expr ANDEQ expr

dace.frontend.octave.parse.p_expr_2(p)

expr : expr PLUSPLUS | expr MINUSMINUS

dace.frontend.octave.parse.p_expr_colon(p)

colon : COLON

dace.frontend.octave.parse.p_expr_end(p)

end : END_EXPR

dace.frontend.octave.parse.p_expr_ident(p)

ident : IDENT

dace.frontend.octave.parse.p_expr_list(p)
expr_listexprs
exprs COMMA
dace.frontend.octave.parse.p_expr_number(p)

number : NUMBER

dace.frontend.octave.parse.p_expr_stmt(p)

expr_stmt : expr_list SEMI

dace.frontend.octave.parse.p_expr_string(p)

string : STRING

dace.frontend.octave.parse.p_exprs(p)
exprsexpr
exprs COMMA expr
dace.frontend.octave.parse.p_field_expr(p)

expr : expr FIELD

dace.frontend.octave.parse.p_foo_stmt(p)

foo_stmt : expr OROR expr SEMI

dace.frontend.octave.parse.p_for_stmt(p)
for_stmtFOR ident EQ expr SEMI stmt_list END_STMT
FOR LPAREN ident EQ expr RPAREN SEMI stmt_list END_STMT
FOR matrix EQ expr SEMI stmt_list END_STMT
dace.frontend.octave.parse.p_func_stmt(p)

func_stmt : FUNCTION ident lambda_args SEMI | FUNCTION ret EQ ident lambda_args SEMI

dace.frontend.octave.parse.p_funcall_expr(p)

expr : expr LPAREN expr_list RPAREN | expr LPAREN RPAREN

dace.frontend.octave.parse.p_global(p)

arg1 : GLOBAL

dace.frontend.octave.parse.p_global_list(p)

global_list : ident | global_list ident

dace.frontend.octave.parse.p_global_stmt(p)
global_stmtGLOBAL global_list SEMI
GLOBAL ident EQ expr SEMI
dace.frontend.octave.parse.p_ident_init_opt(p)
ident_init_optNEG
ident
ident EQ expr
dace.frontend.octave.parse.p_if_stmt(p)
if_stmtIF expr sep stmt_list_opt elseif_stmt END_STMT
IF LPAREN expr RPAREN stmt_list_opt elseif_stmt END_STMT
dace.frontend.octave.parse.p_lambda_args(p)

lambda_args : LPAREN RPAREN | LPAREN arg_list RPAREN

dace.frontend.octave.parse.p_lambda_expr(p)

lambda_expr : HANDLE lambda_args expr

dace.frontend.octave.parse.p_matrix(p)

matrix : LBRACKET RBRACKET | LBRACKET matrix_row RBRACKET | LBRACKET matrix_row SEMI RBRACKET

dace.frontend.octave.parse.p_matrix_2(p)

matrix : LBRACKET expr_list RBRACKET | LBRACKET expr_list SEMI RBRACKET

dace.frontend.octave.parse.p_null_stmt(p)
null_stmtSEMI
COMMA
dace.frontend.octave.parse.p_parens_expr(p)

expr : LPAREN expr RPAREN

dace.frontend.octave.parse.p_persistent_stmt(p)
persistent_stmtPERSISTENT global_list SEMI
PERSISTENT ident EQ expr SEMI
dace.frontend.octave.parse.p_ret(p)
retident
LBRACKET RBRACKET
LBRACKET expr_list RBRACKET
dace.frontend.octave.parse.p_return_stmt(p)

return_stmt : RETURN SEMI

dace.frontend.octave.parse.p_semi_opt(p)
semi_opt :
semi_opt SEMI
semi_opt COMMA
dace.frontend.octave.parse.p_separator(p)
sepCOMMA
SEMI
dace.frontend.octave.parse.p_stmt(p)
stmtcontinue_stmt
comment_stmt
func_stmt
break_stmt
expr_stmt
global_stmt
persistent_stmt
error_stmt
command
for_stmt
if_stmt
null_stmt
return_stmt
switch_stmt
try_catch
while_stmt
foo_stmt
unwind
dace.frontend.octave.parse.p_stmt_list(p)
stmt_liststmt
stmt_list stmt
dace.frontend.octave.parse.p_stmt_list_opt(p)
stmt_list_opt :
stmt_list
dace.frontend.octave.parse.p_switch_stmt(p)

switch_stmt : SWITCH expr semi_opt case_list END_STMT

dace.frontend.octave.parse.p_top(p)
top :
top stmt
dace.frontend.octave.parse.p_transpose_expr(p)

expr : expr TRANSPOSE

dace.frontend.octave.parse.p_try_catch(p)

try_catch : TRY stmt_list CATCH stmt_list END_STMT

dace.frontend.octave.parse.p_unwind(p)

unwind : UNWIND_PROTECT stmt_list UNWIND_PROTECT_CLEANUP stmt_list END_UNWIND_PROTECT

dace.frontend.octave.parse.p_while_stmt(p)

while_stmt : WHILE expr SEMI stmt_list END_STMT

dace.frontend.octave.parse.parse(buf, debug=False)

dace.frontend.octave.parsetab module

Module contents