Changeset 2366


Ignore:
Timestamp:
Feb 10, 2007, 5:28:45 AM (14 years ago)
Author:
orlov
Message:
  • Java and JBC backends adopted changes in ASAIL.
Location:
to-imperative/trunk/compiler
Files:
3 edited

Legend:

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

    r2362 r2366  
    423423      <Chars-To-Bytes e.accum> : e s.c e,
    424424        <">" (s.c) (127)> =
    425         ' + Char::create_expr ("' e.accum '")' <Const-Expr-Aux () e.expr>;
     425        ' + rftype::Char::create_expr ("' e.accum '")' <Const-Expr-Aux () e.expr>;
    426426      //' + Expr::create_seq<Char> (L"' e.accum '")' <Const-Expr-Aux () e.expr>;
    427       ' + Char::create_expr (L"' e.accum '")' <Const-Expr-Aux () e.expr>;
     427      ' + rftype::Char::create_expr (L"' e.accum '")' <Const-Expr-Aux () e.expr>;
    428428    };
    429429  e.expr : t.item e.rest, t.item : {
  • to-imperative/trunk/compiler/rfp_asail_java.rf

    r2073 r2366  
    5151$func Var-To-Java t.var = e.java-var;
    5252
    53 $func Cond-To-Java s.acc e.cond = e.JAVA-Cond;
     53$func Cond-To-Java s.acc t.cond = e.JAVA-Cond;
    5454
    5555$func Infix-To-Java s.acc s.func-for-converting-args-to-java s.op e.args = e.java-expr;
    56 
    57 $func Op-Arg-To-Java s.op = s.func-for-converting-args-to-java;
    5856
    5957$func Access-Mode t.name = e.java-access-mode;
     
    106104ASAIL-To-Java e.asail, {
    107105  e.asail : t.item e.rest, t.item : {
    108     (s.tag t.name (e.args) (e.ress) e.body),
     106    (s.tag IMPORT e) = /*empty*/;
     107    (s.tag s.linkage t.name (e.args) (e.ress) e.body),
    109108      s.tag : \{
    110109        FUNC  = ('void') /*empty*/;
     
    122121    (TRACE t.name) =
    123122      <Bind &RFP-Trace (t.name) ()>;
    124     (IF (e.cond) e.body) =
    125       <Box> :: s.acc,
    126       <Cond-To-Java s.acc e.cond> :: e.j-cond,
    127       {
    128         e.cond : (NOT (CALL e)) =
     123    (IF-INT-CMP s.op (e.arg1) (e.arg2) e.body) =
     124      <Box> :: s.acc,
     125      <Expr-Int-To-Java s.acc e.arg1> ' 's.op' ' <Expr-Int-To-Java s.acc e.arg2> :: e.cond,
     126      <? s.acc>
     127      ('if (' e.cond ')')
     128      ('{' (<ASAIL-To-Java e.body>) '}');
     129    (IF t.cond e.body) =
     130      <Box> :: s.acc,
     131      <Cond-To-Java s.acc t.cond> :: e.j-cond,
     132      {
     133        t.cond : (CALL-FAILS e) =
    129134          () (<? &Res-Assigns> <Store &Res-Assigns /*empty*/>);
    130135        (<? &Res-Assigns> <Store &Res-Assigns /*empty*/>) ();
     
    137142      )'}' )
    138143      e.if-not-assigns;
    139     (FOR (e.cont-label) (e.break-label) (e.cond) (e.step) e.body) =
     144    (FOR (e.cont-label) (e.break-label) () (e.step) e.body) =
    140145      {
    141146        e.cont-label : t = <Rfp2Java (LABEL e.cont-label)> ': ';;
     
    144149        e.break-label : t = <Rfp2Java (LABEL e.break-label)> ': ';;
    145150      } :: e.break,
    146       <Box> :: s.acc,
    147       <Cond-To-Java s.acc e.cond> :: e.cond,
    148151      {
    149152        e.step : (s.d e.var), s.d : \{ INC-ITER; DEC-ITER; } =
     
    152155          ('Expr '<Rfp2Java t.var2>' = 'e.new-var'.getRight();');;
    153156      } :: e.split-vars,
    154       <? s.acc>
    155       (e.break e.cont 'for ( ; 'e.cond'; '<Step-To-Java e.step>')')
     157      (e.break e.cont 'for ( ; ; '<Step-To-Java e.step>')')
    156158      ('{' (
    157159        e.split-vars <? &Res-Assigns> <Store &Res-Assigns /*empty*/>
     
    239241      <Expr-Ref-To-Java e.expr> :: e.a (e.j-expr),
    240242      e.a ('throw new RefalException ('e.j-expr');');
    241     (CONSTEXPR s.linkage t.name (e.comment) e.expr) =
     243    (CONSTEXPR s.linkage t.name (e.comment) e.expr),
    242244      {
    243245        t.name : (STATIC e) = <Rfp2Java t.name>;
     
    373375};
    374376
    375 Cond-To-Java s.acc expr = expr : {
    376   /*empty*/ = /*empty*/;
    377   (CALL t.name (e.args) (e.ress)) =
     377Cond-To-Java s.acc t.cond = t.cond : {
     378  (CALL-FAILS (CALL t.name (e.exprs) (e.ress))) =
    378379    <Declare-Results (e.ress)> :: e.decls (e.ress),
    379     <Expr-Args-To-Java e.args Result e.ress> :: e.arrays (e.args),
     380    <Expr-Args-To-Java e.exprs Result e.ress> :: e.arrays (e.args),
    380381    <Put s.acc e.arrays e.decls>,
    381     <Name-To-Java t.name>' ('e.args')';
     382    '!'<Name-To-Java t.name>' ('e.args')';
     383  (ITER-FAILS e.expr) =
     384    '!'<Middle 0 2 <Lookup &Iter-Vars e.expr>>'.isValid ()';
    382385  (SYMBOL? e.expr (e.pos)) =
    383386    <Expr-Ref-To-Java e.expr> :: e.a (e.j-expr),
    384387    <Put s.acc e.a>,
    385388    e.j-expr'.symbolAt ('<Expr-Int-To-Java s.acc e.pos>')';
    386   (CHECK-ITER e.expr) =
    387     <Middle 0 2 <Lookup &Iter-Vars e.expr>>'.isValid ()';
    388389  (EQ e.expr1 (e.expr2) (e.pos)) =
    389390    <Expr-Ref-To-Java e.expr1> :: e.a1 (e.j-expr1),
     
    396397    <Put s.acc e.a1 e.a2>,
    397398    e.j-expr1'.eq ('e.j-expr2', '<Expr-Int-To-Java s.acc e.pos> ')';
    398   (NOT e.cond) =
    399     '!' <Cond-To-Java s.acc e.cond>;
    400   (INFIX s.op e.args) =
    401     {
    402       s.op : \{ "+"; "-"; "%"; "*"; "/"; } =
    403         <Infix-To-Java s.acc &Expr-Int-To-Java s.op e.args>' != 0';
    404       '(' <Infix-To-Java s.acc <Op-Arg-To-Java s.op> s.op e.args> ')';
    405     };
    406   expr = '(' <Infix-To-Java s.acc &Cond-To-Java "&&" <Paren expr>> ')';
     399  (NOT t.not-cond) =
     400    '!' <Cond-To-Java s.acc t.not-cond>;
    407401};
    408402
     
    417411};
    418412
    419 Op-Arg-To-Java s.op, {
    420   s.op : \{ "&&"; "||"; } =
    421     &Cond-To-Java;
    422   s.op : \{ "<"; ">"; "<="; ">="; "=="; "!="; "+"; "-"; "%"; "*"; "/"; } =
    423     &Expr-Int-To-Java;
    424 };
    425  
    426413Step-To-Java {
    427414  /*empty*/ = /*empty*/;
  • to-imperative/trunk/compiler/rfp_asail_jbc.rf

    r2361 r2366  
    180180      } :: e.p,
    181181      <Subst (<? &Dir-Separator>) (('/')) e.p>;
     182    LOCAL = /*empty*/;
    182183  } :: e.p,
    183184  <To-Word e.p <Rfp2Java s.module-name>>;
     
    191192Module-To-JBC s.cw e.module, {
    192193  e.module : e t.item e, t.item : {
    193     (s.tag t.name (e.args) (e.ress) e.body),
     194    (s.tag IMPORT e) = /*empty*/;
     195    (s.tag s.linkage t.name (e.args) (e.ress) e.body),
    194196      s.tag : \{
    195197        FUNC  = 'V';
     
    516518Cond-To-JBC {
    517519  (CALL-FAILS (CALL (s.module s.name) (e.args) (e.ress))) =
    518   /*
    519     '!RF_CALL (' <Name-To-CPP t.name> ', '
    520           <Args-To-CPP () Exprs e.exprs> ', '
    521           <Args-To-CPP () Vars e.ress>   ')';*/
    522520    <Qualified-Module-Name s.module> :: s.module,
    523521    <To-Word <Rfp2Java s.name>> :: s.name,
Note: See TracChangeset for help on using the changeset viewer.