home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
sa104os2.zip
/
SATHR104.ZIP
/
SATHER
/
COMPILER
/
TR.SA
< prev
next >
Wrap
Text File
|
1995-02-13
|
38KB
|
1,079 lines
-- Copyright (C) International Computer Science Institute, 1994. COPYRIGHT --
-- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
-- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in --
-- the file "Doc/License" of the Sather distribution. The license is also --
-- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA. --
--------> Please email comments to "sather-bugs@icsi.berkeley.edu". <----------
-- tr.sa: The tree representation for the Sather compiler.
-------------------------------------------------------------------
-- $TR_NODE: Supertype of all abstract syntax tree nodes.
-- TR_NODE: Implementation to be included by $TR_NODE nodes.
--
-- TR_CLASS_DEF: Class definitions.
--
-- $TR_CLASS_ELT: Supertype of class element nodes.
-- TR_CLASS_ELT: Implementation to be included by $TR_CLASS_ELT nodes.
-- TR_CONST_DEF, TR_SHARED_DEF, TR_ATTR_DEF, TR_ROUT_DEF,
-- TR_INCLUDE_CLAUSE
--
-- $TR_STMT: Supertype of routine or iter statement nodes.
-- TR_STMT: Implementation to be included by $TR_STMT nodes.
-- TR_DEC_STMT, TR_ASSIGN_STMT, TR_IF_STMT, TR_LOOP_STMT,
-- TR_RETURN_STMT, TR_YIELD_STMT, TR_QUIT_STMT, TR_CASE_STMT,
-- TR_TYPECASE_STMT, TR_ASSERT_STMT, TR_PROTECT_STMT, TR_RAISE_STMT,
-- TR_EXPR_STMT, TR_COBEGIN_STMT, TR_LOCK_STMT, TR_UNLOCK_STMT,
-- TR_TRY_STMT, TR_WITH_NEAR_STMT, TR_IDENT_LIST, TR_FORK_STMT,
-- TR_DIST_STMT
--
-- $TR_EXPR: Supertype of all expression nodes.
-- TR_EXPR: Implementation to be included by $TR_EXPR nodes.
-- TR_SELF_EXPR, TR_CALL_EXPR, TR_VOID_EXPR, TR_ARRAY_EXPR,
-- TR_CREATE_EXPR, TR_BOUND_CREATE_EXPR, TR_AND_EXPR,
-- TR_OR_EXPR, TR_EXCEPT_EXPR, TR_NEW_EXPR, TR_INITIAL_EXPR,
-- TR_BREAK_EXPR, TR_RESULT_EXPR, TR_BOOL_LIT_EXPR, TR_CHAR_LIT_EXPR,
-- TR_STR_LIT_EXPR, TR_INT_LIT_EXPR, TR_FLT_LIT_EXPR, TR_HERE_EXPR,
-- TR_WHERE_EXPR, TR_NEAR_EXPR, TR_FAR_EXPR, TR_AT_EXPR
--
-- Other tree components: TR_PARAM_DEC, TR_TYPE_SPEC,
-- TR_ARG_DEC, TR_FEAT_MOD, TR_CASE_WHEN, TR_TYPECASE_WHEN,
-- TR_PROTECT_WHEN
--
-- Each tree node class descends from $TR_NODE and has a name starting
-- with TR_. The rest of the name is the name of the corresponding
-- grammar production from the 1.0 spec using the suffixes:
-- "_DEC" for declarations, "_DEF" for definitions, "_ELT" for elements,
-- "_EXPR" for expressions, "_LIST" for lists, "_SPEC" for
-- specifications, "_STMT" for statements
--
-- Single classes sometimes represent several productions.
-- Whenever a comment says "if any" that means that "void" is a possible
-- value and it indicates the the component was not present.
--
-------------------------------------------------------------------
type $TR_NODE < $PROG_ERR is
-- A supertype of all nodes in the tree representation.
source:SFILE_ID;
source(s:SFILE_ID);
end;
-------------------------------------------------------------------
class TR_NODE is
-- A supertype of all nodes in the tree representation.
attr source:SFILE_ID; -- The origin of a node in a Sather
-- source file.
create: SAME is
-- A new object with default initialization.
return new end;
end; -- class TR_NODE
-------------------------------------------------------------------
class TR_CLASS_DEF < $TR_NODE is
-- The definition of a class.
include TR_NODE;
include NEXT{SAME}; -- Next class in the list.
const unused:INT:=0;
const val:INT:=1; -- Value class.
const ref:INT:=2; -- Reference class.
const abs:INT:=3; -- Abstract class.
const ext:INT:=4; -- External class.
const spr:INT:=5; -- Spread class (pSather).
attr kind:INT; -- One of val, ref, abs, ext.
attr name:IDENT; -- Name of the class.
attr params:TR_PARAM_DEC; -- List of parameter declarations,
-- if any.
attr under:TR_TYPE_SPEC; -- List of parents in the type graph.
attr over:TR_TYPE_SPEC; -- List of over children in the type graph.
attr body:$TR_CLASS_ELT; -- The body of the class.
end;
-------------------------------------------------------------------
class TR_PARAM_DEC < $TR_NODE is
-- The declaration of a parameter for a class.
include TR_NODE;
include NEXT{SAME}; -- Next parameter, if any.
attr name:IDENT; -- Index of parameter name.
attr type_constraint:TR_TYPE_SPEC; -- Type constraint for type,
-- if any.
end;
-------------------------------------------------------------------
class TR_TYPE_SPEC < $TR_NODE is
-- A type specifier.
include TR_NODE;
include NEXT{SAME}; -- Next parameter, if any.
const ord:INT:=0; -- Abstract, value, reference, or external.
const rt:INT:=1; -- Bound routine type.
const it:INT:=2; -- Bound iter type.
const same:INT:=3; -- "SAME".
attr kind:INT; -- One of ord, rt, it, or same.
attr is_hot:BOOL; -- True if this is a specifier
-- for a hot bound iter argument type.
attr name:IDENT; -- Name of the type, void for bound types.
attr params:TR_TYPE_SPEC; -- For ordinary types, these are the
-- parameters specifiers, if any. For bound types, these are the
-- argument type specifiers.
attr ret:TR_TYPE_SPEC; -- Return type spec for bound types.
end;
-------------------------------------------------------------------
type $TR_CLASS_ELT < $TR_NODE, $NEXT{$TR_CLASS_ELT} is
-- A supertype of all elements of the body of a class.
is_private(b:BOOL); -- Set the private status.
is_private:BOOL; -- Retrieve the private status.
end;
-------------------------------------------------------------------
class TR_CLASS_ELT < $TR_CLASS_ELT is
-- A supertype of all elements of the body of a class.
include TR_NODE;
include NEXT{$TR_CLASS_ELT};
attr is_private:BOOL; -- True if declared private.
end;
-------------------------------------------------------------------
class TR_CONST_DEF < $TR_CLASS_ELT is
-- Definition of constant attributes.
include TR_CLASS_ELT;
attr name:IDENT; -- The name of the constant.
attr tp:TR_TYPE_SPEC; -- Type declaration, if any.
-- If none, it is an INT.
attr init:$TR_EXPR; -- Initialization expression.
end;
-------------------------------------------------------------------
class TR_SHARED_DEF < $TR_CLASS_ELT is
-- Definition of shared attributes. Parser should make one of these
-- for each element in a list like "shared a,b,c:INT".
include TR_CLASS_ELT;
attr is_readonly:BOOL; -- True if declared readonly.
attr name:IDENT; -- Name of the shared.
attr tp:TR_TYPE_SPEC; -- Type declaration.
attr init:$TR_EXPR; -- Initialization expression, if any.
end;
-------------------------------------------------------------------
class TR_ATTR_DEF < $TR_CLASS_ELT is
-- Definition of object attributes. Parser should make one of these
-- for each element in a list like "a,b,c:INT".
include TR_CLASS_ELT;
attr is_readonly:BOOL; -- True if declared readonly.
attr name:IDENT; -- Name of the attribute.
attr tp:TR_TYPE_SPEC; -- Type declaration.
end;
-------------------------------------------------------------------
class TR_ROUT_DEF < $TR_CLASS_ELT is
-- Definition of a routine.
include TR_CLASS_ELT;
attr is_abstract:BOOL; -- True if has no body.
attr name:IDENT; -- Name of the routine.
attr args_dec:TR_ARG_DEC; -- Arguments, if any.
attr ret_dec:TR_TYPE_SPEC; -- Return type, if any.
attr pre_e:$TR_EXPR; -- The "pre" clause, if any.
attr post_e:$TR_EXPR; -- The "post" clause, if any.
attr stmts:$TR_STMT; -- The statements, if any.
end;
-------------------------------------------------------------------
class TR_ARG_DEC < $TR_NODE is
-- Declaration of routine and iter arguments. Parser should make
-- one of these for each arg in a list like "a,b,c:INT".
include TR_NODE;
include NEXT{SAME}; -- Other args, if any.
attr name:IDENT; -- The name of the argument.
attr tp:TR_TYPE_SPEC; -- The type.
attr is_hot:BOOL; -- True if declared "hot".
end;
-------------------------------------------------------------------
class TR_INCLUDE_CLAUSE < $TR_CLASS_ELT is
-- An inheritance clause. Parser should make one of these for each
-- element of the list, if more than one.
include TR_CLASS_ELT;
attr tp:TR_TYPE_SPEC; -- The type to include from.
attr mods:TR_FEAT_MOD; -- The feature modification list.
end;
-------------------------------------------------------------------
class TR_FEAT_MOD < $TR_NODE is
-- A modification to a feature of an included class.
include TR_NODE;
include NEXT{SAME}; -- Next mod in list.
attr name:IDENT; -- Name of modified feature.
attr is_private:BOOL; -- True if now private.
attr is_readonly:BOOL; -- True if now readonly.
attr new_name:IDENT; -- New name for the feature, if any.
end;
-------------------------------------------------------------------
type $TR_STMT < $TR_NODE, $NEXT{$TR_STMT} is
-- A supertype of all routine or iter statement nodes.
end;
-------------------------------------------------------------------
class TR_STMT < $TR_STMT is
-- A supertype of all routine or iter statement nodes.
include TR_NODE;
include NEXT{$TR_STMT}; -- The next statement in the list.
end;
-------------------------------------------------------------------
class TR_DEC_STMT < $TR_STMT is
-- A local declaration statement. Parser should make one of these
-- for each element in a list like "a,b,c:FOO".
include TR_STMT;
attr name:IDENT; -- Name of the local.
attr tp:TR_TYPE_SPEC; -- The type of the local.
end;
-------------------------------------------------------------------
class TR_ASSIGN_STMT < $TR_STMT is
-- An assignment statement.
include TR_STMT;
attr lhs_expr:$TR_EXPR; -- Lhs expr if no declaration.
attr name:IDENT; -- Name, for declaration (::= or :FOO:=).
attr tp:TR_TYPE_SPEC; -- Type, for declaration (:FOO:=).
attr rhs:$TR_EXPR; -- Righthand side.
end;
-------------------------------------------------------------------
class TR_IF_STMT < $TR_STMT is
-- An "if" statement.
include TR_STMT;
attr test:$TR_EXPR; -- Boolean expression to test.
attr then_part:$TR_STMT; -- Statements to execute if true, if any.
attr else_part:$TR_STMT; -- "Else" part, if any.
end;
-------------------------------------------------------------------
class TR_LOOP_STMT < $TR_STMT is
-- A "loop" statement.
include TR_STMT;
attr body:$TR_STMT; -- The body of the loop, if any.
end;
-------------------------------------------------------------------
class TR_RETURN_STMT < $TR_STMT is
-- A "return" statement.
include TR_STMT;
attr val:$TR_EXPR; -- Return value, if any.
end;
-------------------------------------------------------------------
class TR_YIELD_STMT < $TR_STMT is
-- A "yield" statement.
include TR_STMT;
attr val:$TR_EXPR; -- Yield value, if any.
end;
-------------------------------------------------------------------
class TR_QUIT_STMT < $TR_STMT is
-- A "quit" statement.
include TR_STMT;
end;
-------------------------------------------------------------------
class TR_CASE_STMT < $TR_STMT is
-- A "case" statement.
include TR_STMT;
attr test:$TR_EXPR; -- The expression to test.
attr when_part:TR_CASE_WHEN; -- The list of "when" clauses.
attr else_part:$TR_STMT; -- The "else" part.
attr no_else:BOOL; -- True if there is no "else" part.
end;
-------------------------------------------------------------------
class TR_CASE_WHEN < $TR_NODE is
-- A "when" clause of a "case" statement. The parser should make
-- one of these for each object listed, eg. "when a,b,c then".
-- When there are multiple targets, the `then_part's should be
-- pointers to the same object.
include TR_NODE;
include NEXT{SAME}; -- Other clauses, if any.
attr val:$TR_EXPR; -- A value to compare against.
attr then_part:$TR_STMT; -- The statements to execute.
end;
-------------------------------------------------------------------
class TR_TYPECASE_STMT < $TR_STMT is
-- A "typecase" statement. Parser should put any declaration or
-- assignment in a separate object before this.
include TR_STMT;
attr name:IDENT; -- The local to switch on.
attr when_part:TR_TYPECASE_WHEN; -- The list of "when" clauses.
attr else_part:$TR_STMT; -- The "else" part.
attr no_else:BOOL; -- True if there is no "else" part.
end;
-------------------------------------------------------------------
class TR_TYPECASE_WHEN < $TR_NODE, $NEXT{SAME} is
-- A "when" clause of a "typecase" statement.
include TR_NODE;
include NEXT{SAME}; -- Other clauses, if any.
attr tp:TR_TYPE_SPEC; -- A type to compare against.
attr then_part:$TR_STMT; -- The statements to execute.
end;
-------------------------------------------------------------------
class TR_ASSERT_STMT < $TR_STMT is
-- An "assert" statement.
include TR_STMT;
attr test:$TR_EXPR; -- The boolean expression to test.
end;
-------------------------------------------------------------------
class TR_PROTECT_STMT < $TR_STMT is
-- A "protect" statement.
include TR_STMT;
attr stmts:$TR_STMT; -- The statements to protect.
attr when_part:TR_PROTECT_WHEN; -- The "when" parts.
attr else_part:$TR_STMT; -- The "else" parts.
attr no_else:BOOL; -- True if there is no "else" part.
end;
-------------------------------------------------------------------
class TR_PROTECT_WHEN < $TR_NODE is
-- The "when" part of a "protect" statement.
include TR_NODE;
include NEXT{SAME};
attr tp:TR_TYPE_SPEC; -- The types to check.
attr then_part:$TR_STMT; -- The statements to execute.
end;
-------------------------------------------------------------------
class TR_COBEGIN_STMT < $TR_STMT is
-- A "cobegin" statement. (pSather)
include TR_STMT;
attr stmts: $TR_STMT; -- The statements to synchronize.
end;
-------------------------------------------------------------------
class TR_LOCK_STMT < $TR_STMT is
-- A "lock" statement. (pSather)
include TR_STMT;
attr e_list: $TR_EXPR; -- The expressions to be locked.
attr then_part: $TR_STMT;
end;
-------------------------------------------------------------------
class TR_UNLOCK_STMT < $TR_STMT is
-- A "unlock" statement. (pSather)
include TR_STMT;
attr e: $TR_EXPR; -- The expression to be unlocked.
end;
-------------------------------------------------------------------
class TR_TRY_STMT < $TR_STMT is
-- A "try" statement. (pSather)
include TR_STMT;
attr e_list: $TR_EXPR; -- The expressions to be tried.
attr then_part: $TR_STMT;
attr else_part: $TR_STMT;
end;
-------------------------------------------------------------------
class TR_DIST_STMT < $TR_STMT is
-- A "dist" statement. (pSather)
include TR_STMT;
attr exprs: FLIST{$TR_EXPR};
attr ids: FLIST{IDENT};
attr stmts: $TR_STMT;
end;
-------------------------------------------------------------------
class TR_WITH_NEAR_STMT < $TR_STMT is
-- A "with_near" statement. (pSather)
include TR_STMT;
attr idents: TR_IDENT_LIST;
attr near_part: $TR_STMT;
attr else_part: $TR_STMT;
end;
-------------------------------------------------------------------
class TR_IDENT_LIST < $TR_NODE is
-- A list of identifiers. Used to represent the ident_list of
-- a with_near statement.
include TR_NODE;
include NEXT{SAME}; -- Other clauses, if any.
attr name: IDENT
end;
-------------------------------------------------------------------
class TR_FORK_STMT < $TR_STMT is
-- An assignment statement.
include TR_STMT;
attr lhs:$TR_EXPR; -- Lhs expr if any.
attr rhs:$TR_EXPR; -- Righthand side.
end;
-------------------------------------------------------------------
class TR_RAISE_STMT < $TR_STMT is
-- A "raise" statement.
include TR_STMT;
attr val:$TR_EXPR; -- The exception object.
end;
-------------------------------------------------------------------
class TR_EXPR_STMT < $TR_STMT is
-- A "expression" statement.
include TR_STMT;
attr e: $TR_EXPR; -- The expression.
end;
-------------------------------------------------------------------
type $TR_EXPR < $TR_NODE, $NEXT{$TR_EXPR} is
-- Supertype of all expression nodes.
end;
-------------------------------------------------------------------
class TR_EXPR < $TR_EXPR is
-- Supertype of all expression nodes.
include TR_NODE;
include NEXT{$TR_EXPR};
end;
-------------------------------------------------------------------
class TR_SELF_EXPR < $TR_EXPR is
-- A "self" expression.
include TR_EXPR;
end;
-------------------------------------------------------------------
class TR_CALL_EXPR < $TR_EXPR is
-- Expressions which directly make a call. The parser should convert
-- sugar expressions into these as well (except for /= which should
-- be converted into an "=" expression and a call on "not").
include TR_EXPR;
attr ob:$TR_EXPR; -- The expr the call is made on, if any.
attr tp:TR_TYPE_SPEC; -- The class the call is made on, if any.
attr name:IDENT; -- The name of the call.
attr args:$TR_EXPR; -- The arguments, if any.
attr is_array:BOOL; -- True if this is a call with square
-- brackets. "a(1,2)[3,4]" gets turned into 2 TR_CALL_EXPR
-- objects, one for a(1,2), and one for [3,4].
args_size:INT is
if void(args) then return 0
-- else return args.size -- NLP
end; return args.size; -- NLP
-- end -- NLP
end;
end;
-------------------------------------------------------------------
class TR_VOID_EXPR < $TR_EXPR is
-- The void expression.
include TR_EXPR;
end;
-------------------------------------------------------------------
class TR_IS_VOID_EXPR < $TR_EXPR is
-- The void expression.
include TR_EXPR;
attr arg:$TR_EXPR; -- The argument to test.
end;
-------------------------------------------------------------------
class TR_ARRAY_EXPR < $TR_EXPR is
-- array expressions.
include TR_EXPR;
attr elts:$TR_EXPR; -- The elements.
elts_size:INT is
if void(elts) then return 0
-- else return elts.size -- NLP
end
; return elts.size; -- NLP
end;
end;
-------------------------------------------------------------------
class TR_CREATE_EXPR < $TR_EXPR is
-- Reference and value object constructor expressions.
include TR_EXPR;
attr tp:TR_TYPE_SPEC; -- The type, if any.
attr elts:$TR_EXPR; -- The arguments, if any.
elts_size:INT is
if void(elts) then return 0
-- else return elts.size -- NLP
end
; return elts.size; -- NLP
end;
end;
-------------------------------------------------------------------
class TR_BOUND_CREATE_EXPR < $TR_EXPR is
-- Bound object constructor expressions.
include TR_EXPR;
attr call:TR_CALL_EXPR; -- The call.
attr is_iter:BOOL; -- True for iter creation.
attr ret:TR_TYPE_SPEC; -- Return type, void if none specified.
end;
-------------------------------------------------------------------
class TR_UNDERSCORE_ARG < $TR_EXPR is
-- An underscore argument in a bound routine or iter creation
-- expression.
include TR_EXPR;
attr tp:TR_TYPE_SPEC; -- Type if specified.
end;
-------------------------------------------------------------------
class TR_AND_EXPR < $TR_EXPR is
-- "and" expressions.
include TR_EXPR;
attr e1,e2:$TR_EXPR; -- The two expressions.
end;
-------------------------------------------------------------------
class TR_OR_EXPR < $TR_EXPR is
-- "or" expressions.
include TR_EXPR;
attr e1,e2:$TR_EXPR; -- The two expressions.
end;
-------------------------------------------------------------------
class TR_EXCEPT_EXPR < $TR_EXPR is
-- "exception" expressions.
include TR_EXPR;
end;
-------------------------------------------------------------------
class TR_NEW_EXPR < $TR_EXPR is
-- "new" expressions.
include TR_EXPR;
attr arg:$TR_EXPR; -- The argument, if any
end;
-------------------------------------------------------------------
class TR_INITIAL_EXPR < $TR_EXPR is
-- "initial" expressions.
include TR_EXPR;
attr e:$TR_EXPR; -- The expression to pre-evaluate.
end;
-------------------------------------------------------------------
class TR_BREAK_EXPR < $TR_EXPR is
-- "break!" expressions.
include TR_EXPR;
end;
-------------------------------------------------------------------
class TR_RESULT_EXPR < $TR_EXPR is
-- "result" expressions.
include TR_EXPR;
end;
-------------------------------------------------------------------
class TR_BOOL_LIT_EXPR < $TR_EXPR is
-- A boolean literal expression.
include TR_EXPR;
attr val:BOOL; -- The value.
end;
-------------------------------------------------------------------
class TR_CHAR_LIT_EXPR < $TR_EXPR is
-- A character literal expression.
include TR_EXPR;
attr val:INT; -- Integer value of char.
end;
-------------------------------------------------------------------
class TR_STR_LIT_EXPR < $TR_EXPR is
-- A string literal expression.
include TR_EXPR;
attr s:STR; -- String form of the literal.
end;
-------------------------------------------------------------------
class TR_INT_LIT_EXPR < $TR_EXPR is
-- An integer literal expression.
include TR_EXPR;
attr val:INTI; -- Integer value of the expression.
attr is_inti:BOOL; -- Is an infinite precision literal.
end;
-------------------------------------------------------------------
class TR_FLT_LIT_EXPR < $TR_EXPR is
-- A floating point literal expression.
include TR_EXPR;
const flt, fltd, fltx, fltdx, flti;
attr val:RAT; -- Rational with value.
attr tp:INT; -- One of the five types of float.
end;
-------------------------------------------------------------------
class TR_HERE_EXPR < $TR_EXPR is
-- A "here" expression.
-- (pSather construct).
include TR_EXPR;
end;
-------------------------------------------------------------------
class TR_WHERE_EXPR < $TR_EXPR is
-- A "where" expression.
-- (pSather construct).
include TR_EXPR;
attr e: $TR_EXPR;
end;
-------------------------------------------------------------------
class TR_NEAR_EXPR < $TR_EXPR is
-- A "near" expression.
-- (pSather construct).
include TR_EXPR;
attr e: $TR_EXPR;
end;
-------------------------------------------------------------------
class TR_FAR_EXPR < $TR_EXPR is
-- A "far" expression.
-- (pSather construct).
include TR_EXPR;
attr e: $TR_EXPR;
end;
-------------------------------------------------------------------
class TR_AT_EXPR < $TR_EXPR is
-- A '@' expression.
-- (pSather construct).
include TR_EXPR;
attr e, at: $TR_EXPR;
end;
-------------------------------------------------------------------
class TR_OUT is
-- Output a TR tree for debugging purposes.
TR_NODE_out(t:$TR_NODE) is
if void(t) then #OUT + "$TR_NODE=void "; return end;
typecase t
when TR_CLASS_DEF then TR_CLASS_DEF_out(t)
when TR_CONST_DEF then TR_CONST_DEF_out(t)
when TR_SHARED_DEF then TR_SHARED_DEF_out(t)
when TR_ATTR_DEF then TR_ATTR_DEF_out(t)
when TR_ROUT_DEF then TR_ROUT_DEF_out(t)
when TR_INCLUDE_CLAUSE then TR_INCLUDE_CLAUSE_out(t)
when TR_DEC_STMT then TR_DEC_STMT_out(t)
when TR_ASSIGN_STMT then TR_ASSIGN_STMT_out(t)
when TR_IF_STMT then TR_IF_STMT_out(t)
when TR_LOOP_STMT then TR_LOOP_STMT_out(t)
when TR_RETURN_STMT then TR_RETURN_STMT_out(t)
when TR_YIELD_STMT then TR_YIELD_STMT_out(t)
when TR_QUIT_STMT then TR_QUIT_STMT_out(t)
when TR_CASE_STMT then TR_CASE_STMT_out(t)
when TR_TYPECASE_STMT then TR_TYPECASE_STMT_out(t)
when TR_ASSERT_STMT then TR_ASSERT_STMT_out(t)
when TR_PROTECT_STMT then TR_PROTECT_STMT_out(t)
when TR_RAISE_STMT then TR_RAISE_STMT_out(t)
when TR_EXPR_STMT then TR_EXPR_STMT_out(t)
when TR_SELF_EXPR then TR_SELF_EXPR_out(t)
when TR_CALL_EXPR then TR_CALL_EXPR_out(t)
when TR_VOID_EXPR then TR_VOID_EXPR_out(t)
when TR_ARRAY_EXPR then TR_ARRAY_EXPR_out(t)
when TR_CREATE_EXPR then TR_CREATE_EXPR_out(t)
when TR_BOUND_CREATE_EXPR then TR_BOUND_CREATE_EXPR_out(t)
when TR_AND_EXPR then TR_AND_EXPR_out(t)
when TR_OR_EXPR then TR_OR_EXPR_out(t)
when TR_EXCEPT_EXPR then TR_EXCEPT_EXPR_out(t)
when TR_NEW_EXPR then TR_NEW_EXPR_out(t)
when TR_INITIAL_EXPR then TR_INITIAL_EXPR_out(t)
when TR_BREAK_EXPR then TR_BREAK_EXPR_out(t)
when TR_RESULT_EXPR then TR_RESULT_EXPR_out(t)
when TR_BOOL_LIT_EXPR then TR_BOOL_LIT_EXPR_out(t)
when TR_CHAR_LIT_EXPR then TR_CHAR_LIT_EXPR_out(t)
when TR_STR_LIT_EXPR then TR_STR_LIT_EXPR_out(t)
when TR_INT_LIT_EXPR then TR_INT_LIT_EXPR_out(t)
when TR_FLT_LIT_EXPR then TR_FLT_LIT_EXPR_out(t)
when TR_PARAM_DEC then TR_PARAM_DEC_out(t)
when TR_TYPE_SPEC then TR_TYPE_SPEC_out(t)
when TR_ARG_DEC then TR_ARG_DEC_out(t)
when TR_FEAT_MOD then TR_FEAT_MOD_out(t)
when TR_CASE_WHEN then TR_CASE_WHEN_out(t)
when TR_TYPECASE_WHEN then TR_TYPECASE_WHEN_out(t)
when TR_PROTECT_WHEN then TR_PROTECT_WHEN_out(t)
end end;
TR_CLASS_ELT_out(t:$TR_CLASS_ELT) is
if void(t) then #OUT + "$TR_CLASS_ELT=void "; return end;
typecase t
when TR_CONST_DEF then TR_CONST_DEF_out(t)
when TR_SHARED_DEF then TR_SHARED_DEF_out(t)
when TR_ATTR_DEF then TR_ATTR_DEF_out(t)
when TR_ROUT_DEF then TR_ROUT_DEF_out(t)
when TR_INCLUDE_CLAUSE then TR_INCLUDE_CLAUSE_out(t)
end end;
TR_STMT_out(t:$TR_STMT) is
if void(t) then #OUT + "$TR_STMT=void"; return end;
typecase t
when TR_DEC_STMT then TR_DEC_STMT_out(t)
when TR_ASSIGN_STMT then TR_ASSIGN_STMT_out(t)
when TR_IF_STMT then TR_IF_STMT_out(t)
when TR_LOOP_STMT then TR_LOOP_STMT_out(t)
when TR_RETURN_STMT then TR_RETURN_STMT_out(t)
when TR_YIELD_STMT then TR_YIELD_STMT_out(t)
when TR_QUIT_STMT then TR_QUIT_STMT_out(t)
when TR_CASE_STMT then TR_CASE_STMT_out(t)
when TR_TYPECASE_STMT then TR_TYPECASE_STMT_out(t)
when TR_ASSERT_STMT then TR_ASSERT_STMT_out(t)
when TR_PROTECT_STMT then TR_PROTECT_STMT_out(t)
when TR_RAISE_STMT then TR_RAISE_STMT_out(t)
when TR_EXPR_STMT then TR_EXPR_STMT_out(t) end end;
TR_EXPR_out(t:$TR_EXPR) is
if void(t) then #OUT + "$TR_EXPR=void"; return end;
typecase t
when TR_SELF_EXPR then TR_SELF_EXPR_out(t)
when TR_CALL_EXPR then TR_CALL_EXPR_out(t)
when TR_VOID_EXPR then TR_VOID_EXPR_out(t)
when TR_ARRAY_EXPR then TR_ARRAY_EXPR_out(t)
when TR_CREATE_EXPR then TR_CREATE_EXPR_out(t)
when TR_BOUND_CREATE_EXPR then TR_BOUND_CREATE_EXPR_out(t)
when TR_AND_EXPR then TR_AND_EXPR_out(t)
when TR_OR_EXPR then TR_OR_EXPR_out(t)
when TR_EXCEPT_EXPR then TR_EXCEPT_EXPR_out(t)
when TR_NEW_EXPR then TR_NEW_EXPR_out(t)
when TR_INITIAL_EXPR then TR_INITIAL_EXPR_out(t)
when TR_BREAK_EXPR then TR_BREAK_EXPR_out(t)
when TR_RESULT_EXPR then TR_RESULT_EXPR_out(t)
when TR_BOOL_LIT_EXPR then TR_BOOL_LIT_EXPR_out(t)
when TR_CHAR_LIT_EXPR then TR_CHAR_LIT_EXPR_out(t)
when TR_STR_LIT_EXPR then TR_STR_LIT_EXPR_out(t)
when TR_INT_LIT_EXPR then TR_INT_LIT_EXPR_out(t)
when TR_FLT_LIT_EXPR then TR_FLT_LIT_EXPR_out(t) end end;
TR_CLASS_DEF_out(t:TR_CLASS_DEF) is
if void(t) then #OUT + "TR_CLASS_DEF=void\n\n"; return end;
#OUT + "TR_CLASS_DEF: kind=";
case t.kind
when t.val then #OUT + "val ";
when t.ref then #OUT + "ref ";
when t.abs then #OUT + "abs ";
when t.ext then #OUT + "ext " end;
#OUT + "name=" + t.name.str + ' ';
#OUT + "params="; TR_PARAM_DEC_out(t.params); #OUT + '\n';
#OUT + "under="; TR_TYPE_SPEC_out(t.under); #OUT + '\n';
#OUT + "over="; TR_TYPE_SPEC_out(t.over); #OUT + '\n';
#OUT + "body=\n\n"; TR_CLASS_ELT_out(t.body); #OUT + '\n' end;
TR_CONST_DEF_out(t:TR_CONST_DEF) is
if void(t) then #OUT + "TR_CONST_DEF=void\n\n"; return end;
#OUT + "TR_CONST_DEF: ";
#OUT + "is_private=" + t.is_private + ' ';
#OUT + "name=" + t.name.str + ' ';
#OUT + "tp="; TR_TYPE_SPEC_out(t.tp); #OUT + ' ';
#OUT + "init="; TR_EXPR_out(t.init); #OUT + "\n\n";
if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;
TR_SHARED_DEF_out(t:TR_SHARED_DEF) is
if void(t) then #OUT + "TR_SHARED_DEF=void\n\n"; return end;
#OUT + "TR_SHARED_DEF: ";
#OUT + "is_private=" + t.is_private + ' ';
#OUT + "is_readonly=" + t.is_readonly + ' ';
#OUT + "name=" + t.name.str + ' ';
#OUT + "tp="; TR_TYPE_SPEC_out(t.tp); #OUT + ' ';
#OUT + "init="; TR_EXPR_out(t.init); #OUT + "\n\n";
if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;
TR_ATTR_DEF_out(t:TR_ATTR_DEF) is
if void(t) then #OUT + "TR_ATTR_DEF=void\n\n"; return end;
#OUT + "TR_ATTR_DEF: ";
#OUT + "is_private=" + t.is_private + ' ';
#OUT + "is_readonly=" + t.is_readonly + ' ';
#OUT + "name=" + t.name.str + ' ';
#OUT + "tp="; TR_TYPE_SPEC_out(t.tp); #OUT + "\n\n";
if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;
TR_ROUT_DEF_out(t:TR_ROUT_DEF) is
if void(t) then #OUT + "TR_ROUT_DEF=void\n\n"; return end;
#OUT + "TR_ROUT_DEF: ";
#OUT + "is_private=" + t.is_private + ' ';
#OUT + "is_abstract=" + t.is_abstract + ' ';
#OUT + "name=" + t.name.str + ' ';
#OUT + "args_dec="; TR_ARG_DEC_out(t.args_dec); #OUT + ' ';
#OUT + "ret_dec="; TR_TYPE_SPEC_out(t.ret_dec); #OUT + ' ';
#OUT + "pre_e="; TR_EXPR_out(t.pre_e); #OUT + ' ';
#OUT + "post_e="; TR_EXPR_out(t.post_e); #OUT + ' ';
#OUT + "stmts=\n\n"; TR_STMT_out(t.stmts);
if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;
TR_INCLUDE_CLAUSE_out(t:TR_INCLUDE_CLAUSE) is
if void(t) then #OUT + "TR_INCLUDE_CLAUSE=void\n\n"; return end;
#OUT + "TR_INCLUDE_CLAUSE: ";
#OUT + "is_private=" + t.is_private + ' ';
#OUT + "tp="; TR_TYPE_SPEC_out(t.tp); #OUT + ' ';
#OUT + "mods="; TR_FEAT_MOD_out(t.mods); #OUT + ' ';
if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;
TR_DEC_STMT_out(t:TR_DEC_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_DEC_STMT: \n";
end;
TR_ASSIGN_STMT_out(t:TR_ASSIGN_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_ASSIGN_STMT: \n";
end;
TR_IF_STMT_out(t:TR_IF_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_IF_STMT: \n";
end;
TR_LOOP_STMT_out(t:TR_LOOP_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_LOOP_STMT: \n";
end;
TR_RETURN_STMT_out(t:TR_RETURN_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_RETURN_STMT: \n";
end;
TR_YIELD_STMT_out(t:TR_YIELD_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_YIELD_STMT: \n";
end;
TR_QUIT_STMT_out(t:TR_QUIT_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_QUIT_STMT: \n";
end;
TR_CASE_STMT_out(t:TR_CASE_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_CASE_STMT: \n";
end;
TR_TYPECASE_STMT_out(t:TR_TYPECASE_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_TYPECASE_STMT: \n";
end;
TR_ASSERT_STMT_out(t:TR_ASSERT_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_ASSERT_STMT: \n";
end;
TR_PROTECT_STMT_out(t:TR_PROTECT_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_PROTECT_STMT: \n";
end;
TR_RAISE_STMT_out(t:TR_RAISE_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_RAISE_STMT: \n";
end;
TR_EXPR_STMT_out(t:TR_EXPR_STMT) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_EXPR_STMT: \n";
end;
TR_SELF_EXPR_out(t:TR_SELF_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_SELF_EXPR: \n";
end;
TR_CALL_EXPR_out(t:TR_CALL_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_CALL_EXPR: \n";
end;
TR_VOID_EXPR_out(t:TR_VOID_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_VOID_EXPR: \n";
end;
TR_ARRAY_EXPR_out(t:TR_ARRAY_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_ARRAY_EXPR: \n";
end;
TR_CREATE_EXPR_out(t:TR_CREATE_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_CREATE_EXPR: \n";
#OUT + " type: \n";
TR_TYPE_SPEC_out(t.tp);
end;
TR_BOUND_CREATE_EXPR_out(t:TR_BOUND_CREATE_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_BOUND_CREATE_EXPR: \n";
#OUT + " ret: \n";
TR_TYPE_SPEC_out(t.ret);
end;
TR_AND_EXPR_out(t:TR_AND_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_AND_EXPR: \n";
end;
TR_OR_EXPR_out(t:TR_OR_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_OR_EXPR: \n";
end;
TR_EXCEPT_EXPR_out(t:TR_EXCEPT_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_EXCEPT_EXPR: \n";
end;
TR_NEW_EXPR_out(t:TR_NEW_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_NEW_EXPR: \n";
end;
TR_INITIAL_EXPR_out(t:TR_INITIAL_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_INITIAL_EXPR: \n";
end;
TR_BREAK_EXPR_out(t:TR_BREAK_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_BREAK_EXPR: \n";
end;
TR_RESULT_EXPR_out(t:TR_RESULT_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_RESULT_EXPR: \n";
end;
TR_BOOL_LIT_EXPR_out(t:TR_BOOL_LIT_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_BOOL_LIT_EXPR: \n";
end;
TR_CHAR_LIT_EXPR_out(t:TR_CHAR_LIT_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_CHAR_LIT_EXPR: \n";
end;
TR_STR_LIT_EXPR_out(t:TR_STR_LIT_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_STR_LIT_EXPR: \n";
end;
TR_INT_LIT_EXPR_out(t:TR_INT_LIT_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_INT_LIT_EXPR: \n";
end;
TR_FLT_LIT_EXPR_out(t:TR_FLT_LIT_EXPR) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_FLT_LIT_EXPR: \n";
end;
TR_PARAM_DEC_out(t:TR_PARAM_DEC) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_PARAM_DEC: \n";
end;
TR_TYPE_SPEC_out(t:TR_TYPE_SPEC) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_TYPE_SPEC: \n";
name::=t.name.str;
if ~void(name) then
#OUT + " name = " + t.name.str + '\n';
end;
#OUT + " params:\n";
TR_TYPE_SPEC_out(t.params);
end;
TR_ARG_DEC_out(t:TR_ARG_DEC) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_ARG_DEC: \n";
end;
TR_FEAT_MOD_out(t:TR_FEAT_MOD) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_FEAT_MOD: \n";
end;
TR_CASE_WHEN_out(t:TR_CASE_WHEN) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_CASE_WHEN: \n";
end;
TR_TYPECASE_WHEN_out(t:TR_TYPECASE_WHEN) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_TYPECASE_WHEN: \n";
end;
TR_PROTECT_WHEN_out(t:TR_PROTECT_WHEN) is
if void(t) then #OUT + "void"; return end;
#OUT + "TR_PROTECT_WHEN: \n";
end;
end;
-------------------------------------------------------------------