Changeset 694


Ignore:
Timestamp:
Apr 29, 2003, 6:04:27 AM (18 years ago)
Author:
orlov
Message:
  • Added parentheses around t.label int the LABEL form in ASAIL.
  • Corrected Expr-variables defenitions.
Location:
to-imperative/trunk/compiler
Files:
5 edited

Legend:

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

    r683 r694  
    102102          ('{' (<ASAIL-To-CPP e.body>) '}' );
    103103        ('{' (<ASAIL-To-CPP e.body>) '}')
    104         (LABEL <Rfp2Cpp (LABEL (e.label))> ': {}');
     104        (LABEL <Rfp2Cpp (LABEL e.label)> ': {}');
    105105      };
    106106    (TRY e.body) =
  • to-imperative/trunk/compiler/rfp_asail_optim.rf

    r661 r694  
    8787            {
    8888              e.res-cond:1 = e.body-opt;
    89               (IF (e.res-cond) e.body-opt );
     89              (IF (e.res-cond) e.body-opt );
    9090            };
    9191        }; 
     
    398398        0 = <Optim-Cond (e.init) e.rest>;
    399399        1 = 0;
    400         e.res = <Optim-Cond (e.init (NOT e.res)) e.rest>;
    401         };
     400        e.res = <Optim-Cond (e.init (NOT e.res)) e.rest>;
     401        };
    402402    (INFIX s.op e.args) =  {
    403403      s.op : \{ "&&"; "||"; } =
     
    406406      s.op : \{ "<"; ">"; "<="; ">="; "=="; } =
    407407        <Optim-Int-Args e.args> :: e.args-opt,
    408           <Optim-Cond-Int s.op e.args-opt >;
     408          <Optim-Cond-Int s.op e.args-opt >;
    409409      };
    410410    };
     
    418418      <AND-Args e.res> :: e.log, {
    419419        e.log: /*empty*/ = 1;
    420         (INFIX "&&" e.log);
    421         };
     420        (INFIX "&&" e.log);
     421        };
    422422      };
    423423    "||" = {
     
    470470    };
    471471// e.args : (0)  (e.arg2) = s.op : {
    472 //      "<=" = 1;
    473 //      ">" = 0;
    474 //      s.op =  (INFIX s.op e.args);
    475 //      };
     472//  "<=" = 1;
     473//  ">" = 0;
     474//  s.op =      (INFIX s.op e.args);
     475//  };
    476476// e.args : (e.arg1) (0) = s.op : {
    477 //      "<" = 0;
    478 //      ">=" = 1;
    479 //      s.op =  (INFIX s.op e.args);
    480 //      };
     477//  "<" = 0;
     478//  ">=" = 1;
     479//  s.op =      (INFIX s.op e.args);
     480//  };
    481481  e.args : (e.arg1)(e.arg1) = s.op:{
    482482    "==" = 1;
     
    540540      <Correct-Label e.body> :: e.body-label,                                                                   
    541541      (FOR (t.label-used) (e.cond) t.step e.body-label);
    542     (LABEL t.label e.body) =
     542    (LABEL (t.label) e.body) =
    543543      <Label-In-Table t.label> :: t.label-used,
    544544      <Correct-Label e.body> :: e.body-label,
     
    554554
    555555Label-In-Table (e.label) = {
    556   <In-Table? &Used-Label  e.label> = (e.label);
     556  <In-Table? &Used-Label  e.label> = ((e.label));
    557557   ();
    558558};
  • to-imperative/trunk/compiler/rfp_compile.rf

    r686 r694  
    249249//!     <Declare-Vars Expr e.arg-vars> : e,
    250250  <Vars <Gener-Vars (e.in) "arg">> :: e.arg-vars,
    251   <Vars-Decl e.res-vars> : e,
     251  <Vars-Decl e.arg-vars> : e,
    252252*       <Instantiate-Vars e.arg-vars>,
    253253  <Store &Last-Re /*empty*/>,
     
    259259    <Comp-Sentence Tail ((t.retfail)) () e.Sentence>
    260260  ) :: e.comp-func,
    261   <Set-Drops () <Gener-Var-Names e.comp-func>> :: t e.comp-func,
     261*       <Set-Drops () <Gener-Var-Names e.comp-func>> :: t e.comp-func,
     262  <Gener-Var-Names e.comp-func> :: e.comp-func,
    262263//!     <Post-Comp (e.res-vars) e.comp-func> :: t e.result,
    263264//!     e.result;
     
    325326          e.rest (e.result-func t.first) (e.declared t.var s.init);
    326327        };
    327       t.first : (LABEL t.label e.expr) =
     328      t.first : (LABEL (t.label) e.expr) =
    328329        <Set-Drops (e.declared) e.expr> :: (e.declared) e.expr,
    329         e.rest (e.result-func (LABEL t.label e.expr)) (e.declared);
     330        e.rest (e.result-func (LABEL (t.label) e.expr)) (e.declared);
    330331      t.first : (e.expr) =
    331332        <Set-Drops (e.declared) e.expr> :: t e.expr,
     
    488489        > :: e.comp-br,
    489490        <Recall-Snt-State>,
    490         (e.rest-br) e.comp-branches (LABEL t.br-label e.comp-br (BREAK t.label));
     491        (e.rest-br) e.comp-branches (LABEL (t.br-label) e.comp-br (BREAK t.label));
    491492    } :: (e.branches) e.comp-branches,
    492493    e.branches : (BRANCH e.branch) =
     
    495496    > :: e.last-branch,
    496497    <Pop-Snt-State>,
    497     e.decls (LABEL t.label e.comp-branches e.last-branch)
     498    e.decls (LABEL (t.label) e.comp-branches e.last-branch)
    498499    <Comp-Sentence s.tail? (v.fails) () e.Snt>;
    499500
     
    522523    <Pop-Snt-State>,
    523524    <Comp-Sentence Notail (v.fails) () e.body t.format> :: e.comp-body,
    524     (FOR () () () (LABEL t.label e.comp-condition) e.comp-body);
     525    (FOR () () () (LABEL (t.label) e.comp-condition) e.comp-body);
    525526
    526527  /*
     
    605606      :: e.comp-negation,
    606607//    <Pop-Snt-State>,
    607     (LABEL t.label e.comp-negation)     <Comp-Sentence s.tail? (v.fails) () e.Snt>;
     608    (LABEL (t.label) e.comp-negation)   <Comp-Sentence s.tail? (v.fails) () e.Snt>;
    608609
    609610//  (Comp Verbatim expr) = expr;
     
    20802081        (LSPLIT t.var ((VAR ("min" e.SplitName))) t.var-e1 t.var-e2)
    20812082      )
    2082       (Cond LABEL t.break-label)
     2083      (Cond LABEL (t.break-label))
    20832084      (Cond FOR (t.cont-label) () ((INC-ITER t.var)))
    20842085      (Fail (BREAK t.break-label))
     
    21022103        (RSPLIT t.var ((VAR ("min" e.SplitName))) t.var-e1 t.var-e2)
    21032104      )
    2104       (Cond LABEL t.break-label)
     2105      (Cond LABEL (t.break-label))
    21052106      (Cond FOR (t.cont-label) () ((INC-ITER t.var)))
    21062107      (Fail (BREAK t.break-label))
  • to-imperative/trunk/compiler/rfp_vars.rf

    r683 r694  
    7575Decl-Var t.var, {
    7676 
    77   <? &State> : $r e1 (t.var tag t.min t.max s.decl? e.rest) e2 =
     77  <? &State> : $r e1 (t.var tag t.min t.max s.decl e.rest) e2 =
    7878    {
    79       s.decl? : Declared;
    80       <Store &State e1 (t.var tag t.min t.max Declared e.rest) e2>;
    81     },
    82     (DECL "Expr" <Print-Var t.var>);
     79      <Box? s.decl> = s.decl;
     80      <Box (DECL "Expr" <Print-Var t.var>)> :: s.decl,
     81        <Store &State e1 (t.var tag t.min t.max s.decl e.rest) e2>,
     82        s.decl;
     83    } :: s.decl,
     84    (Declare s.decl);
    8385 
    8486  <Create-Var t.var> : e, <Decl-Var t.var>;
     
    8789
    8890Declared? t.var =
    89   <? &State> : $r e (t.var tag t.min t.max s.decl? e.rest) e =
    90   s.decl? : Declared;
    91 
     91  <? &State> : $r e (t.var tag t.min t.max s.decl e.rest) e = <Box? s.decl>;
     92
     93
     94$func? Decl-Box t.var = s.box;
     95
     96Decl-Box t.var =
     97  <? &State> : $r e (t.var tag t.min t.max s.decl e.rest) e = <Box? s.decl>, s.decl;
    9298
    9399
     
    121127
    122128Gener-Var-Assign t.var (s.tag s.box) =
    123   <Store s.box <Vars-Print t.var>>,
    124   <Vars-Decl t.var>;
     129  <Store s.box <Print-Var t.var>>,
     130  {
     131    <Declared? t.var>, <Store <Decl-Box (s.tag s.box)> /*empty*/>;;
     132  };
    125133
    126134
     
    149157      t.var = <Boxes-To-Vars t.var expr>;
    150158    };
     159  (Declare s.decl) expr = <Boxes-To-Vars <? s.decl> expr>;
    151160  (e1) e2   = (<Boxes-To-Vars e1>) <Boxes-To-Vars e2>;
    152161  term expr = term <Boxes-To-Vars expr>;
     
    167176    <Put &Var-Names s.n>, s.n;
    168177  };
     178
    169179
    170180
     
    185195      (PAREN expr) <Gener-Var-Indices s.num (e.rest) e.prefix>;
    186196    (s.VariableTag) =
    187       (s.VariableTag (PRAGMA) (e.prefix s.num)) :: t.var,
     197      (VAR (PRAGMA) (e.prefix s.num)) :: t.var,
    188198      <"+" s.num 1> :: s.num,
    189199      t.var <Gener-Var-Indices s.num (e.rest) e.prefix>;
  • to-imperative/trunk/compiler/rfp_vars.rfi

    r683 r694  
    1818$func? Generated-Var? e.Re = ;
    1919
    20 $func Gener-Var-Assign t.var e.generated-var = e.var-declaration;
     20$func Gener-Var-Assign t.var e.generated-var = ;
    2121
    2222$func Gener-Var-Names e.expr-with-unspecified-var-names = e.expr-with-resolved-var-names;
Note: See TracChangeset for help on using the changeset viewer.