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 >
Text File  |  1995-02-13  |  38KB  |  1,079 lines

  1. -- Copyright (C) International Computer Science Institute, 1994.  COPYRIGHT  --
  2. -- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
  3. -- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    --
  4. -- the file "Doc/License" of the Sather distribution.  The license is also   --
  5. -- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  --
  6. --------> Please email comments to "sather-bugs@icsi.berkeley.edu". <----------
  7.  
  8. -- tr.sa: The tree representation for the Sather compiler. 
  9. -------------------------------------------------------------------
  10. -- $TR_NODE: Supertype of all abstract syntax tree nodes.
  11. -- TR_NODE: Implementation to be included by $TR_NODE nodes.
  12. -- 
  13. -- TR_CLASS_DEF: Class definitions. 
  14. -- 
  15. -- $TR_CLASS_ELT: Supertype of class element nodes.
  16. -- TR_CLASS_ELT: Implementation to be included by $TR_CLASS_ELT nodes.
  17. -- TR_CONST_DEF, TR_SHARED_DEF, TR_ATTR_DEF, TR_ROUT_DEF, 
  18. -- TR_INCLUDE_CLAUSE 
  19. -- 
  20. -- $TR_STMT: Supertype of routine or iter statement nodes. 
  21. -- TR_STMT: Implementation to be included by $TR_STMT nodes.
  22. -- TR_DEC_STMT, TR_ASSIGN_STMT, TR_IF_STMT, TR_LOOP_STMT,
  23. -- TR_RETURN_STMT, TR_YIELD_STMT, TR_QUIT_STMT, TR_CASE_STMT,
  24. -- TR_TYPECASE_STMT, TR_ASSERT_STMT, TR_PROTECT_STMT, TR_RAISE_STMT, 
  25. -- TR_EXPR_STMT, TR_COBEGIN_STMT, TR_LOCK_STMT, TR_UNLOCK_STMT,
  26. -- TR_TRY_STMT, TR_WITH_NEAR_STMT, TR_IDENT_LIST, TR_FORK_STMT,
  27. -- TR_DIST_STMT
  28. -- 
  29. -- $TR_EXPR: Supertype of all expression nodes.
  30. -- TR_EXPR: Implementation to be included by $TR_EXPR nodes.   
  31. -- TR_SELF_EXPR, TR_CALL_EXPR, TR_VOID_EXPR, TR_ARRAY_EXPR, 
  32. -- TR_CREATE_EXPR, TR_BOUND_CREATE_EXPR, TR_AND_EXPR, 
  33. -- TR_OR_EXPR, TR_EXCEPT_EXPR, TR_NEW_EXPR, TR_INITIAL_EXPR, 
  34. -- TR_BREAK_EXPR, TR_RESULT_EXPR, TR_BOOL_LIT_EXPR, TR_CHAR_LIT_EXPR,
  35. -- TR_STR_LIT_EXPR, TR_INT_LIT_EXPR, TR_FLT_LIT_EXPR, TR_HERE_EXPR,
  36. -- TR_WHERE_EXPR, TR_NEAR_EXPR, TR_FAR_EXPR, TR_AT_EXPR
  37. -- 
  38. -- Other tree components: TR_PARAM_DEC, TR_TYPE_SPEC,
  39. -- TR_ARG_DEC, TR_FEAT_MOD, TR_CASE_WHEN, TR_TYPECASE_WHEN, 
  40. -- TR_PROTECT_WHEN
  41. --
  42. -- Each tree node class descends from $TR_NODE and has a name starting
  43. -- with TR_. The rest of the name is the name of the corresponding 
  44. -- grammar production from the 1.0 spec using the suffixes:
  45. -- "_DEC" for declarations, "_DEF" for definitions, "_ELT" for elements,
  46. -- "_EXPR" for expressions, "_LIST" for lists, "_SPEC" for 
  47. -- specifications, "_STMT" for statements
  48. --
  49. -- Single classes sometimes represent several productions.
  50. -- Whenever a comment says "if any" that means that "void" is a possible
  51. -- value and it indicates the the component was not present.
  52. -- 
  53. -------------------------------------------------------------------
  54. type $TR_NODE < $PROG_ERR is
  55.    -- A supertype of all nodes in the tree representation.
  56.    source:SFILE_ID;
  57.    source(s:SFILE_ID);
  58. end;
  59.    
  60. -------------------------------------------------------------------
  61. class TR_NODE is
  62.    -- A supertype of all nodes in the tree representation.
  63.    
  64.    attr source:SFILE_ID; -- The origin of a node in a Sather 
  65.       -- source file.
  66.    
  67.    create: SAME is
  68.       -- A new object with default initialization.
  69.       return new end;
  70.    
  71. end; -- class TR_NODE
  72.  
  73. -------------------------------------------------------------------
  74. class TR_CLASS_DEF < $TR_NODE is
  75.    -- The definition of a class.
  76.    include TR_NODE;
  77.    include NEXT{SAME};        -- Next class in the list.
  78.    
  79.    const unused:INT:=0;
  80.    const val:INT:=1;        -- Value class.
  81.    const ref:INT:=2;        -- Reference class.
  82.    const abs:INT:=3;        -- Abstract class.
  83.    const ext:INT:=4;        -- External class.
  84.    const spr:INT:=5;        -- Spread class (pSather).
  85.  
  86.    attr kind:INT;        -- One of val, ref, abs, ext.
  87.    attr name:IDENT;        -- Name of the class.
  88.    attr params:TR_PARAM_DEC;    -- List of parameter declarations, 
  89.       -- if any.
  90.    attr under:TR_TYPE_SPEC;    -- List of parents in the type graph.
  91.    attr over:TR_TYPE_SPEC;    -- List of over children in the type graph.
  92.    attr body:$TR_CLASS_ELT;    -- The body of the class.
  93. end;
  94.  
  95. -------------------------------------------------------------------
  96. class TR_PARAM_DEC < $TR_NODE is
  97.    -- The declaration of a parameter for a class.
  98.    include TR_NODE;
  99.    include NEXT{SAME};        -- Next parameter, if any.
  100.    
  101.    attr name:IDENT;        -- Index of parameter name.
  102.    attr type_constraint:TR_TYPE_SPEC; -- Type constraint for type, 
  103.       -- if any.
  104. end;
  105.  
  106. -------------------------------------------------------------------
  107. class TR_TYPE_SPEC < $TR_NODE is
  108.    -- A type specifier.
  109.    include TR_NODE;
  110.    include NEXT{SAME};        -- Next parameter, if any.   
  111.    
  112.    const ord:INT:=0;        -- Abstract, value, reference, or external.
  113.    const rt:INT:=1;        -- Bound routine type.
  114.    const it:INT:=2;        -- Bound iter type.
  115.    const same:INT:=3;        -- "SAME".
  116.  
  117.    attr kind:INT;        -- One of ord, rt, it, or same.
  118.    attr is_hot:BOOL;            -- True if this is a specifier
  119.       -- for a hot bound iter argument type.
  120.    attr name:IDENT;        -- Name of the type, void for bound types.
  121.    attr params:TR_TYPE_SPEC;    -- For ordinary types, these are the
  122.       -- parameters specifiers, if any. For bound types, these are the 
  123.       -- argument type specifiers.
  124.    attr ret:TR_TYPE_SPEC;    -- Return type spec for bound types.
  125. end;
  126.  
  127. -------------------------------------------------------------------
  128. type $TR_CLASS_ELT < $TR_NODE, $NEXT{$TR_CLASS_ELT} is
  129.    -- A supertype of all elements of the body of a class.
  130.  
  131.    is_private(b:BOOL);        -- Set the private status.
  132.    is_private:BOOL;        -- Retrieve the private status.
  133. end;
  134.    
  135. -------------------------------------------------------------------
  136. class TR_CLASS_ELT < $TR_CLASS_ELT is
  137.    -- A supertype of all elements of the body of a class.
  138.    include TR_NODE;
  139.    include NEXT{$TR_CLASS_ELT};
  140.  
  141.    attr is_private:BOOL;    -- True if declared private.
  142. end;
  143.    
  144. -------------------------------------------------------------------
  145. class TR_CONST_DEF < $TR_CLASS_ELT is
  146.    -- Definition of constant attributes.
  147.    include TR_CLASS_ELT;
  148.    
  149.    attr name:IDENT;        -- The name of the constant.
  150.    attr tp:TR_TYPE_SPEC;    -- Type declaration, if any.
  151.       -- If none, it is an INT.
  152.    attr init:$TR_EXPR;        -- Initialization expression.
  153. end;
  154.  
  155. -------------------------------------------------------------------
  156. class TR_SHARED_DEF < $TR_CLASS_ELT is
  157.    -- Definition of shared attributes. Parser should make one of these
  158.    -- for each element in a list like "shared a,b,c:INT".
  159.    include TR_CLASS_ELT;
  160.    
  161.    attr is_readonly:BOOL;    -- True if declared readonly.
  162.    attr name:IDENT;        -- Name of the shared.
  163.    attr tp:TR_TYPE_SPEC;    -- Type declaration.
  164.    attr init:$TR_EXPR;        -- Initialization expression, if any.
  165. end;
  166.    
  167. -------------------------------------------------------------------
  168. class TR_ATTR_DEF < $TR_CLASS_ELT is
  169.    -- Definition of object attributes. Parser should make one of these
  170.    -- for each element in a list like "a,b,c:INT".
  171.    include TR_CLASS_ELT;
  172.    
  173.    attr is_readonly:BOOL;    -- True if declared readonly.
  174.    attr name:IDENT;        -- Name of the attribute.
  175.    attr tp:TR_TYPE_SPEC;    -- Type declaration.
  176. end;
  177.  
  178. -------------------------------------------------------------------
  179. class TR_ROUT_DEF < $TR_CLASS_ELT is
  180.    -- Definition of a routine.
  181.    include TR_CLASS_ELT;
  182.  
  183.    attr is_abstract:BOOL;    -- True if has no body.
  184.    attr name:IDENT;        -- Name of the routine.
  185.    attr args_dec:TR_ARG_DEC;    -- Arguments, if any.
  186.    attr ret_dec:TR_TYPE_SPEC;    -- Return type, if any.
  187.    attr pre_e:$TR_EXPR;        -- The "pre" clause, if any.
  188.    attr post_e:$TR_EXPR;    -- The "post" clause, if any.
  189.    attr stmts:$TR_STMT;        -- The statements, if any.
  190. end;
  191.  
  192. -------------------------------------------------------------------
  193. class TR_ARG_DEC < $TR_NODE is
  194.    -- Declaration of routine and iter arguments. Parser should make
  195.    -- one of these for each arg in a list like "a,b,c:INT".
  196.    include TR_NODE;
  197.    include NEXT{SAME};            -- Other args, if any.
  198.    
  199.    attr name:IDENT;        -- The name of the argument.
  200.    attr tp:TR_TYPE_SPEC;    -- The type.
  201.    attr is_hot:BOOL;        -- True if declared "hot".   
  202. end;
  203.  
  204. -------------------------------------------------------------------
  205. class TR_INCLUDE_CLAUSE < $TR_CLASS_ELT is
  206.    -- An inheritance clause. Parser should make one of these for each
  207.    -- element of the list, if more than one.
  208.    include TR_CLASS_ELT;
  209.    
  210.    attr tp:TR_TYPE_SPEC;    -- The type to include from.
  211.    attr mods:TR_FEAT_MOD;    -- The feature modification list.
  212. end;
  213.    
  214. -------------------------------------------------------------------
  215. class TR_FEAT_MOD < $TR_NODE is
  216.    -- A modification to a feature of an included class.
  217.    include TR_NODE;
  218.    include NEXT{SAME};            -- Next mod in list.
  219.    
  220.    attr name:IDENT;        -- Name of modified feature.
  221.    attr is_private:BOOL;    -- True if now private.
  222.    attr is_readonly:BOOL;    -- True if now readonly.   
  223.    attr new_name:IDENT;        -- New name for the feature, if any.
  224. end;
  225.    
  226. -------------------------------------------------------------------
  227. type $TR_STMT < $TR_NODE, $NEXT{$TR_STMT} is
  228.    -- A supertype of all routine or iter statement nodes.
  229. end;
  230.  
  231. -------------------------------------------------------------------   
  232. class TR_STMT < $TR_STMT is
  233.    -- A supertype of all routine or iter statement nodes.
  234.    include TR_NODE;
  235.    include NEXT{$TR_STMT};    -- The next statement in the list.
  236. end;
  237.    
  238. -------------------------------------------------------------------
  239. class TR_DEC_STMT < $TR_STMT is
  240.    -- A local declaration statement. Parser should make one of these
  241.    -- for each element in a list like "a,b,c:FOO".
  242.    include TR_STMT;
  243.    
  244.    attr name:IDENT;        -- Name of the local.
  245.    attr tp:TR_TYPE_SPEC;    -- The type of the local.
  246. end;
  247.    
  248. -------------------------------------------------------------------
  249. class TR_ASSIGN_STMT < $TR_STMT is
  250.    -- An assignment statement.
  251.    include TR_STMT;
  252.    
  253.    attr lhs_expr:$TR_EXPR;    -- Lhs expr if no declaration.
  254.    attr name:IDENT;        -- Name, for declaration (::= or :FOO:=).
  255.    attr tp:TR_TYPE_SPEC;    -- Type, for declaration (:FOO:=).   
  256.    attr rhs:$TR_EXPR;        -- Righthand side.
  257. end;
  258.  
  259. -------------------------------------------------------------------
  260. class TR_IF_STMT < $TR_STMT is
  261.    -- An "if" statement.
  262.    include TR_STMT;
  263.    
  264.    attr test:$TR_EXPR;        -- Boolean expression to test.
  265.    attr then_part:$TR_STMT;    -- Statements to execute if true, if any.
  266.    attr else_part:$TR_STMT;    -- "Else" part, if any.
  267. end;
  268.  
  269. -------------------------------------------------------------------
  270. class TR_LOOP_STMT < $TR_STMT is
  271.    -- A "loop" statement.
  272.    include TR_STMT;
  273.    
  274.    attr body:$TR_STMT;        -- The body of the loop, if any.
  275. end;
  276.    
  277. -------------------------------------------------------------------
  278. class TR_RETURN_STMT < $TR_STMT is
  279.    -- A "return" statement.
  280.    include TR_STMT;
  281.    
  282.    attr val:$TR_EXPR;        -- Return value, if any.
  283. end;
  284.    
  285. -------------------------------------------------------------------
  286. class TR_YIELD_STMT < $TR_STMT is
  287.    -- A "yield" statement.
  288.    include TR_STMT;
  289.    
  290.    attr val:$TR_EXPR;        -- Yield value, if any.   
  291. end;
  292.  
  293. -------------------------------------------------------------------
  294. class TR_QUIT_STMT < $TR_STMT is
  295.    -- A "quit" statement.
  296.    include TR_STMT;
  297. end;
  298.  
  299. -------------------------------------------------------------------   
  300. class TR_CASE_STMT < $TR_STMT is
  301.    -- A "case" statement.
  302.    include TR_STMT;
  303.    
  304.    attr test:$TR_EXPR;        -- The expression to test.
  305.    attr when_part:TR_CASE_WHEN;    -- The list of "when" clauses.
  306.    attr else_part:$TR_STMT;    -- The "else" part.
  307.    attr no_else:BOOL;        -- True if there is no "else" part.   
  308. end;
  309.  
  310. -------------------------------------------------------------------
  311. class TR_CASE_WHEN < $TR_NODE is
  312.    -- A "when" clause of a "case" statement. The parser should make
  313.    -- one of these for each object listed, eg. "when a,b,c then".
  314.    -- When there are multiple targets, the `then_part's should be
  315.    -- pointers to the same object.
  316.    include TR_NODE;
  317.    include NEXT{SAME};            -- Other clauses, if any.
  318.    
  319.    attr val:$TR_EXPR;        -- A value to compare against.
  320.    attr then_part:$TR_STMT;    -- The statements to execute.
  321. end;
  322.  
  323. -------------------------------------------------------------------
  324. class TR_TYPECASE_STMT < $TR_STMT is
  325.    -- A "typecase" statement. Parser should put any declaration or
  326.    -- assignment in a separate object before this.
  327.    include TR_STMT;
  328.    
  329.    attr name:IDENT;        -- The local to switch on.
  330.    attr when_part:TR_TYPECASE_WHEN; -- The list of "when" clauses.
  331.    attr else_part:$TR_STMT;    -- The "else" part.
  332.    attr no_else:BOOL;        -- True if there is no "else" part.
  333. end;
  334.    
  335. -------------------------------------------------------------------
  336. class TR_TYPECASE_WHEN < $TR_NODE, $NEXT{SAME} is
  337.    -- A "when" clause of a "typecase" statement. 
  338.    include TR_NODE;
  339.    include NEXT{SAME};            -- Other clauses, if any.
  340.    
  341.    attr tp:TR_TYPE_SPEC;    -- A type to compare against.
  342.    attr then_part:$TR_STMT;    -- The statements to execute.
  343. end;
  344.  
  345. -------------------------------------------------------------------
  346. class TR_ASSERT_STMT < $TR_STMT is
  347.    -- An "assert" statement.
  348.    include TR_STMT;
  349.    
  350.    attr test:$TR_EXPR;        -- The boolean expression to test.
  351. end;
  352.  
  353. -------------------------------------------------------------------
  354. class TR_PROTECT_STMT < $TR_STMT is
  355.    -- A "protect" statement.
  356.    include TR_STMT;
  357.    
  358.    attr stmts:$TR_STMT;        -- The statements to protect.
  359.    attr when_part:TR_PROTECT_WHEN; -- The "when" parts.
  360.    attr else_part:$TR_STMT;    -- The "else" parts.
  361.    attr no_else:BOOL;        -- True if there is no "else" part.   
  362. end;
  363.  
  364. -------------------------------------------------------------------
  365. class TR_PROTECT_WHEN < $TR_NODE is
  366.    -- The "when" part of a "protect" statement.
  367.    include TR_NODE;
  368.    include NEXT{SAME};
  369.  
  370.    attr tp:TR_TYPE_SPEC;    -- The types to check.
  371.    attr then_part:$TR_STMT;    -- The statements to execute.
  372. end;
  373.  
  374. -------------------------------------------------------------------
  375. class TR_COBEGIN_STMT < $TR_STMT is
  376.    -- A "cobegin" statement. (pSather)
  377.    include TR_STMT;
  378.    
  379.    attr stmts: $TR_STMT;        -- The statements to synchronize.
  380. end;
  381.  
  382. -------------------------------------------------------------------
  383. class TR_LOCK_STMT < $TR_STMT is
  384.    -- A "lock" statement. (pSather)
  385.    include TR_STMT;
  386.    
  387.    attr e_list: $TR_EXPR;      -- The expressions to be locked.
  388.    attr then_part: $TR_STMT;
  389. end;
  390.  
  391. -------------------------------------------------------------------
  392. class TR_UNLOCK_STMT < $TR_STMT is
  393.    -- A "unlock" statement. (pSather)
  394.    include TR_STMT;
  395.    
  396.    attr e: $TR_EXPR;      -- The expression to be unlocked.
  397. end;
  398.  
  399. -------------------------------------------------------------------
  400. class TR_TRY_STMT < $TR_STMT is
  401.    -- A "try" statement. (pSather)
  402.    include TR_STMT;
  403.    
  404.    attr e_list: $TR_EXPR;      -- The expressions to be tried.
  405.    attr then_part: $TR_STMT;
  406.    attr else_part: $TR_STMT;
  407. end;
  408.  
  409. -------------------------------------------------------------------
  410. class TR_DIST_STMT < $TR_STMT is
  411.    -- A "dist" statement. (pSather)
  412.    include TR_STMT;
  413.    
  414.    attr exprs: FLIST{$TR_EXPR};
  415.    attr ids: FLIST{IDENT};
  416.    attr stmts: $TR_STMT;
  417. end;
  418.  
  419. -------------------------------------------------------------------
  420. class TR_WITH_NEAR_STMT < $TR_STMT is
  421.    -- A "with_near" statement. (pSather)
  422.    include TR_STMT;
  423.    
  424.    attr idents: TR_IDENT_LIST;
  425.    attr near_part: $TR_STMT;
  426.    attr else_part: $TR_STMT;
  427. end;
  428.  
  429. -------------------------------------------------------------------   
  430. class TR_IDENT_LIST < $TR_NODE is
  431.    -- A list of identifiers. Used to represent the ident_list of
  432.    -- a with_near statement.
  433.    include TR_NODE;
  434.    include NEXT{SAME};            -- Other clauses, if any.
  435.    
  436.    attr name: IDENT
  437. end;
  438.  
  439. -------------------------------------------------------------------
  440. class TR_FORK_STMT < $TR_STMT is
  441.    -- An assignment statement.
  442.    include TR_STMT;
  443.    
  444.    attr lhs:$TR_EXPR;   -- Lhs expr if any.
  445.    attr rhs:$TR_EXPR;   -- Righthand side.
  446. end;
  447.  
  448. -------------------------------------------------------------------
  449. class TR_RAISE_STMT < $TR_STMT is
  450.    -- A "raise" statement.
  451.    include TR_STMT;
  452.    
  453.    attr val:$TR_EXPR;        -- The exception object.
  454. end;
  455.  
  456. -------------------------------------------------------------------   
  457. class TR_EXPR_STMT < $TR_STMT is
  458.    -- A "expression" statement.
  459.    include TR_STMT;
  460.    
  461.    attr e: $TR_EXPR;        -- The expression.
  462. end;
  463.    
  464. -------------------------------------------------------------------      
  465. type $TR_EXPR < $TR_NODE, $NEXT{$TR_EXPR} is
  466.    -- Supertype of all expression nodes.
  467. end;
  468.    
  469. -------------------------------------------------------------------      
  470. class TR_EXPR < $TR_EXPR is
  471.    -- Supertype of all expression nodes.
  472.    include TR_NODE;
  473.    include NEXT{$TR_EXPR};
  474. end;
  475.    
  476. -------------------------------------------------------------------
  477. class TR_SELF_EXPR < $TR_EXPR is
  478.    -- A "self" expression.
  479.    include TR_EXPR;
  480. end;
  481.    
  482. -------------------------------------------------------------------   
  483. class TR_CALL_EXPR < $TR_EXPR is
  484.    -- Expressions which directly make a call. The parser should convert
  485.    -- sugar expressions into these as well (except for /= which should
  486.    -- be converted into an "=" expression and a call on "not"). 
  487.    include TR_EXPR;
  488.    
  489.    attr ob:$TR_EXPR;        -- The expr the call is made on, if any.
  490.    attr tp:TR_TYPE_SPEC;    -- The class the call is made on, if any.
  491.    attr name:IDENT;        -- The name of the call.
  492.    attr args:$TR_EXPR;        -- The arguments, if any.   
  493.    attr is_array:BOOL;        -- True if this is a call with square
  494.       -- brackets. "a(1,2)[3,4]" gets turned into 2 TR_CALL_EXPR
  495.       -- objects, one for a(1,2), and one for [3,4].
  496.    
  497.    args_size:INT is
  498.       if void(args) then return 0
  499. --    else return args.size                                                     -- NLP
  500.       end; return args.size;                                                    -- NLP
  501. --    end                                                                       -- NLP
  502.    end;
  503.  
  504. end;
  505.  
  506. -------------------------------------------------------------------
  507. class TR_VOID_EXPR < $TR_EXPR is
  508.    -- The void expression.
  509.    include TR_EXPR;
  510. end;
  511.  
  512. -------------------------------------------------------------------
  513. class TR_IS_VOID_EXPR < $TR_EXPR is
  514.    -- The void expression.
  515.    include TR_EXPR;
  516.    
  517.    attr arg:$TR_EXPR;        -- The argument to test.
  518. end;
  519.    
  520. -------------------------------------------------------------------
  521. class TR_ARRAY_EXPR < $TR_EXPR is
  522.    -- array expressions.
  523.    include TR_EXPR;
  524.  
  525.    attr elts:$TR_EXPR;        -- The elements.
  526.    
  527.    elts_size:INT is
  528.       if void(elts) then return 0
  529. --    else return elts.size                                                     -- NLP
  530.       end
  531.       ; return elts.size;                                                       -- NLP
  532.    end;   
  533.    
  534. end;
  535.  
  536. -------------------------------------------------------------------
  537. class TR_CREATE_EXPR < $TR_EXPR is
  538.    -- Reference and value object constructor expressions.
  539.    include TR_EXPR;
  540.    
  541.    attr tp:TR_TYPE_SPEC;    -- The type, if any.
  542.    attr elts:$TR_EXPR;        -- The arguments, if any.
  543.    
  544.    elts_size:INT is
  545.       if void(elts) then return 0
  546. --    else return elts.size                                                     -- NLP
  547.       end
  548.       ; return elts.size;                                                       -- NLP
  549.    end;   
  550.  
  551. end;
  552.  
  553. -------------------------------------------------------------------
  554. class TR_BOUND_CREATE_EXPR < $TR_EXPR is
  555.    -- Bound object constructor expressions.
  556.    include TR_EXPR;
  557.    
  558.    attr call:TR_CALL_EXPR;    -- The call.
  559.    attr is_iter:BOOL;        -- True for iter creation.
  560.    attr ret:TR_TYPE_SPEC;    -- Return type, void if none specified.
  561. end;
  562.  
  563. -------------------------------------------------------------------
  564. class TR_UNDERSCORE_ARG < $TR_EXPR is
  565.    -- An underscore argument in a bound routine or iter creation
  566.    -- expression.
  567.    include TR_EXPR;
  568.    
  569.    attr tp:TR_TYPE_SPEC;    -- Type if specified.
  570. end;
  571.  
  572. -------------------------------------------------------------------
  573. class TR_AND_EXPR < $TR_EXPR is
  574.    -- "and" expressions.
  575.    include TR_EXPR;
  576.    
  577.    attr e1,e2:$TR_EXPR;        -- The two expressions.
  578. end;
  579.  
  580. -------------------------------------------------------------------
  581. class TR_OR_EXPR < $TR_EXPR is
  582.    -- "or" expressions.
  583.    include TR_EXPR;
  584.    
  585.    attr e1,e2:$TR_EXPR;        -- The two expressions.
  586. end;
  587.    
  588. -------------------------------------------------------------------
  589. class TR_EXCEPT_EXPR < $TR_EXPR is
  590.    -- "exception" expressions.
  591.    include TR_EXPR;
  592. end;   
  593.    
  594. -------------------------------------------------------------------
  595. class TR_NEW_EXPR < $TR_EXPR is
  596.    -- "new" expressions.
  597.    include TR_EXPR;
  598.    
  599.    attr arg:$TR_EXPR;        -- The argument, if any
  600. end;
  601.  
  602. -------------------------------------------------------------------
  603. class TR_INITIAL_EXPR < $TR_EXPR is
  604.    -- "initial" expressions.
  605.    include TR_EXPR;
  606.    
  607.    attr e:$TR_EXPR;        -- The expression to pre-evaluate.
  608. end;
  609.  
  610. -------------------------------------------------------------------
  611. class TR_BREAK_EXPR < $TR_EXPR is
  612.    -- "break!" expressions.
  613.    include TR_EXPR;
  614. end;   
  615.       
  616. -------------------------------------------------------------------
  617. class TR_RESULT_EXPR < $TR_EXPR is
  618.    -- "result" expressions.
  619.    include TR_EXPR;
  620. end;   
  621.       
  622. -------------------------------------------------------------------
  623. class TR_BOOL_LIT_EXPR < $TR_EXPR is
  624.    -- A boolean literal expression.
  625.    include TR_EXPR;
  626.    
  627.    attr val:BOOL;        -- The value.
  628. end;
  629.  
  630. -------------------------------------------------------------------
  631. class TR_CHAR_LIT_EXPR < $TR_EXPR is
  632.    -- A character literal expression.
  633.    include TR_EXPR;
  634.    
  635.    attr val:INT;        -- Integer value of char.
  636. end;
  637.  
  638. -------------------------------------------------------------------
  639. class TR_STR_LIT_EXPR < $TR_EXPR is
  640.    -- A string literal expression.
  641.    include TR_EXPR;
  642.    
  643.    attr s:STR;            -- String form of the literal.
  644. end;
  645.  
  646. -------------------------------------------------------------------
  647. class TR_INT_LIT_EXPR < $TR_EXPR is
  648.    -- An integer literal expression.
  649.    include TR_EXPR;
  650.    
  651.    attr val:INTI;        -- Integer value of the expression.
  652.    attr is_inti:BOOL;        -- Is an infinite precision literal.
  653.    
  654. end;
  655.  
  656. -------------------------------------------------------------------
  657. class TR_FLT_LIT_EXPR < $TR_EXPR is
  658.    -- A floating point literal expression.
  659.    include TR_EXPR;
  660.  
  661.    const flt, fltd, fltx, fltdx, flti;   
  662.    
  663.    attr val:RAT;        -- Rational with value.
  664.    attr tp:INT;            -- One of the five types of float.
  665. end;
  666.  
  667. -------------------------------------------------------------------
  668. class TR_HERE_EXPR < $TR_EXPR is
  669.    -- A "here" expression.
  670.    -- (pSather construct).
  671.    include TR_EXPR;
  672.  
  673. end;
  674.  
  675. -------------------------------------------------------------------
  676. class TR_WHERE_EXPR < $TR_EXPR is
  677.    -- A "where" expression.
  678.    -- (pSather construct).
  679.    include TR_EXPR;
  680.  
  681.    attr e: $TR_EXPR;
  682. end;
  683.  
  684. -------------------------------------------------------------------
  685. class TR_NEAR_EXPR < $TR_EXPR is
  686.    -- A "near" expression.
  687.    -- (pSather construct).
  688.    include TR_EXPR;
  689.  
  690.    attr e: $TR_EXPR;
  691. end;
  692.  
  693. -------------------------------------------------------------------
  694. class TR_FAR_EXPR < $TR_EXPR is
  695.    -- A "far" expression.
  696.    -- (pSather construct).
  697.    include TR_EXPR;
  698.  
  699.    attr e: $TR_EXPR;
  700. end;
  701.  
  702. -------------------------------------------------------------------
  703. class TR_AT_EXPR < $TR_EXPR is
  704.    -- A '@' expression.
  705.    -- (pSather construct).
  706.    include TR_EXPR;
  707.  
  708.    attr e, at: $TR_EXPR;
  709. end;
  710.  
  711. -------------------------------------------------------------------
  712. class TR_OUT is
  713.    -- Output a TR tree for debugging purposes.
  714.  
  715.    TR_NODE_out(t:$TR_NODE) is
  716.       if void(t) then #OUT + "$TR_NODE=void "; return end;
  717.       typecase t
  718.       when TR_CLASS_DEF then TR_CLASS_DEF_out(t)
  719.       when TR_CONST_DEF then TR_CONST_DEF_out(t)
  720.       when TR_SHARED_DEF then TR_SHARED_DEF_out(t)
  721.       when TR_ATTR_DEF then TR_ATTR_DEF_out(t)
  722.       when TR_ROUT_DEF then TR_ROUT_DEF_out(t)
  723.       when TR_INCLUDE_CLAUSE then TR_INCLUDE_CLAUSE_out(t)
  724.       when TR_DEC_STMT then TR_DEC_STMT_out(t)
  725.       when TR_ASSIGN_STMT then TR_ASSIGN_STMT_out(t)
  726.       when TR_IF_STMT then TR_IF_STMT_out(t)
  727.       when TR_LOOP_STMT then TR_LOOP_STMT_out(t)
  728.       when TR_RETURN_STMT then TR_RETURN_STMT_out(t)
  729.       when TR_YIELD_STMT then TR_YIELD_STMT_out(t)
  730.       when TR_QUIT_STMT then TR_QUIT_STMT_out(t)
  731.       when TR_CASE_STMT then TR_CASE_STMT_out(t)
  732.       when TR_TYPECASE_STMT then TR_TYPECASE_STMT_out(t)
  733.       when TR_ASSERT_STMT then TR_ASSERT_STMT_out(t)
  734.       when TR_PROTECT_STMT then TR_PROTECT_STMT_out(t)
  735.       when TR_RAISE_STMT then TR_RAISE_STMT_out(t)
  736.       when TR_EXPR_STMT then TR_EXPR_STMT_out(t)
  737.       when TR_SELF_EXPR then TR_SELF_EXPR_out(t)
  738.       when TR_CALL_EXPR then TR_CALL_EXPR_out(t)
  739.       when TR_VOID_EXPR then TR_VOID_EXPR_out(t)
  740.       when TR_ARRAY_EXPR then TR_ARRAY_EXPR_out(t)
  741.       when TR_CREATE_EXPR then TR_CREATE_EXPR_out(t)
  742.       when TR_BOUND_CREATE_EXPR then TR_BOUND_CREATE_EXPR_out(t)
  743.       when TR_AND_EXPR then TR_AND_EXPR_out(t)
  744.       when TR_OR_EXPR then TR_OR_EXPR_out(t)
  745.       when TR_EXCEPT_EXPR then TR_EXCEPT_EXPR_out(t)
  746.       when TR_NEW_EXPR then TR_NEW_EXPR_out(t)
  747.       when TR_INITIAL_EXPR then TR_INITIAL_EXPR_out(t)
  748.       when TR_BREAK_EXPR then TR_BREAK_EXPR_out(t)
  749.       when TR_RESULT_EXPR then TR_RESULT_EXPR_out(t)
  750.       when TR_BOOL_LIT_EXPR then TR_BOOL_LIT_EXPR_out(t)
  751.       when TR_CHAR_LIT_EXPR then TR_CHAR_LIT_EXPR_out(t)
  752.       when TR_STR_LIT_EXPR then TR_STR_LIT_EXPR_out(t)
  753.       when TR_INT_LIT_EXPR then TR_INT_LIT_EXPR_out(t)
  754.       when TR_FLT_LIT_EXPR then TR_FLT_LIT_EXPR_out(t)
  755.       when TR_PARAM_DEC then TR_PARAM_DEC_out(t)
  756.       when TR_TYPE_SPEC then TR_TYPE_SPEC_out(t)
  757.       when TR_ARG_DEC then TR_ARG_DEC_out(t)
  758.       when TR_FEAT_MOD then TR_FEAT_MOD_out(t)
  759.       when TR_CASE_WHEN then TR_CASE_WHEN_out(t)
  760.       when TR_TYPECASE_WHEN then TR_TYPECASE_WHEN_out(t)
  761.       when TR_PROTECT_WHEN then TR_PROTECT_WHEN_out(t)
  762.       end end;
  763.      
  764.    TR_CLASS_ELT_out(t:$TR_CLASS_ELT) is     
  765.       if void(t) then #OUT + "$TR_CLASS_ELT=void "; return end;
  766.       typecase t
  767.       when TR_CONST_DEF then TR_CONST_DEF_out(t)
  768.       when TR_SHARED_DEF then TR_SHARED_DEF_out(t)
  769.       when TR_ATTR_DEF then TR_ATTR_DEF_out(t)
  770.       when TR_ROUT_DEF then TR_ROUT_DEF_out(t)
  771.       when TR_INCLUDE_CLAUSE then TR_INCLUDE_CLAUSE_out(t) 
  772.       end end;
  773.       
  774.    TR_STMT_out(t:$TR_STMT) is
  775.       if void(t) then #OUT + "$TR_STMT=void"; return end;
  776.       typecase t
  777.       when TR_DEC_STMT then TR_DEC_STMT_out(t)
  778.       when TR_ASSIGN_STMT then TR_ASSIGN_STMT_out(t)
  779.       when TR_IF_STMT then TR_IF_STMT_out(t)
  780.       when TR_LOOP_STMT then TR_LOOP_STMT_out(t)
  781.       when TR_RETURN_STMT then TR_RETURN_STMT_out(t)
  782.       when TR_YIELD_STMT then TR_YIELD_STMT_out(t)
  783.       when TR_QUIT_STMT then TR_QUIT_STMT_out(t)
  784.       when TR_CASE_STMT then TR_CASE_STMT_out(t)
  785.       when TR_TYPECASE_STMT then TR_TYPECASE_STMT_out(t)
  786.       when TR_ASSERT_STMT then TR_ASSERT_STMT_out(t)
  787.       when TR_PROTECT_STMT then TR_PROTECT_STMT_out(t)
  788.       when TR_RAISE_STMT then TR_RAISE_STMT_out(t)
  789.       when TR_EXPR_STMT then TR_EXPR_STMT_out(t) end end;
  790.       
  791.    TR_EXPR_out(t:$TR_EXPR) is
  792.       if void(t) then #OUT + "$TR_EXPR=void"; return end;
  793.       typecase t
  794.       when TR_SELF_EXPR then TR_SELF_EXPR_out(t)
  795.       when TR_CALL_EXPR then TR_CALL_EXPR_out(t)
  796.       when TR_VOID_EXPR then TR_VOID_EXPR_out(t)
  797.       when TR_ARRAY_EXPR then TR_ARRAY_EXPR_out(t)
  798.       when TR_CREATE_EXPR then TR_CREATE_EXPR_out(t)
  799.       when TR_BOUND_CREATE_EXPR then TR_BOUND_CREATE_EXPR_out(t)
  800.       when TR_AND_EXPR then TR_AND_EXPR_out(t)
  801.       when TR_OR_EXPR then TR_OR_EXPR_out(t)
  802.       when TR_EXCEPT_EXPR then TR_EXCEPT_EXPR_out(t)
  803.       when TR_NEW_EXPR then TR_NEW_EXPR_out(t)
  804.       when TR_INITIAL_EXPR then TR_INITIAL_EXPR_out(t)
  805.       when TR_BREAK_EXPR then TR_BREAK_EXPR_out(t)
  806.       when TR_RESULT_EXPR then TR_RESULT_EXPR_out(t)
  807.       when TR_BOOL_LIT_EXPR then TR_BOOL_LIT_EXPR_out(t)
  808.       when TR_CHAR_LIT_EXPR then TR_CHAR_LIT_EXPR_out(t)
  809.       when TR_STR_LIT_EXPR then TR_STR_LIT_EXPR_out(t)
  810.       when TR_INT_LIT_EXPR then TR_INT_LIT_EXPR_out(t)
  811.       when TR_FLT_LIT_EXPR then TR_FLT_LIT_EXPR_out(t) end end;
  812.      
  813.    TR_CLASS_DEF_out(t:TR_CLASS_DEF) is
  814.       if void(t) then #OUT + "TR_CLASS_DEF=void\n\n"; return end;
  815.       #OUT + "TR_CLASS_DEF: kind=";
  816.       case t.kind
  817.       when t.val then #OUT + "val ";
  818.       when t.ref then #OUT + "ref ";
  819.       when t.abs then #OUT + "abs ";
  820.       when t.ext then #OUT + "ext " end;     
  821.       #OUT + "name=" + t.name.str + ' ';
  822.       #OUT + "params="; TR_PARAM_DEC_out(t.params); #OUT + '\n';
  823.       #OUT + "under="; TR_TYPE_SPEC_out(t.under); #OUT + '\n';
  824.       #OUT + "over="; TR_TYPE_SPEC_out(t.over); #OUT + '\n';
  825.       #OUT + "body=\n\n"; TR_CLASS_ELT_out(t.body); #OUT + '\n' end;
  826.       
  827.    TR_CONST_DEF_out(t:TR_CONST_DEF) is
  828.       if void(t) then #OUT + "TR_CONST_DEF=void\n\n"; return end;      
  829.       #OUT + "TR_CONST_DEF: ";
  830.       #OUT + "is_private=" + t.is_private + ' ';
  831.       #OUT + "name=" + t.name.str + ' ';      
  832.       #OUT + "tp="; TR_TYPE_SPEC_out(t.tp); #OUT + ' ';            
  833.       #OUT + "init="; TR_EXPR_out(t.init); #OUT + "\n\n";
  834.       if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;
  835.       
  836.    TR_SHARED_DEF_out(t:TR_SHARED_DEF) is
  837.       if void(t) then #OUT + "TR_SHARED_DEF=void\n\n"; return end;      
  838.       #OUT + "TR_SHARED_DEF: ";      
  839.       #OUT + "is_private=" + t.is_private + ' ';
  840.       #OUT + "is_readonly=" + t.is_readonly + ' ';      
  841.       #OUT + "name=" + t.name.str + ' ';      
  842.       #OUT + "tp="; TR_TYPE_SPEC_out(t.tp); #OUT + ' ';            
  843.       #OUT + "init="; TR_EXPR_out(t.init); #OUT + "\n\n";
  844.       if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;
  845.       
  846.    TR_ATTR_DEF_out(t:TR_ATTR_DEF) is
  847.       if void(t) then #OUT + "TR_ATTR_DEF=void\n\n"; return end;      
  848.       #OUT + "TR_ATTR_DEF: ";
  849.       #OUT + "is_private=" + t.is_private + ' ';
  850.       #OUT + "is_readonly=" + t.is_readonly + ' ';      
  851.       #OUT + "name=" + t.name.str + ' ';      
  852.       #OUT + "tp="; TR_TYPE_SPEC_out(t.tp); #OUT + "\n\n";
  853.       if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;
  854.       
  855.    TR_ROUT_DEF_out(t:TR_ROUT_DEF) is
  856.       if void(t) then #OUT + "TR_ROUT_DEF=void\n\n"; return end;      
  857.       #OUT + "TR_ROUT_DEF: ";
  858.       #OUT + "is_private=" + t.is_private + ' ';
  859.       #OUT + "is_abstract=" + t.is_abstract + ' ';      
  860.       #OUT + "name=" + t.name.str + ' ';      
  861.       #OUT + "args_dec="; TR_ARG_DEC_out(t.args_dec); #OUT + ' ';
  862.       #OUT + "ret_dec="; TR_TYPE_SPEC_out(t.ret_dec); #OUT + ' ';
  863.       #OUT + "pre_e="; TR_EXPR_out(t.pre_e); #OUT + ' ';
  864.       #OUT + "post_e="; TR_EXPR_out(t.post_e); #OUT + ' ';
  865.       #OUT + "stmts=\n\n"; TR_STMT_out(t.stmts);
  866.       if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;      
  867.       
  868.    TR_INCLUDE_CLAUSE_out(t:TR_INCLUDE_CLAUSE) is
  869.       if void(t) then #OUT + "TR_INCLUDE_CLAUSE=void\n\n"; return end; 
  870.       #OUT + "TR_INCLUDE_CLAUSE: ";
  871.       #OUT + "is_private=" + t.is_private + ' ';
  872.       #OUT + "tp="; TR_TYPE_SPEC_out(t.tp); #OUT + ' ';
  873.       #OUT + "mods="; TR_FEAT_MOD_out(t.mods); #OUT + ' ';
  874.       if ~void(t.next) then TR_CLASS_ELT_out(t.next) end end;            
  875.       
  876.    TR_DEC_STMT_out(t:TR_DEC_STMT) is
  877.       if void(t) then #OUT + "void"; return end;      
  878.       #OUT + "TR_DEC_STMT: \n";
  879.       end;
  880.       
  881.    TR_ASSIGN_STMT_out(t:TR_ASSIGN_STMT) is
  882.       if void(t) then #OUT + "void"; return end;      
  883.       #OUT + "TR_ASSIGN_STMT: \n";
  884.       end;
  885.       
  886.    TR_IF_STMT_out(t:TR_IF_STMT) is
  887.       if void(t) then #OUT + "void"; return end;      
  888.       #OUT + "TR_IF_STMT: \n";
  889.       end;
  890.       
  891.    TR_LOOP_STMT_out(t:TR_LOOP_STMT) is
  892.       if void(t) then #OUT + "void"; return end;      
  893.       #OUT + "TR_LOOP_STMT: \n";
  894.       end;
  895.       
  896.    TR_RETURN_STMT_out(t:TR_RETURN_STMT) is
  897.       if void(t) then #OUT + "void"; return end;      
  898.       #OUT + "TR_RETURN_STMT: \n";
  899.       end;
  900.       
  901.    TR_YIELD_STMT_out(t:TR_YIELD_STMT) is
  902.       if void(t) then #OUT + "void"; return end;      
  903.       #OUT + "TR_YIELD_STMT: \n";
  904.       end;
  905.       
  906.    TR_QUIT_STMT_out(t:TR_QUIT_STMT) is
  907.       if void(t) then #OUT + "void"; return end;      
  908.       #OUT + "TR_QUIT_STMT: \n";
  909.       end;
  910.       
  911.    TR_CASE_STMT_out(t:TR_CASE_STMT) is
  912.       if void(t) then #OUT + "void"; return end;      
  913.       #OUT + "TR_CASE_STMT: \n";
  914.       end;
  915.       
  916.    TR_TYPECASE_STMT_out(t:TR_TYPECASE_STMT) is
  917.       if void(t) then #OUT + "void"; return end;      
  918.       #OUT + "TR_TYPECASE_STMT: \n";
  919.       end;
  920.       
  921.    TR_ASSERT_STMT_out(t:TR_ASSERT_STMT) is
  922.       if void(t) then #OUT + "void"; return end;      
  923.       #OUT + "TR_ASSERT_STMT: \n";
  924.       end;
  925.       
  926.    TR_PROTECT_STMT_out(t:TR_PROTECT_STMT) is
  927.       if void(t) then #OUT + "void"; return end;      
  928.       #OUT + "TR_PROTECT_STMT: \n";
  929.       end;
  930.       
  931.    TR_RAISE_STMT_out(t:TR_RAISE_STMT) is
  932.       if void(t) then #OUT + "void"; return end;      
  933.       #OUT + "TR_RAISE_STMT: \n";
  934.       end;
  935.       
  936.    TR_EXPR_STMT_out(t:TR_EXPR_STMT) is
  937.       if void(t) then #OUT + "void"; return end;      
  938.       #OUT + "TR_EXPR_STMT: \n";
  939.       end;
  940.       
  941.    TR_SELF_EXPR_out(t:TR_SELF_EXPR) is
  942.       if void(t) then #OUT + "void"; return end;      
  943.       #OUT + "TR_SELF_EXPR: \n";
  944.       end;
  945.       
  946.    TR_CALL_EXPR_out(t:TR_CALL_EXPR) is
  947.       if void(t) then #OUT + "void"; return end;      
  948.       #OUT + "TR_CALL_EXPR: \n";
  949.       end;
  950.       
  951.    TR_VOID_EXPR_out(t:TR_VOID_EXPR) is
  952.       if void(t) then #OUT + "void"; return end;      
  953.       #OUT + "TR_VOID_EXPR: \n";
  954.       end;
  955.       
  956.    TR_ARRAY_EXPR_out(t:TR_ARRAY_EXPR) is
  957.       if void(t) then #OUT + "void"; return end;      
  958.       #OUT + "TR_ARRAY_EXPR: \n";
  959.       end;
  960.       
  961.    TR_CREATE_EXPR_out(t:TR_CREATE_EXPR) is
  962.       if void(t) then #OUT + "void"; return end;      
  963.       #OUT + "TR_CREATE_EXPR: \n";
  964.       #OUT + "   type: \n";
  965.       TR_TYPE_SPEC_out(t.tp);
  966.       end;
  967.       
  968.    TR_BOUND_CREATE_EXPR_out(t:TR_BOUND_CREATE_EXPR) is
  969.       if void(t) then #OUT + "void"; return end;      
  970.       #OUT + "TR_BOUND_CREATE_EXPR: \n";
  971.       #OUT + "   ret: \n";
  972.       TR_TYPE_SPEC_out(t.ret);
  973.       end;
  974.       
  975.    TR_AND_EXPR_out(t:TR_AND_EXPR) is
  976.       if void(t) then #OUT + "void"; return end;      
  977.       #OUT + "TR_AND_EXPR: \n";
  978.       end;
  979.       
  980.    TR_OR_EXPR_out(t:TR_OR_EXPR) is
  981.       if void(t) then #OUT + "void"; return end;      
  982.       #OUT + "TR_OR_EXPR: \n";
  983.       end;
  984.       
  985.    TR_EXCEPT_EXPR_out(t:TR_EXCEPT_EXPR) is
  986.       if void(t) then #OUT + "void"; return end;      
  987.       #OUT + "TR_EXCEPT_EXPR: \n";
  988.       end;
  989.       
  990.    TR_NEW_EXPR_out(t:TR_NEW_EXPR) is
  991.       if void(t) then #OUT + "void"; return end;      
  992.       #OUT + "TR_NEW_EXPR: \n";
  993.       end;
  994.       
  995.    TR_INITIAL_EXPR_out(t:TR_INITIAL_EXPR) is
  996.       if void(t) then #OUT + "void"; return end;      
  997.       #OUT + "TR_INITIAL_EXPR: \n";
  998.       end;
  999.       
  1000.    TR_BREAK_EXPR_out(t:TR_BREAK_EXPR) is
  1001.       if void(t) then #OUT + "void"; return end;      
  1002.       #OUT + "TR_BREAK_EXPR: \n";
  1003.       end;
  1004.       
  1005.    TR_RESULT_EXPR_out(t:TR_RESULT_EXPR) is
  1006.       if void(t) then #OUT + "void"; return end;      
  1007.       #OUT + "TR_RESULT_EXPR: \n";
  1008.       end;
  1009.       
  1010.    TR_BOOL_LIT_EXPR_out(t:TR_BOOL_LIT_EXPR) is
  1011.       if void(t) then #OUT + "void"; return end;      
  1012.       #OUT + "TR_BOOL_LIT_EXPR: \n";
  1013.       end;
  1014.       
  1015.    TR_CHAR_LIT_EXPR_out(t:TR_CHAR_LIT_EXPR) is
  1016.       if void(t) then #OUT + "void"; return end;      
  1017.       #OUT + "TR_CHAR_LIT_EXPR: \n";
  1018.       end;
  1019.       
  1020.    TR_STR_LIT_EXPR_out(t:TR_STR_LIT_EXPR) is
  1021.       if void(t) then #OUT + "void"; return end;      
  1022.       #OUT + "TR_STR_LIT_EXPR: \n";
  1023.       end;
  1024.       
  1025.    TR_INT_LIT_EXPR_out(t:TR_INT_LIT_EXPR) is
  1026.       if void(t) then #OUT + "void"; return end;      
  1027.       #OUT + "TR_INT_LIT_EXPR: \n";
  1028.       end;
  1029.       
  1030.    TR_FLT_LIT_EXPR_out(t:TR_FLT_LIT_EXPR) is
  1031.       if void(t) then #OUT + "void"; return end;      
  1032.       #OUT + "TR_FLT_LIT_EXPR: \n";
  1033.       end;
  1034.       
  1035.    TR_PARAM_DEC_out(t:TR_PARAM_DEC) is
  1036.       if void(t) then #OUT + "void"; return end;      
  1037.       #OUT + "TR_PARAM_DEC: \n";
  1038.       end;
  1039.       
  1040.    TR_TYPE_SPEC_out(t:TR_TYPE_SPEC) is
  1041.       if void(t) then #OUT + "void"; return end;      
  1042.       #OUT + "TR_TYPE_SPEC: \n";
  1043.       name::=t.name.str;
  1044.       if ~void(name) then
  1045.       #OUT + "   name = " + t.name.str + '\n';
  1046.       end;
  1047.       #OUT + "   params:\n";
  1048.       TR_TYPE_SPEC_out(t.params);
  1049.       end;
  1050.       
  1051.    TR_ARG_DEC_out(t:TR_ARG_DEC) is
  1052.       if void(t) then #OUT + "void"; return end;      
  1053.       #OUT + "TR_ARG_DEC: \n";
  1054.       end;
  1055.       
  1056.    TR_FEAT_MOD_out(t:TR_FEAT_MOD) is
  1057.       if void(t) then #OUT + "void"; return end;      
  1058.       #OUT + "TR_FEAT_MOD: \n";
  1059.       end;
  1060.       
  1061.    TR_CASE_WHEN_out(t:TR_CASE_WHEN) is
  1062.       if void(t) then #OUT + "void"; return end;      
  1063.       #OUT + "TR_CASE_WHEN: \n";
  1064.       end;
  1065.       
  1066.    TR_TYPECASE_WHEN_out(t:TR_TYPECASE_WHEN) is
  1067.       if void(t) then #OUT + "void"; return end;      
  1068.       #OUT + "TR_TYPECASE_WHEN: \n";
  1069.       end;
  1070.       
  1071.    TR_PROTECT_WHEN_out(t:TR_PROTECT_WHEN) is
  1072.       if void(t) then #OUT + "void"; return end;      
  1073.       #OUT + "TR_PROTECT_WHEN: \n";
  1074.       end;
  1075.       
  1076. end;
  1077.  
  1078. -------------------------------------------------------------------
  1079.