Changeset 2052


Ignore:
Timestamp:
Aug 6, 2006, 3:14:31 AM (14 years ago)
Author:
orlov
Message:
  • Some fixes related to variables naming.
Location:
to-imperative/trunk/compiler
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/compiler/rfp_as2as.rf

    r2043 r2052  
    1010$use "rfp_debug";
    1111
    12 $use Arithm Class List StdIO Table;
     12$use Arithm Box Class List StdIO Table;
    1313
    1414// transform only e.targets and leave all the rest as it is
     
    1919
    2020// remove blocks from Re
    21 $func Flatten-Result s.N (e.Re) e.items = e.assigns s.N (e.Re);
     21$func Flatten-Result (e.Re) e.items = e.assigns (e.Re);
    2222
    2323$func Generate-In-Vars (e.in) e.branch = (e.in) e.branch;
     
    3939
    4040// build substitution for all occurrences of variable with the name t.n in e.Snt
    41 $func Var-Subst t.n t.s e.Snt = (e.patterns) (e.replacements);
     41$func Var-Subst s.var-tag t.n t.s e.Snt = (e.patterns) (e.replacements);
     42
     43$box Free-Idx;
    4244
    4345
     
    6466        e.branch;
    6567      } :: e.branch,
     68      <Store &Free-Idx 1>,
    6669      <Unstick-Blocks e.branch> :: e.branch t,
    6770      <Rename-Vars 0 (<Vars e.in>) () e.branch> :: e.branch,
     
    108111    };
    109112  (RESULT t.Pragma e.Re) eR =
    110     <Flatten-Result 1 () e.Re> :: e.assigns s (e.Re),
     113    <Flatten-Result () e.Re> :: e.assigns (e.Re),
    111114    {
    112115      eR : v =
     
    131134};
    132135
    133 Flatten-Result s.N (e.Re) e.items, e.items : {
     136Flatten-Result (e.Re) e.items, e.items : {
    134137  t1 e.rest, t1 : \{ (BLOCK e); (BLOCK? e); } =
    135138    <Format-Exp e.Re> :: e.Fe,
    136139    <MSG (e.Fe) (e.Fe)> :: e.Fe,  // hack for avoiding non-hard formats
     140    <? &Free-Idx> : s.N,
    137141    <Gener-Var-Indices s.N (e.Fe) "aux" "result"> :: e.aux1 s.N,
     142    <Store &Free-Idx s.N>,
    138143    <Unstick-Blocks t1> :: e1 (e.Format),
    139     <Gener-Var-Indices s.N (e.Format) "aux" "block"> :: e.aux2 s.N,
     144    <? &Free-Idx> : s.N2,
     145    <Gener-Var-Indices s.N2 (e.Format) "aux" "block"> :: e.aux2 s.N2,
     146    <Store &Free-Idx s.N2>,
    140147    (RESULT (PRAGMA) e.Re) (FORMAT (PRAGMA) e.aux1)
    141148    e1 (FORMAT (PRAGMA) e.aux2)
    142     <Flatten-Result s.N (e.aux1 e.aux2) e.rest>;
     149    <Flatten-Result (e.aux1 e.aux2) e.rest>;
    143150  (CALL t.p t.name e.r) e.rest =
    144     <Flatten-Result s.N () e.r> :: e.assigns s.N (e.r),
     151    <Flatten-Result () e.r> :: e.assigns (e.r),
    145152    {
    146153      e.assigns : v =
    147154        <Format-Exp e.Re> :: e.Fe,
    148155        <MSG (e.Fe) (e.Fe)> :: e.Fe,  // hack for avoiding non-hard formats
     156        <? &Free-Idx> : s.N,
    149157        <Gener-Var-Indices s.N (e.Fe) "aux" "result"> :: e.aux1 s.N,
     158        <Store &Free-Idx s.N>,
    150159        (RESULT (PRAGMA) e.Re) (FORMAT (PRAGMA) e.aux1)
    151         e.assigns <Flatten-Result s.N (e.aux1 (CALL t.p t.name e.r)) e.rest>;
    152       <Flatten-Result s.N (e.Re (CALL t.p t.name e.r)) e.rest>;
     160        e.assigns <Flatten-Result (e.aux1 (CALL t.p t.name e.r)) e.rest>;
     161      <Flatten-Result (e.Re (CALL t.p t.name e.r)) e.rest>;
    153162    };
    154163  (PAREN e.r) e.rest =
    155     <Flatten-Result s.N () e.r> :: e.assigns s.N (e.r),
    156     e.assigns <Flatten-Result s.N (e.Re (PAREN e.r)) e.rest>;
    157   t1 e.rest = <Flatten-Result s.N (e.Re t1) e.rest>;
    158   /*empty*/ = s.N (e.Re);
     164    <Flatten-Result () e.r> :: e.assigns (e.r),
     165    e.assigns <Flatten-Result (e.Re (PAREN e.r)) e.rest>;
     166  t1 e.rest = <Flatten-Result (e.Re t1) e.rest>;
     167  /*empty*/ = (e.Re);
    159168};
    160169
     
    307316  e.new-Snt;
    308317
    309 Old-Var? e.vars (s.tag t (e.QualifiedName)) = e.vars : e (s.tag t (e.QualifiedName)) e;
     318//Old-Var? e.vars (s.tag t (e.QualifiedName)) = e.vars : e (s.tag t (e.QualifiedName)) e;
     319Old-Var? e.vars (e t.name) = e.vars : e (e t.name) e;
    310320
    311321Rename s.num (s.tag t.p (e.QualifiedName)) =
     
    316326 */
    317327Build-Subst {
    318   ((s t t.name) e.vars) ((s t t.s) e.substs) e.Snt =
    319     <Var-Subst t.name t.s e.Snt> :: (e.var-pats) (e.var-repls),
     328  ((s.tag t t.name) e.vars) ((s t t.s) e.substs) e.Snt =
     329    <Var-Subst s.tag t.name t.s e.Snt> :: (e.var-pats) (e.var-repls),
    320330    <Build-Subst (e.vars) (e.substs) e.Snt> :: (e.pats) (e.repls),
    321331    (e.var-pats e.pats) (e.var-repls e.repls);
     
    326336 * Build substitution for all occurrences of variable with the name t.n in e.Snt.
    327337 */
    328 Var-Subst t.n t.s e.Snt, {
     338Var-Subst s.tag t.n t.s e.Snt, {
    329339  e.Snt : t.Statement e.rest, {
    330     t.Statement : \{
    331       (SVAR t.p t.name) = SVAR t.p t.name;
    332       (TVAR t.p t.name) = TVAR t.p t.name;
    333       (VVAR t.p t.name) = VVAR t.p t.name;
    334       (EVAR t.p t.name) = EVAR t.p t.name;
    335     } :: s.tag t.p t.name,
     340    t.Statement : (s.tag t.p t.name) =
    336341      {
    337342        t.name : t.n = ((s.tag t.p t.name)) (((s.tag t.p t.s)));
    338343        () ();
    339344      };
    340     t.Statement : (expr) = <Var-Subst t.n t.s expr>;
     345    t.Statement : (expr) = <Var-Subst s.tag t.n t.s expr>;
    341346    () ();
    342347  } :: (e.st-pats) (e.st-repls),
    343     <Var-Subst t.n t.s e.rest> :: (e.pats) (e.repls),
     348    <Var-Subst s.tag t.n t.s e.rest> :: (e.pats) (e.repls),
    344349    (e.st-pats e.pats) (e.st-repls e.repls);
    345350  () ();
  • to-imperative/trunk/compiler/rfp_compile.rf

    r2043 r2052  
    764764 */
    765765Prepare-Vars {
    766   (s.var-tag (e.prefix s.n)) e.rest, <Int? s.n> =
    767     {
    768       <Lookup &Prep-Vars (s.var-tag (e.prefix s.n))>;
    769       <Gener-Vars ((s.var-tag)) e.prefix> :: e.var,
    770         <Bind &Prep-Vars ((s.var-tag (e.prefix s.n))) (e.var)>,
    771         e.var;
    772     } :: e.var,
    773     e.var <Prepare-Vars e.rest>;
     766//  (s.var-tag (e.prefix s.n)) e.rest, <Int? s.n> =
     767//    {
     768//      <Lookup &Prep-Vars (s.var-tag (e.prefix s.n))>;
     769//      <Gener-Vars ((s.var-tag)) e.prefix> :: e.var,
     770//        <Bind &Prep-Vars ((s.var-tag (e.prefix s.n))) (e.var)>,
     771//        e.var;
     772//    } :: e.var,
     773//    e.var <Prepare-Vars e.rest>;
    774774  t.var e.rest = t.var <Prepare-Vars e.rest>;
    775775  /*empty*/ = /*empty*/;
  • to-imperative/trunk/compiler/rfp_vars.rf

    r2043 r2052  
    169169$func Print-Var e = e;
    170170
    171 Vars-Print e.vars = <Map &Print-Var (e.vars)>;
     171//Vars-Print e.vars = <Map &Print-Var (e.vars)>;
     172Vars-Print e.vars = e.vars;
    172173
    173174Print-Var {
    174   (s.tag (e.name)) = (s.tag (<To-Word e.name>));
     175  t1 = t1;
     176//  (s.tag (e.name)) = (s.tag (<To-Word e.name>));
    175177  (s.tag s.box)    = (s.tag s.box);
    176178};
Note: See TracChangeset for help on using the changeset viewer.