class STRANS
****
The context for a code transformation from AS form to AM form. we redefine err, such that it gives a little bit more information


Flattened version is here

Ancestors
CS_COMPONENT

Descendants
PTRANS TRANS



Public


Readable Attributes
attr active_locals:FLIST{AM_LOCAL_EXPR};
**** Locals in scope. a "post" clause (and so can have initial expressions). `else' clause.
attr cur_loop:AM_LOOP_STMT;
**** Current loop if any. a "post" clause (and so can have initial expressions). `else' clause.
attr cur_rout:AM_ROUT_DEF;
**** The current routine or iter.
attr cur_se:SE_CONTEXT;
**** set of side_effects for this translation
attr cur_yield_ind:INT;
**** Index of the current yield. a "post" clause (and so can have initial expressions). `else' clause.
attr ex_tp:$TP;
**** Type of exception expr. initialization expression.
attr impl:IMPL;
**** The implementation structure for the type within which this transformation appears. type specifiers.
attr in_constant:BOOL;
**** True if inside a constant or shared initialization expression.
attr in_external:BOOL;
**** True if inside an external class. initialization expression.
attr in_initial:BOOL;
**** True if inside an `initial' expr. initialization expression.
attr in_invariant:BOOL;
**** True if inside an invariant body. initialization expression.
attr in_post:BOOL;
**** True if this code is inside a "post" clause (and so can have initial expressions). `else' clause.
attr in_pre:BOOL;
**** True if inside a `pre' clause. a "post" clause (and so can have initial expressions). `else' clause.
attr in_protect_body:BOOL;
**** True if inside a `protect' body. `else' clause.
attr in_protect_but_not_loop:BOOL;
**** True if inside a `protect', but not inside a `loop'. initialization expression.
attr in_protect_then:BOOL;
**** True if inside a `protect' `then' or `else' clause.
attr init_stmts:$AM_STMT;
**** The initial statments if any. initialization expression.
attr inv_stmt:AM_INVARIANT_STMT;
attr
attr tp_con:TP_CONTEXT;
**** The type context for interpreting type specifiers.

Writable Attributes
attr active_locals:FLIST{AM_LOCAL_EXPR};
**** Locals in scope. a "post" clause (and so can have initial expressions). `else' clause.
attr cur_loop:AM_LOOP_STMT;
**** Current loop if any. a "post" clause (and so can have initial expressions). `else' clause.
attr cur_rout:AM_ROUT_DEF;
**** The current routine or iter.
attr cur_se:SE_CONTEXT;
**** set of side_effects for this translation
attr cur_yield_ind:INT;
**** Index of the current yield. a "post" clause (and so can have initial expressions). `else' clause.
attr ex_tp:$TP;
**** Type of exception expr. initialization expression.
attr impl:IMPL;
**** The implementation structure for the type within which this transformation appears. type specifiers.
attr in_constant:BOOL;
**** True if inside a constant or shared initialization expression.
attr in_external:BOOL;
**** True if inside an external class. initialization expression.
attr in_initial:BOOL;
**** True if inside an `initial' expr. initialization expression.
attr in_invariant:BOOL;
**** True if inside an invariant body. initialization expression.
attr in_post:BOOL;
**** True if this code is inside a "post" clause (and so can have initial expressions). `else' clause.
attr in_pre:BOOL;
**** True if inside a `pre' clause. a "post" clause (and so can have initial expressions). `else' clause.
attr in_protect_body:BOOL;
**** True if inside a `protect' body. `else' clause.
attr in_protect_but_not_loop:BOOL;
**** True if inside a `protect', but not inside a `loop'. initialization expression.
attr in_protect_then:BOOL;
**** True if inside a `protect' `then' or `else' clause.
attr init_stmts:$AM_STMT;
**** The initial statments if any. initialization expression.
attr inv_stmt:AM_INVARIANT_STMT;
attr
attr tp_con:TP_CONTEXT;
**** The type context for interpreting type specifiers.

Features
add_local(l:AM_LOCAL_EXPR)
**** Add the local variable `l'.
and_context_err(e:AS_AND_EXPR, tp:$TP)
array_tp_void_err(e:AS_ARRAY_EXPR)
array_wrong_tp_err(e:AS_ARRAY_EXPR, tp:$TP)
bnd_iter_call_const_err
bnd_iter_call_in_once_err(i:INT)
bnd_iter_call_out_of_loop_err
bnd_rout_call_const_err
bool_lit_context_err(e:AS_BOOL_LIT_EXPR, tp:$TP)
bound_create_bnd_args(nbnd:INT,e:AS_BOUND_CREATE_EXPR):ARRAY{INT}
**** An array of the indices of arguments which are bound up in order. 0 is self. `nbnd' is the number of bound args.
bound_create_context_err(e:AS_BOUND_CREATE_EXPR, stp,tp:$TP)
bound_create_in_const_err(e:AS_BOUND_CREATE_EXPR)
bound_create_iter_err(e:AS_BOUND_CREATE_EXPR)
bound_create_iter_in_once_err(a:$AS_EXPR)
bound_create_not_iter_err(e:AS_BOUND_CREATE_EXPR)
bound_create_num_bnd(self_val:$AM_EXPR, e:AS_BOUND_CREATE_EXPR):INT
**** The number of argument which are bound up (including self).
bound_create_self(e:AS_BOUND_CREATE_EXPR):TUP{$AM_EXPR,$TP}
**** Return an expression for self and the type of self for the bound create expression `e'. If `t1' is void, then it is a call on underscore, or an error!.
bound_create_self_array_err(e:AS_BOUND_CREATE_EXPR)
bound_create_self_create_err(e:AS_BOUND_CREATE_EXPR)
bound_create_self_has_iter_err(e:AS_BOUND_CREATE_EXPR)
bound_create_self_local_err(e:AS_BOUND_CREATE_EXPR)
bound_create_self_void_err(e:AS_BOUND_CREATE_EXPR)
bound_create_set_tp(r:AM_BND_CREATE_EXPR)
**** Set the type in `r', assuming everything else is there (incl. mode)
bound_create_sig(e:AS_BOUND_CREATE_EXPR, self_tp:$TP, ctp:$TP):SIG
**** The signature of the call represented by `e' where the type of self has been determined to be `self_tp'. If self_tp is void, self is untyped '_' and we need to figure out the type from the context. ctp is the type context. Void if there is a problem.
bound_create_unbnd_args(nbnd:INT,e:AS_BOUND_CREATE_EXPR):ARRAY{INT}
**** An array of the indices of arguments which are not bound in order. 0 is self. `nbnd' is the number of bound args.
break_not_in_loop_err(s:AS_EXPR_STMT)
call_check_out_args(as_call:AS_CALL_EXPR)
call_const_err(e:AS_CALL_EXPR)
call_context_err(e:AS_CALL_EXPR, stp,tp:$TP)
call_expr_check_local(e:AS_CALL_EXPR,tp:$TP):AM_LOCAL_EXPR
**** Check if the call `e' is a local variable reference. If it is return the local.
call_expr_get_sig(e:AS_CALL_EXPR, call_sig:CALL_SIG,
call_expr_rout_name(e:AS_CALL_EXPR):IDENT
**** The name of the routine being called.
call_fix_bnd_iter(bir:AM_BND_ITER_CALL_EXPR,
call_fix_iter(ir:AM_ITER_CALL_EXPR):AM_ITER_CALL_EXPR
**** Move the once args out in the iter call `ir'.
call_fix_out_args(cr:$AM_CALL_EXPR): $AM_EXPR
**** attributes and array elements passed as out and inout parameters need very special treatment. First, they must be evaluated into a temporary (reader, aget), a temporary is passed as out/inout, then they are set (writer, aset)
call_local_context_err(e:AS_CALL_EXPR, stp,tp:$TP)
call_need_fix_out_args(cr:$AM_CALL_EXPR): BOOL
**** attributes and array elements passed as out and inout parameters need very special treatment. The same goes for attributes. Return true is these are present
call_self(e:AS_CALL_EXPR):TUP{$AM_EXPR,$TP}
**** Return an expression for self and the type of self for the call `e'.
call_self_array_err(e:AS_CALL_EXPR)
call_self_create_err(e:AS_CALL_EXPR)
call_self_underscore_err(e:AS_CALL_EXPR)
call_self_void_err(e:AS_CALL_EXPR)
call_tp_of_expr(e:$AS_EXPR):$CALL_TP
**** Returns the call type of an expression, if it is one of the special cases. Otherwise it returns void. (To get the actual type, you have to do `transform_expr'.
char_lit_context_err(e:AS_CHAR_LIT_EXPR, tp:$TP)
check_pSather_stmt_for_return(as:$AS_STMT)
check_return(t:AS_ROUT_DEF)
**** Check the routine `t' to make sure that if it has a return value, then the last statement actually returns a value. If not, then print an error.
check_stmt_list_for_return(l:AS_STMT_LIST)
**** `l' must either be a return statement, a raise statement or terminate in one. If not, print an error.
cluster_context_err(e:AS_CLUSTER_EXPR, tp:$TP)
cluster_size_context_err(e:AS_CLUSTER_SIZE_EXPR, tp:$TP)
contains_iter_call(e:$AM_EXPR):BOOL
**** True if `e' contains an iter call. This is used to check for iter calls in the expressions for once iter arguments.
create(e:ELT):SAME
**** Create a new transformation context for the element e.
create_bad_return_type_err(e:AS_CREATE_EXPR, rt,at:$TP)
create_const_err(e:AS_CREATE_EXPR)
create_context_err(e:AS_CREATE_EXPR, stp,tp:$TP)
create_tp_spec_err(e:AS_CREATE_EXPR)
err(s:STR)
except_const_err(e:AS_EXCEPT_EXPR)
except_context_err(e:AS_EXCEPT_EXPR, stp,tp:$TP)
except_loc_err(e:AS_EXCEPT_EXPR)
expr_stmt_err(s:AS_EXPR_STMT)
ext_call_const_err(e:AS_CALL_EXPR)
extra_return_value_err(s:AS_RETURN_STMT, sig:SIG)
extra_yield_value_err(s:AS_YIELD_STMT, sig:SIG)
gen:GENERATE_AM
**** The GENERATE_AM object controlling translation.
initial_context_err(e:AS_INITIAL_EXPR, stp,tp:$TP)
initial_out_of_post_err(e:AS_INITIAL_EXPR)
is_aget_sig(s:SIG):BOOL
**** True if `s' is`aget'
is_in_lock:BOOL
is_in_par_or_fork:BOOL
is_iter:BOOL
**** True if we are working on an iter.
iter_call_const_err
iter_call_in_once_arg_err(i:INT)
iter_call_out_of_loop_err
iter_in_protect_err(e:AS_CALL_EXPR)
local_with_name(n:IDENT):AM_LOCAL_EXPR
**** The local with the name `n', if any. Void otherwise.
missing_return_value_err(s:AS_RETURN_STMT, tp:$TP)
missing_yield_value_err(s:AS_YIELD_STMT, tp:$TP)
name_for_ext(el:ELT):IDENT
**** Name to use for an external class call.
nested_initial_err(e:AS_INITIAL_EXPR)
new_arg_no_array_err(e:AS_NEW_EXPR)
new_const_err(e:AS_NEW_EXPR)
new_context_err(e:AS_NEW_EXPR, stp,tp:$TP)
new_in_non_ref_or_part_err(e:AS_NEW_EXPR)
new_no_arg_array_err(e:AS_NEW_EXPR)
or_context_err(e:AS_OR_EXPR, tp:$TP)
quit_in_par_fork_err(s:AS_QUIT_STMT)
quit_in_rout_err(s:AS_QUIT_STMT)
result_and_no_return_err(e:AS_RESULT_EXPR)
result_context_err(e:AS_RESULT_EXPR, stp,tp:$TP)
result_in_initial_err(e:AS_RESULT_EXPR)
result_out_of_post_err(e:AS_RESULT_EXPR)
return_err
return_in_iter_err(s:AS_RETURN_STMT)
return_in_par_fork_err(s:AS_RETURN_STMT)
self_const_err(e:AS_SELF_EXPR)
self_context_err(e:AS_SELF_EXPR, stp,tp:$TP)
special_inline(call:AM_ITER_CALL_EXPR):$AM_EXPR
**** Here we deal only with special purpose inlining general purpose inlining is done during the optimization phase If `call' can be inlined, return the inlining expression, otherwise just return it.
special_inline(call:AM_ROUT_CALL_EXPR):$AM_EXPR
**** Here we deal only with special purpose inlining general purpose inlining is done during the optimization phase If `call' can be inlined, return the inlining expression, otherwise just return it.
stmts_after_quit_err(s:AS_QUIT_STMT)
stmts_after_raise_err(s:AS_RAISE_STMT)
stmts_after_return_err(s:AS_RETURN_STMT)
str_lit_context_err(e:AS_STR_LIT_EXPR, tp:$TP)
sys_closure_nest(ncs:$AM_EXPR)
sys_closure_self(sig:SIG)
tp_of(t:AS_TYPE_SPEC):$TP
**** The type object corresponding to the type specifier `t' in this context.
transform_and_expr(e:AS_AND_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_array_assign_stmt(l:AS_CALL_EXPR,s:AS_ASSIGN_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'. This is an assignment to the call expression `l' which has `is_array' equal to true. So we know it is one of the forms: "[a,b,c]:=d" or "e[a,b,c]:=d" and should become "aset(a,b,c,d)" or "e.aset(a,b,c,d)". We change the call object by giving it the name "aset" adding on the righthand side as an extra argument, transform it and then change it back.
transform_array_expr(e:AS_ARRAY_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_assert_stmt(s:AS_ASSERT_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_assign_dec_stmt(s:AS_ASSIGN_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'. This is an assignment which declares a local variable and assigns to it.
transform_assign_stmt(s:AS_ASSIGN_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_attr_elt(e:ELT,as:AS_ATTR_DEF):AM_ROUT_DEF
**** Transform the element `e' into AM form.
transform_bool_lit_expr(e:AS_BOOL_LIT_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_bound_create_expr(e:AS_BOUND_CREATE_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_break_expr(e:AS_BREAK_EXPR, tp:$TP):$AM_EXPR
**** Break's must always be handled in expression statements. If we get here, something's wrong.
transform_call_assign_stmt(l:AS_CALL_EXPR,s:AS_ASSIGN_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'. This is an assignment to the call expression `l' which has `is_array' equal to false. "a(5):=foo", "x.a(5):=foo", or "A::a(5):=foo"
transform_call_expr(e:AS_CALL_EXPR, tp:$TP, has_ret:BOOL):$AM_EXPR
**** Expression implementing `e' in type context `tp'. `has_ret' says whether the return value is used.
transform_case_stmt(s:AS_CASE_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_case_when(s:AS_CASE_STMT, cw:AS_CASE_WHEN,
transform_char_lit_expr(e:AS_CHAR_LIT_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_cluster_expr(e:AS_CLUSTER_EXPR, tp:$TP):$AM_EXPR
**** Although clusters belongs to pSather it is translated in serial Sather as well.
transform_cluster_size_expr(e:AS_CLUSTER_SIZE_EXPR, tp:$TP):$AM_EXPR
transform_const_elt(e:ELT,as:AS_CONST_DEF):AM_ROUT_DEF
**** Transform the element `e' into AM form.
transform_create_expr(e:AS_CREATE_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_dec_stmt(s:AS_DEC_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_elt(e:ELT):AM_ROUT_DEF
**** Transform the element `e' into AM form. Ignores self. Should not be applied to void. If there is a problem, returns void.
transform_except_expr(e:AS_EXCEPT_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_expr(e:$AS_EXPR, tp:$TP):$AM_EXPR
**** Return an expression which evaluates `e'. If `tp' is not void then use it as the inferred type. Print an error message if if is not a supertype of the expression type. In this case return void. If `tp' is void then the expression must determine its own type.
transform_expr_stmt(s:AS_EXPR_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_flt_lit_expr(e:AS_FLT_LIT_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_if_stmt(s:AS_IF_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_initial_expr(e:AS_INITIAL_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'. Append initialization code to `init_stmts'.
transform_int_lit_expr(e:AS_INT_LIT_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_is_void_expr(e:AS_IS_VOID_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_local_assign_stmt(loc:AM_LOCAL_EXPR, s:AS_ASSIGN_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source assignment `s'. At this point we know it is an assignment to the local variable `loc'.
transform_loop_stmt(s:AS_LOOP_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_new_expr(e:AS_NEW_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_or_expr(e:AS_OR_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_pSather_assign_stmt_err(as:AS_ASSIGN_STMT)
****
___transform_pSather_protect_when_stuff(tp:$TP,wp:AS_PROTECT_WHEN,
______as:AS_PROTECT_STMT)_is_end;
___transform_pSather_protect_else_stuff(as:AS_PROTECT_STMT)_is_end;
transform_pSather_expr(e:$AS_EXPR, tp:$TP):$AM_EXPR
transform_pSather_local_assign(loc:AM_LOCAL_EXPR,s:AS_ASSIGN_STMT)
transform_pSather_rout_elt_stuff(as:AS_ROUT_DEF)
transform_pSather_stmt(as:$AS_STMT):$AM_STMT
transform_protect_stmt(s:AS_PROTECT_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'. Since registers are restored after a longjump, we have to make sure that no local variables which could have been changed in the protect and are used later are held in registers. We are a bit conservative here and make any locals which are assigned to in the protect body be volatile.
transform_quit_stmt(s:AS_QUIT_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_raise_stmt(s:AS_RAISE_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_result_expr(e:AS_RESULT_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_return_stmt(s:AS_RETURN_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_rout_elt(e:ELT,as:AS_ROUT_DEF):AM_ROUT_DEF
**** Transform the element `e' into AM form.
transform_self_expr(e:AS_SELF_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_shared_elt(e:ELT,as:AS_SHARED_DEF):AM_ROUT_DEF
**** Transform the element `e' into AM form.
transform_stmt(s:$AS_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_stmt_list(l:AS_STMT_LIST):$AM_STMT
**** A list of AM_STMT's which implements all the statements in the source list `l'.
transform_str_lit_expr(e:AS_STR_LIT_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_typecase_stmt(s: AS_TYPECASE_STMT): $AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
transform_void_expr(e:AS_VOID_EXPR, tp:$TP):$AM_EXPR
**** Expression implementing `e' in type context `tp'.
transform_yield_stmt(s:AS_YIELD_STMT):$AM_STMT
**** A list of AM_STMT's which implements the source statement `s'.
typecase_hot_local_err(s:AS_TYPECASE_STMT)
typecase_local_err(s:AS_TYPECASE_STMT)
typecase_no_branch_err(s:AS_TYPECASE_STMT)
unprotected_raise_in_par_fork_warning(s:AS_RAISE_STMT)
yield_in_par_fork_err(s:AS_YIELD_STMT)
yield_in_protect_err(s:AS_YIELD_STMT)
yield_in_rout_err(s:AS_YIELD_STMT)


Private

const_to_switch(e:$AM_EXPR):$AM_CONST
**** returns a constant expression that can be used in a when clause of an AM_CASE_STMT, or void if it cannot be used.
is_array_sig(s:SIG):BOOL
**** True if `s' is `aset' or `aget' in AVAL or AREF.
is_some_array_sig(s:SIG):BOOL
**** True if `s' is a function/iter in AVAL or AREF.