Changeset 3921


Ignore:
Timestamp:
Sep 16, 2008, 6:27:20 PM (12 years ago)
Author:
orlov
Message:
  • More correct concatenation for T.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/compiler/refal/org/refal/plus/compiler/rfp_asail_tpp.rf

    r3919 r3921  
    5959
    6060$func Infix_To_CPP (e.box) s.func_for_converting_args_to_cpp s.op e.args = e.cpp_expr;
     61$func Concat_To_TPP (e.box) s.func_for_converting_args_to_tpp e.args = e.tpp_expr;
    6162
    6263$func Trace_Enter e.name (e.args) = e.trace;
     
    281282    (DECL s.type t.var (SUBEXPR e.expr (e.pos) (e.len))) =
    282283      <Box> :: s.tvars,
    283       <Term_Ref_To_CPP s.tvars (SUBEXPR e.expr (e.pos) (e.len))> : 'TExpr ' e.constr,
     284      <Term_Ref_To_CPP s.tvars (SUBEXPR e.expr (e.pos) (e.len))> : 'TExpr ' e.constr '.get_ref()',
    284285      ('TExpr '<Rfp2Cpp t.var> e.constr';');
    285286    (DECL s.type t.var (DEREF e.expr (e.pos))) =
     
    379380$func Term_Ref_To_Terms e.term = e;
    380381Term_Ref_To_Terms {
    381   (STATIC t.name) = <Term_Ref_To_CPP <Box> (STATIC t.name)>;
     382  (STATIC t.name) =
     383    <Bind &Used_Consts ((STATIC t.name)) ()>,
     384    <Rfp2Cpp (STATIC t.name)>;
     385  (REF t.name) =
     386    <Bind &Used_Consts (t.name) ()>,
     387    <Name_To_CPP "DECL-OBJ" t.name>;
    382388  e.term = '((Expr&)'<Term_Ref_To_CPP <Box> e.term>')';
    383389};
    384390
    385 $func Term_Ref_To_TExpr e.term = e;
    386 Term_Ref_To_TExpr {
    387   (STATIC t.name) = 'TExpr('<Term_Ref_To_CPP <Box> (STATIC t.name)>')';
    388   e.term = <Term_Ref_To_CPP <Box> e.term>;
    389 };
     391//$func Term_Ref_To_TExpr e.term = e;
     392//Term_Ref_To_TExpr {
     393//  (STATIC t.name) = 'TExpr('<Term_Ref_To_CPP <Box> (STATIC t.name)>')';
     394//  e.term = <Term_Ref_To_CPP <Box> e.term>;
     395//};
    390396
    391397Expr_Ref_To_CPP s.tvars e.expr = e.expr : {
    392398  /*empty*/ = 'TExpr(empty)';
    393399  term = <Term_Ref_To_CPP s.tvars term>;
    394   expr = '(' <Infix_To_CPP () &Term_Ref_To_TExpr "+" <Paren expr>> ')';
     400  expr = '(' <Concat_To_TPP (<Box>) &Term_Ref_To_CPP <Paren expr>> ')';
    395401};
    396402
    397403Term_Ref_To_CPP s.tvars e.arg = e.arg : {
    398404  (PAREN e.expr) =
    399     <Expr_Ref_To_CPP s.tvars e.expr> ' ()';
     405    <Expr_Ref_To_CPP s.tvars e.expr> ' ().get_ref()';
    400406  (DEREF e.expr (e.pos)) =
    401     'TExpr (' <Expr_Ref_To_CPP s.tvars e.expr> ', ' <Expr_Int_To_CPP e.pos> ')';
     407    'TExpr (' <Expr_Ref_To_CPP s.tvars e.expr> ', ' <Expr_Int_To_CPP e.pos> ').get_ref()';
    402408  (SUBEXPR e.expr (e.pos) (e.len)) =
    403409    'TExpr (' <Expr_Ref_To_CPP s.tvars e.expr> ', '
    404         <Expr_Int_To_CPP e.pos>   ', ' <Expr_Int_To_CPP e.len> ')';
     410        <Expr_Int_To_CPP e.pos>   ', ' <Expr_Int_To_CPP e.len> ').get_ref()';
    405411  (REF t.name) =
    406412    <Bind &Used_Consts (t.name) ()>,
    407     <Name_To_CPP "DECL-OBJ" t.name>;
     413    'TExpr ('<Name_To_CPP "DECL-OBJ" t.name>').get_ref()';
    408414  "ERROR-EXPR" = 'err';
    409415  (STATIC t.name) =
     
    414420      <Get &Module_Name>'::';
    415421    } :: e.prefix,
    416     e.prefix <Rfp2Cpp (STATIC t.name)>;
     422    'TExpr ('e.prefix <Rfp2Cpp (STATIC t.name)>').get_ref()';
    417423  (s.var_tag e.ns t.name) = <Rfp2Cpp (s.var_tag e.ns t.name)>;
    418   s.sym, {
    419     <IsInt s.sym> =
    420       'Expr::create<' <Get &Int> '>("' s.sym '")';
    421     <IsWord s.sym> =
    422       'Expr::create<rftype::Word>("' <Symbol_To_CPP s.sym> '")';
    423   };
     424//T/  s.sym, {
     425//T/    <IsInt s.sym> =
     426//T/      'Expr::create<' <Get &Int> '>("' s.sym '")';
     427//T/    <IsWord s.sym> =
     428//T/      'Expr::create<rftype::Word>("' <Symbol_To_CPP s.sym> '")';
     429//T/  };
    424430};
    425431
     
    475481    {
    476482      e.arg : v, e.rest : v = e.arg ' ' s.op ' ' e.rest;
     483      e.arg e.rest;
     484    };;
     485};
     486
     487Concat_To_TPP (e.box) s.arg2cpp e.args, {
     488  e.args : (e.arg) e.rest =
     489    <Apply s.arg2cpp e.box e.arg> :: e.arg,
     490    <Concat_To_TPP (e.box) s.arg2cpp e.rest> :: e.rest,
     491    {
     492      e.arg : v, e.rest : v = '('e.arg ' + ' e.rest').get_ref()';
    477493      e.arg e.rest;
    478494    };;
Note: See TracChangeset for help on using the changeset viewer.