Changeset 2727


Ignore:
Timestamp:
Apr 23, 2007, 9:53:12 PM (14 years ago)
Author:
orlov
Message:
  • Accept Refal AS without pragmas.
  • Remove pragmas in as2as.
  • Function rfpc.CompileASToJBC to be called from Eclipse.
Location:
to-imperative/trunk/compiler
Files:
11 edited

Legend:

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

    r2715 r2727  
    2828$func? IsOld_Var e = e;
    2929
    30 //$func Rename s.num (s.tag t.p (e.QualifiedName)) =
    31 //                      (s.tag t.p ("ren" e.QualifiedName s.num));
    32 $func Rename e = e;
     30$func Rename s.num (s.tag (e.name)) = (s.tag (e.name "_" s.num));
    3331
    3432// build substitution for all occurrences of each e.var in e.Snt
     
    3735// build substitution for all occurrences of variable with the name t.n in e.Snt
    3836$func Var_Subst s.var_tag t.n t.s e.Snt = (e.patterns) (e.replacements);
     37
     38$func Del_Pragmas e.Sentence = e.Sentence;
    3939
    4040$box Free_Idx;
     
    5050      e.targets : v =
    5151        e.targets : e t.name e,
    52         t.item : (t t t t.name e);;
     52        t.item : \{
     53          (t t (PRAGMA (e.file) (e.line)) t.name e);
     54          (t t t.name e);
     55        };;
    5356    },
    54       t.item : (s.link s.tag t.pragma t.name (e.in) (e.out) (BRANCH t.p e.branch)) =
     57      t.item : (s.link s.tag e.pragma t.name (e.in) (e.out) (BRANCH e.branch)) =
    5558      {
    56         <Vars e.in> : \{
    57           /*empty*/;
    58           e (s.VarTag) e;
    59         } =
     59        e.pragma : (PRAGMA e) =
     60          e.branch : t.p e.br = (t.p) e.br;
     61        () e.branch;
     62      } :: (e.p) e.branch,
     63      {
     64//        <Vars e.in> : \{
     65//          /*empty*/;
     66//          e (s.VarTag) e;
     67//        } =
    6068          <Generate_In_Vars (<Format_Exp e.in>) e.branch>;
    6169        (e.in) e.branch;
    6270      } :: (e.in) e.branch,
    6371      {
    64         <IsInTable &RFP_Options DBG> =
    65           <Add_Debug (RESULT t.p e.in) e.branch>;
    66         e.branch;
    67       } :: e.branch,
     72        <IsInTable &RFP_Options DBG>, e.p : v =
     73          (<Del_Pragmas e.in>) <Del_Pragmas <Add_Debug (RESULT e.p e.in) e.branch>>;
     74        e.p : v =
     75          (<Del_Pragmas e.in>) <Del_Pragmas e.branch>;
     76        (e.in) e.branch;
     77      } :: (e.in) e.branch,
    6878      <Store &Free_Idx 1>,
    6979      <Unstick_Blocks e.branch> :: e.branch t,
    7080      <Rename_Vars 0 (<Vars e.in>) () e.branch> :: e.branch,
    71       (s.link s.tag t.pragma t.name (e.in) (e.out) (BRANCH t.p e.branch));
    72     t.item;
    73   } :: t.item =
    74     t.item <Transform (e.targets) e.rest>;;
     81      (s.link s.tag t.name (e.in) (e.out) (BRANCH e.branch));
     82    <Del_Pragmas t.item>;
     83  } :: e.item =
     84    e.item <Transform (e.targets) e.rest>;;
    7585};
    7686
     
    8696 */
    8797Unstick_Blocks e.Sentence, e.Sentence : eL e.Snt, e.Snt : \{
    88   (s.block t.Pragma e.branches) eR, s.block : \{ ALT; "ALT?"; } =
     98  (s.block e.branches) eR, s.block : \{ ALT; "ALT?"; } =
    8999    e.branches () () $iter {
    90       e.branches : (BRANCH t.p e.branch) e.rest,
     100      e.branches : (BRANCH e.branch) e.rest,
    91101        <Unstick_Blocks e.branch> :: e.new_branch (e.Fe),
    92         e.rest (e.br (BRANCH t.p e.new_branch)) (e.Fes (e.Fe));
     102        e.rest (e.br (BRANCH e.new_branch)) (e.Fes (e.Fe));
    93103    } :: e.branches (e.br) (e.Fes),
    94104    e.branches : /*empty*/ =
    95105    {
    96106      eR : \{
    97         (ALT    t (BRANCH t (LEFT e) e) e) e;
    98         (ALT    t (BRANCH t (RIGHT e) e) e) e;
    99         ("ALT?" t (BRANCH t (LEFT e) e) e) e;
    100         ("ALT?" t (BRANCH t (RIGHT e) e) e) e;
     107        (ALT    (BRANCH (LEFT e) e) e) e;
     108        (ALT    (BRANCH (RIGHT e) e) e) e;
     109        ("ALT?" (BRANCH (LEFT e) e) e) e;
     110        ("ALT?" (BRANCH (RIGHT e) e) e) e;
    101111        (LEFT  e) e;
    102112        (RIGHT e) e;
     
    105115        <Gener_Var_Indices s.N (<MSG e.Fes>) "aux" "alt"> :: e.aux s.N,
    106116        <Store &Free_Idx s.N>,
    107         eL (s.block t.Pragma e.br) (FORMAT (PRAGMA) e.aux)
    108         (RESULT (PRAGMA) e.aux) <Unstick_Blocks eR>;
     117        <Del_Pragmas e.aux> :: e.aux,
     118        eL (s.block e.br) (FORMAT e.aux)
     119        (RESULT e.aux) <Unstick_Blocks eR>;
    109120      eR : /*empty*/ =
    110         eL (s.block t.Pragma e.br) (<MSG e.Fes>);
    111       eL (s.block t.Pragma e.br) <Unstick_Blocks eR>;
     121        eL (s.block e.br) (<MSG e.Fes>);
     122      eL (s.block e.br) <Unstick_Blocks eR>;
    112123    };
    113   (RESULT t.Pragma (s.block e.branches)) eR, s.block : \{ ALT; "ALT?"; } =     // FIXME: Comment this and search for BUGs!
     124  (RESULT (s.block e.branches)) eR, s.block : \{ ALT; "ALT?"; } =     // FIXME: Comment this and search for BUGs!
    114125    eL <Unstick_Blocks (s.block e.branches) eR>;
    115   (RESULT t.Pragma e.Re) eR =
     126  (RESULT e.Re) eR =
    116127    <Flatten_Result Tail () e.Re> :: e.assigns (e.Re),
    117128    {
    118       e.Re : e1 (FAIL e2) = (RESULT t.Pragma e1) e2;
    119       (RESULT t.Pragma e.Re);
     129      e.Re : e1 (FAIL e2) = (RESULT e1) e2;
     130      (RESULT e.Re);
    120131    } :: e.Result,
    121132    {
     
    126137        eL e.assigns e.Result (e.Fe);
    127138    };
    128   (NOT (BRANCH t.p1 e.body)) eR =
     139  (NOT (BRANCH e.body)) eR =
    129140    <Unstick_Blocks e.body> :: e.body t.empty,
    130     eL (NOT (BRANCH t.p1 e.body)) <Unstick_Blocks eR>;
    131   (ITER (BRANCH t.p1 e.body) t.IterVars (BRANCH t.p2 e.condition)) =
     141    eL (NOT (BRANCH e.body)) <Unstick_Blocks eR>;
     142  (ITER (BRANCH e.body) t.IterVars (BRANCH e.condition)) =
    132143    <Unstick_Blocks e.body> :: e.body t,
    133144    <Unstick_Blocks e.condition> :: e.condition (e.Format),
    134     eL (ITER (BRANCH t.p1 e.body) t.IterVars (BRANCH t.p2 e.condition)) (e.Format);
    135   (TRY (BRANCH t.p1 e.TrySnt) e.NOFAIL t.CatchBlock) =
     145    eL (ITER (BRANCH e.body) t.IterVars (BRANCH e.condition)) (e.Format);
     146  (TRY (BRANCH e.TrySnt) e.NOFAIL t.CatchBlock) =
    136147    <Unstick_Blocks e.TrySnt> :: e.TrySnt t.Try_Fe,
    137148    <Unstick_Blocks t.CatchBlock> :: e.CatchBlock t.Catch_Fe,
    138     eL (TRY (BRANCH t.p1 e.TrySnt) e.NOFAIL e.CatchBlock) (<MSG t.Try_Fe t.Catch_Fe>);
    139   (FAIL e) = e.Sentence ((FAIL));
    140   (ERROR t.Pragma) eR =
     149    eL (TRY (BRANCH e.TrySnt) e.NOFAIL e.CatchBlock) (<MSG t.Try_Fe t.Catch_Fe>);
     150  (FAIL) = e.Sentence ((FAIL));
     151  (ERROR) eR =
    141152    <Unstick_Blocks eR> :: eR t,
    142     eL (ERROR t.Pragma) eR ((FAIL));
     153    eL (ERROR) eR ((FAIL));
    143154  /*empty*/ = (FAIL) ((FAIL));
    144155};
     
    153164        <Gener_Var_Indices s.N (e.Format) "aux" "block"> :: e.aux s.N,
    154165        <Store &Free_Idx s.N>,
    155         e1 (FORMAT (PRAGMA) e.aux)
     166        <Del_Pragmas e.aux> :: e.aux,
     167        e1 (FORMAT e.aux)
    156168        <Flatten_Result s.Istail (e.Re e.aux) e.rest>;
    157169    };
    158   (CALL t.p t.name e.r) e.rest =
     170  (CALL t.name e.r) e.rest =
    159171    <Flatten_Result "Not-Tail" () e.r> :: e.assigns (e.r),
    160     (CALL t.p t.name e.r) :: t1,
     172    (CALL t.name e.r) :: t1,
    161173    {
    162174      e.rest : /*empty*/, s.Istail : Tail =
     
    165177        <Gener_Var_Indices s.N (<Format_Exp t1>) "aux" "call"> :: e.aux1 s.N,
    166178        <Store &Free_Idx s.N>,
    167         e.assigns (RESULT (PRAGMA) t1) (FORMAT (PRAGMA) e.aux1)
     179        <Del_Pragmas e.aux1> :: e.aux1,
     180        e.assigns (RESULT t1) (FORMAT e.aux1)
    168181        <Flatten_Result s.Istail (e.Re e.aux1) e.rest>;
    169182    };
     
    190203   */
    191204  e.Sentence : \{
    192     (LEFT t e.Pe) e.Snt = (e.Pe) e.Snt;
    193     (RIGHT t e.Pe) e.Snt = (e.Pe) e.Snt;
    194   } :: (e.Pe) e.Snt =
     205    (LEFT (PRAGMA e) e.Pe) e.Snt = (e.Pe) e.Snt With_pragmas;
     206    (RIGHT (PRAGMA e) e.Pe) e.Snt = (e.Pe) e.Snt With_pragmas;
     207    (LEFT e.Pe) e.Snt = (e.Pe) e.Snt Without_pragmas;
     208    (RIGHT e.Pe) e.Snt = (e.Pe) e.Snt Without_pragmas;
     209  } :: (e.Pe) e.Snt s.pragmas =
    195210    {
    196211      <IsSubformat (<Format_Exp e.Pe>) (e.in)>,
     
    199214        (e.Pe) e.Snt;
    200215      <Gener_Var_Indices 1 (e.in) "arg"> :: e.in_expr s =
    201         (e.in_expr) (RESULT (PRAGMA) e.in_expr) e.Sentence;
     216        (e.in_expr) (RESULT { s.pragmas : With_pragmas = (PRAGMA) e.in_expr; <Del_Pragmas e.in_expr>; }) e.Sentence;
    202217    };
    203218  /*
     
    208223   * variables.
    209224   */
    210   e.Sentence : (s.block t.Pragma e.branches) e.Snt, s.block : \{ ALT; "ALT?"; } =
     225  e.Sentence : (s.block (PRAGMA e.Pragma) e.branches) e.Snt, s.block : \{ ALT; "ALT?"; } =
    211226    <Gener_Var_Indices 1 (e.in) "arg"> :: e.in_expr s,
    212227    <Vars e.in_expr> :: e.in_vars,
     
    222237    } :: (e.br) e.branches,
    223238    e.branches : /*empty*/ =
    224     (e.in_expr) (s.block t.Pragma e.br) e.Snt;
     239    (e.in_expr) (s.block (PRAGMA e.Pragma) e.br) e.Snt;
     240  /*
     241   * The same as above but without pragmas.
     242   */
     243  e.Sentence : (s.block e.branches) e.Snt, s.block : \{ ALT; "ALT?"; } =
     244    <Gener_Var_Indices 1 (e.in) "arg"> :: e.in_expr s,
     245    <Del_Pragmas e.in_expr> :: e.in_expr,
     246    <Vars e.in_expr> :: e.in_vars,
     247    (/*e.br*/) e.branches $iter {
     248      e.branches : (BRANCH (s.dir e.Pe) e.br_snt) e.rest, {
     249        <IsSubformat (<Format_Exp e.Pe>) (e.in)>,
     250          <Vars e.Pe> :: e.vars,
     251          # \{ e.vars : e (e t1) e (e t1) e; } =
     252          <Build_Subst (e.vars) (e.in_vars) e.br_snt> :: (e.pats) (e.repls),
     253          (e.br (BRANCH <Subst (e.pats) (e.repls) e.br_snt>)) e.rest;
     254        (e.br (BRANCH (s.dir e.Pe) e.br_snt)) e.rest;
     255      };
     256    } :: (e.br) e.branches,
     257    e.branches : /*empty*/ =
     258    (e.in_expr) (s.block e.br) e.Snt;
    225259  /*
    226260   * Else sentence already hasn't begun with pattern, so left it as it is.
     
    248282       */
    249283      t.Statement : \{
    250         (LEFT t e.Pe) = e.Pe;
    251         (RIGHT t e.Pe) = e.Pe;
     284        (LEFT e.Pe) = e.Pe;
     285        (RIGHT e.Pe) = e.Pe;
    252286      } :: e.Pe =
    253287        <Split &IsOld_Var e.res_vars (<Vars e.Pe>)> :: (e.old_vars) (e.new_vars),
    254288        <Map &Rename s.num (e.old_vars)> :: e.renames,
    255289        <Build_Subst (e.old_vars) (e.renames) e.Snt> :: (e.pats) (e.repls),
    256         <Subst (e.pats) (e.repls) e.Snt> : (s.tag t.p e.Pe1) e.rest_Snt,
    257         (<Or (e.vars) <Vars e.Pe1>>) (e.new_Snt (s.tag t.p e.Pe1)) e.rest_Snt;
     290        <Subst (e.pats) (e.repls) e.Snt> : (s.tag e.Pe1) e.rest_Snt,
     291        (<Or (e.vars) <Vars e.Pe1>>) (e.new_Snt (s.tag e.Pe1)) e.rest_Snt;
    258292      /*
    259293       * If we meet format expression then for each already used
    260294       * variable in it select new name by adding prefix "ren".
    261295       */
    262       t.Statement : (FORMAT t e.He) =
     296      t.Statement : (FORMAT e.He) =
    263297        <Split &IsOld_Var e.upper_vars e.res_vars (<Vars e.He>)>
    264298          :: (e.old_vars) (e.new_vars),
    265299        <Map &Rename s.num (e.old_vars)> :: e.renames,
    266300        <Build_Subst (e.old_vars) (e.renames) e.Snt> :: (e.pats) (e.repls),
    267         <Subst (e.pats) (e.repls) e.Snt> : (FORMAT t.p e.He1) e.rest_Snt,
    268         (<Or (e.vars) <Vars e.He1>>) (e.new_Snt (FORMAT t.p e.He1)) e.rest_Snt;
     301        <Subst (e.pats) (e.repls) e.Snt> : (FORMAT e.He1) e.rest_Snt,
     302        (<Or (e.vars) <Vars e.He1>>) (e.new_Snt (FORMAT e.He1)) e.rest_Snt;
    269303      /*
    270304       * We shouldn't rename variable if its duplicate is appeared on
     
    273307       * block).
    274308       */
    275       t.Statement : (s.block t.Pragma e.branches), s.block : \{ ALT; "ALT?"; } =
     309      t.Statement : (s.block e.branches), s.block : \{ ALT; "ALT?"; } =
    276310        /*
    277311         * As well as after-block patterns, formats should be scaned
     
    279313         */
    280314        e.rest : {
    281           (LEFT t e.Pe) e = <Vars e.Pe>;
    282           (RIGHT t e.Pe) e = <Vars e.Pe>;
    283           (FORMAT t e.He) e = <Vars e.He>;
     315          (LEFT e.Pe) e = <Vars e.Pe>;
     316          (RIGHT e.Pe) e = <Vars e.Pe>;
     317          (FORMAT e.He) e = <Vars e.He>;
    284318          /*empty*/ = e.res_vars;
    285319          e = /*empty*/;
     
    305339           */
    306340          e.rest : (FORMAT e) e =
    307             () (e.new_Snt (s.block t.Pragma e.branches)
     341            () (e.new_Snt (s.block e.branches)
    308342              <Rename_Vars <Add s.num 1> (e.vars) (e.res_vars) e.rest>);
    309           (e.vars) (e.new_Snt (s.block t.Pragma e.branches)) e.rest;
     343          (e.vars) (e.new_Snt (s.block e.branches)) e.rest;
    310344        };
    311       t.Statement : (BRANCH t.Pragma e.Sentence) =
    312         () (e.new_Snt (BRANCH t.Pragma
     345      t.Statement : (BRANCH e.Sentence) =
     346        () (e.new_Snt (BRANCH
    313347            <Rename_Vars s.num (e.vars) (e.res_vars) e.Sentence>));
    314348      t.Statement : (ITER t.IterBody t.IterVars t.IterCondition) =
     
    338372IsOld_Var e.vars (e t.name) = e.vars : e (e t.name) e;
    339373
    340 Rename s.num (s.tag t.p (e.QualifiedName)) =
    341   (s.tag t.p (e.QualifiedName "_" s.num));
     374Rename s.num (s.tag (e.name)) = (s.tag (e.name "_" s.num));
    342375
    343376/*
     
    345378 */
    346379Build_Subst {
    347   ((s.tag t t.name) e.vars) ((s t t.s) e.substs) e.Snt =
     380  ((s.tag e t.name) e.vars) ((s e t.s) e.substs) e.Snt =
    348381    <Var_Subst s.tag t.name t.s e.Snt> :: (e.var_pats) (e.var_repls),
    349382    <Build_Subst (e.vars) (e.substs) e.Snt> :: (e.pats) (e.repls),
     
    357390Var_Subst s.tag t.n t.s e.Snt, {
    358391  e.Snt : t.Statement e.rest, {
    359     t.Statement : (s.tag t.p t.name) =
     392    t.Statement : \{
     393      (s.tag t.p t.name) = t.p t.name;
     394      (s.tag t.name) = t.name;
     395    } :: e.p t.name =
    360396      {
    361         t.name : t.n = ((s.tag t.p t.name)) (((s.tag t.p t.s)));
     397        t.name : t.n = (t.Statement) (((s.tag e.p t.s)));
    362398        () ();
    363399      };
     
    368404    (e.st_pats e.pats) (e.st_repls e.repls);
    369405  () ();
     406};
     407
     408Del_Pragmas {
     409  eL t.Item eR, t.Item : \{
     410    (PRAGMA e) = eL <Del_Pragmas eR>;
     411    (expr) = eL (<Del_Pragmas expr>) <Del_Pragmas eR>;
     412  };
     413  e1 = e1;
    370414};
    371415
  • to-imperative/trunk/compiler/rfp_asail_jbc.rf

    r2725 r2727  
    221221  s.i;
    222222
    223 Lookup_Var t.var = <Lookup <Get_Block_Table> VAR t.var> : s.type s.i = s.type s.i;
     223Lookup_Var t.var = <WriteLn Lookup_Var t.var>, <Lookup <Get_Block_Table> VAR t.var> : s.type s.i = s.type s.i;
    224224
    225225Bind_Iter_Var e.expr t.var1 t.var2 =
  • to-imperative/trunk/compiler/rfp_check.rf

    r2715 r2727  
    149149  t.first e.rest, t.first : {
    150150    (CALL t.Pragma t.Fname e.ResultExpression), {
    151       <L 3 <Lookup_Func t.Fname>> : (e.Fin),
     151      <L 2 <Lookup_Func t.Fname>> : (e.Fin),
    152152        # <IsSubformat (e.Fin) (<Format_Exp e.ResultExpression>)> =
    153153        <Print_Error "Error!" Call t.Pragma>;;
  • to-imperative/trunk/compiler/rfp_clashes.rf

    r2638 r2727  
    408408Ref_Len t.name = {
    409409  <Lookup &Const_Len t.name>;
    410   <Get_Known_Length <Middle 3 0 <Lookup &Const t.name>>> :: e.len t =
     410  <Get_Known_Length <Middle 2 0 <Lookup &Const t.name>>> :: e.len t =
    411411    <Bind &Const_Len (t.name) (e.len)>,
    412412    e.len;
  • to-imperative/trunk/compiler/rfp_compile.rf

    r2715 r2727  
    133133        e.targets : v =
    134134          e.targets : e t.name e,
    135           t.item : (t t t t.name e);;
     135          t.item : (t t t.name e);;
    136136      },
    137137      t.item : {
    138         (IMPORT s.tag t.pragma t.name e) \?
     138        (IMPORT s.tag t.name e) \?
    139139          {
    140             t.pragma : (PRAGMA e (FILE e.fname) e),
    141               s.tag : \{ CONST; FUNC; "FUNC?"; },
    142               e.fname : RFI "org" "refal" "plus" "wrappers" e \! $fail;;
     140            s.tag : \{ CONST; FUNC; "FUNC?"; },
     141              t.name : ("org" "refal" "plus" "wrappers" e) \! $fail;;
    143142          };
    144143        (TRACE t.name) =
    145144          <Put &Trace_Names (TRACE t.name)>;
    146         (EXTERN t.pragma t.name) =
     145        (EXTERN t.name) =
    147146          <Put &Declarations (EXTERN t.name)>;
    148         (s.link s.tag t.pragma t.name (e.in) (e.out) e.body), FUNC "FUNC?" TFUNC : e s.tag e =
     147        (s.link s.tag t.name (e.in) (e.out) e.body), FUNC "FUNC?" TFUNC : e s.tag e =
    149148          {
    150             e.body : (BRANCH t.p e.branch) =
    151               <Comp_Func s.link s.tag t.name <Del_Pragmas (e.in) (e.out) e.branch>>;
     149            e.body : (BRANCH e.branch) =
     150              <Comp_Func s.link s.tag t.name (e.in) (e.out) e.branch>;
    152151            <Comp_Func s.link s.tag t.name (<Gener_Vars (e.in) "arg">) (e.out)>;
    153152          };
    154         (s.link CONST t.pragma t.name e.expr) =
     153        (s.link CONST t.name e.expr) =
    155154          <Put &Declarations (CONSTEXPR s.link t.name (e.expr) <Prepare_Const e.expr>)>;
    156         (s.link s.tag t.pragma t.name) =
     155        (s.link s.tag t.name) =
    157156          <Put &Declarations (OBJ s.link s.tag t.name)>;
    158157      } :: e.item,
     
    243242          TAILCALL;
    244243        } :: s.tailcall,
    245         <Lookup_Func t.name> :: s.linkage s.tag t.pragma (e.Fin) (e.Fout),
     244        <Lookup_Func t.name> :: s.linkage s.tag (e.Fin) (e.Fout),
    246245        <IsSubformat (e.Fout) (<Get &Out_Format>)> =
    247246        <Extract_Calls e.arg> :: (e.last_Re) e.calls,
     
    581580Extract_Calls {
    582581  (CALL t.name e.arg) e.rest =
    583     <Lookup_Func t.name> :: s.linkage s.tag t.pragma (e.Fin) (e.Fout),
     582    <Lookup_Func t.name> :: s.linkage s.tag (e.Fin) (e.Fout),
    584583    <Extract_Calls e.arg> :: (e.last_Re) e.calls,
    585584    <Prepare_Res <Split_Re (e.Fin) e.last_Re>> :: e.splited_Re,
     
    680679    {
    681680      <Lookup_Func t.name> : {
    682         s.linkage s.tag t.pragma ((EVAR)) ((EVAR)) = (s.tag t.name);
    683         s.linkage s.tag t.pragma (e.Fin) (e.Fout) =
     681        s.linkage s.tag ((EVAR)) ((EVAR)) = (s.tag t.name);
     682        s.linkage s.tag (e.Fin) (e.Fout) =
    684683          {
    685684            <Lookup &Stub_Funcs t.name> : t.stub_name e =
     
    13131312  <Lookup &Fun t.Fname>;
    13141313  <Lookup &IsFun t.Fname>;
    1315 } : s.linkage s.tag t.pragma (e.Fin) (e.Fout) =
    1316   s.linkage s.tag t.pragma (e.Fin) (e.Fout);
    1317 
     1314} : s.linkage s.tag (e.Fin) (e.Fout) =
     1315  s.linkage s.tag (e.Fin) (e.Fout);
     1316
  • to-imperative/trunk/compiler/rfp_compile.rfi

    r2638 r2727  
    2020
    2121
    22 $func? Lookup_Func t.Fname = s.linkage s.tag t.pragma (e.Fin) (e.Fout);
     22$func? Lookup_Func t.Fname = s.linkage s.tag (e.Fin) (e.Fout);
    2323
  • to-imperative/trunk/compiler/rfp_format.rf

    r2716 r2727  
    2929 */
    3030Format_Exp
    31 //e1 = <WriteLN Format-Exp e1>, e1 :
     31//e1 = <WriteLn Format_Exp e1>, e1 :
    3232{
    3333  t.first e.rest, t.first :
     
    3939        t.first;
    4040      };
    41       (CALL t.Pragma t.Fname e) =
    42         <L 4 <Lookup_Func t.Fname>> : (e.FOut) = e.FOut;
    43       (CALL t.Fname e), // Is needed anywhere ???
    44         <L 4 <Lookup_Func t.Fname>> : (e.FOut) = e.FOut;
     41      (CALL (PRAGMA (e.file) (e.line)) t.Fname e) =
     42        <L 3 <Lookup_Func t.Fname>> : (e.FOut) = e.FOut;
     43      (CALL t.Fname e) =
     44        <L 3 <Lookup_Func t.Fname>> : (e.FOut) = e.FOut;
    4545      // (BLOCK e.Branches) = ...
    4646      (PAREN e.Expression) = (PAREN <Format_Exp e.Expression>);
     
    8282  ((CONST t.name) e.Fe) e.Re, {
    8383    e.Re : t.Rt e.Rest, <Format_Exp t.Rt> : (CONST t.name) = <Split_Re (e.Fe) e.Rest>;
    84     <Split_Re (<Middle 3 0 <Lookup &Const t.name>> e.Fe) e.Re>;
     84    <Split_Re (<Middle 2 0 <Lookup &Const t.name>> e.Fe) e.Re>;
    8585  };
    8686  (v.Fe (CONST t.name)) e.Re, {
    8787    e.Re : e.Rest t.Rt, <Format_Exp t.Rt> : (CONST t.name) = <Split_Re (v.Fe) e.Rest>;
    88     <Split_Re (v.Fe <Middle 3 0 <Lookup &Const t.name>>) e.Re>;
     88    <Split_Re (v.Fe <Middle 2 0 <Lookup &Const t.name>>) e.Re>;
    8989  };
    9090  ((VVAR)) e.Re = (e.Re);
    9191  ((EVAR)) e.Re = (e.Re);
    9292  (e.Fe) t.Rt e.Re, <Format_Exp t.Rt> : (CONST t.name) =
    93     <Split_Re (e.Fe) <Middle 3 0 <Lookup &Const t.name>> e.Re>;
     93    <Split_Re (e.Fe) <Middle 2 0 <Lookup &Const t.name>> e.Re>;
    9494  (e.Fe) v.Re t.Rt, <Format_Exp t.Rt> : (CONST t.name) =
    95     <Split_Re (e.Fe) v.Re <Middle 3 0 <Lookup &Const t.name>>>;
     95    <Split_Re (e.Fe) v.Re <Middle 2 0 <Lookup &Const t.name>>>;
    9696  () /*empty*/ = /*empty*/;
    9797};
     
    252252      };
    253253    (CONST t.Name) =
    254       <IsSubformat (<Format_Exp <Middle 3 0 <Lookup &Const t.Name>>>) (e.Format2)>;
     254      <IsSubformat (<Format_Exp <Middle 2 0 <Lookup &Const t.Name>>>) (e.Format2)>;
    255255    t.Symbol =
    256256      e.Format2 : e0 t1 e2,
     
    268268    e, e.Format2 (/*e.format*/) 0 $iter {
    269269      e.Format2 : e1 (CONST t.Name) e2 =
    270         e2 (e.format e1 <Format_Exp <Middle 3 0 <Lookup &Const t.Name>>>) 1;
     270        e2 (e.format e1 <Format_Exp <Middle 2 0 <Lookup &Const t.Name>>>) 1;
    271271      (e.format e.Format2) s.Issuccess;
    272272    } :: e.Format2 (e.format) s.Issuccess,
     
    281281 * Is t.name a $const'ant with an empty value?
    282282 */
    283 IsEmpty_Const t.name = <IsEmpty_Expr <Middle 3 0 <Lookup &Const t.name>>>;
     283IsEmpty_Const t.name = <IsEmpty_Expr <Middle 2 0 <Lookup &Const t.name>>>;
    284284
    285285/*
     
    300300 * Else $fail.
    301301 */
    302 Get_Const_Term t.name = <Get_Term <Middle 3 0 <Lookup &Const t.name>>>;
     302Get_Const_Term t.name = <Get_Term <Middle 2 0 <Lookup &Const t.name>>>;
    303303
    304304/*
     
    312312    t1 : \{ (REF t.Name) = t.Name; (CONST t.Name) = t.Name; } :: t.Name,
    313313      <Lookup &Const t.Name> :: e.const =
    314       <Get_Term <Middle 3 0 e.const>>;
     314      <Get_Term <Middle 2 0 e.const>>;
    315315    t1;
    316316  };
  • to-imperative/trunk/compiler/rfp_helper.rf

    r2720 r2727  
    2828  (e1 s2) = (e1) s2;
    2929  (e1) = () e1;
    30 };
    31 
    32 Del_Pragmas {
    33   eL t.Item eR, t.Item : \{
    34     (PRAGMA e) = eL <Del_Pragmas eR>;
    35     (expr) = eL (<Del_Pragmas expr>) <Del_Pragmas eR>;
    36   };
    37   e1 = e1;
    3830};
    3931
     
    117109
    118110PrintFunctionFormat t.name,
    119   <Lookup_Func t.name> :: s.linkage s.tag t.pragma (e.Fin) (e.Fout) =
     111  <Lookup_Func t.name> :: s.linkage s.tag (e.Fin) (e.Fout) =
    120112  t.name : (e s.funcName),
    121113  s.tag : {
     
    129121
    130122PrintConstDefinition t.name,
    131   <Lookup &Const t.name> : s.linkage s.tag t.pragma e.def =
     123  <Lookup &Const t.name> : s.linkage s.tag e.def =
    132124  t.name : (e s.constName),
    133125  <ToWord "$const " s.constName " = " <PrintFormat e.def> ";">;
    134126
    135127PrintObjectDefinition t.name,
    136   <Lookup &Object t.name> : s.linkage s.tag t.pragma e.def =
     128  <Lookup &Object t.name> : s.linkage s.tag e.def =
    137129  t.name : (e s.objectName),
    138130  s.tag : {
  • to-imperative/trunk/compiler/rfp_helper.rfi

    r2718 r2727  
    1313
    1414$func RFP_Extract_Qualifiers t.Name = (e.qualifiers) e.name;
    15 
    16 $func Del_Pragmas e.Sentence = e.Sentence;
    1715
    1816// substitute replacements for each occurence of corresponding patterns in expr
  • to-imperative/trunk/compiler/rfpc.rf

    r2716 r2727  
    7676  <Get_Ready_For_Compilation e.Items>,
    7777  <RFP_Check e.Items>,
     78  <RFP_As2As_Transform e.Items> :: e.Items,
     79  <RFP_Compile t.ModuleName e.Items> :: t.module,
     80  {
     81    <IsInTable &RFP_Options "NO-OPTIM"> = t.module;
     82    <Simplify_ASAIL t.module>;
     83  } :: t.module,
     84  {
     85    <RFP_ASAIL_To_JBC t.module> : e (s.bytecode e.java_module_name) e,
     86      <MakeClass s.env <ToWord <Intersperse ('/') e.java_module_name>> s.bytecode>,
     87      $fail;;
     88  };
     89
     90
     91CompileASToJBC s.env t.as =
     92  t.as : (s t.ModuleName e.Items),
     93  <WriteLn Compiling t.ModuleName>,
     94  <Get_Ready_For_Compilation e.Items>,
    7895  <RFP_As2As_Transform e.Items> :: e.Items,
    7996  <RFP_Compile t.ModuleName e.Items> :: t.module,
     
    477494  {
    478495    e.Items : e t.Item e, t.Item : \{
    479       (s.Linkage s.ItemType t.Pragma t.ItemName e.ItemBody),
     496      {
     497        (s.Linkage s.ItemType (PRAGMA (e) e) t.ItemName e.ItemBody) =
     498          (s.Linkage s.ItemType t.ItemName e.ItemBody);
     499        t = t.Item;
     500      } : (s.Linkage s.ItemType t.ItemName e.ItemBody) =
    480501        s.ItemType : {
    481502          FUNC =
     
    491512          s = &Object e.ItemBody;
    492513        } :: s.tab e.ItemDef,
    493         <Bind s.tab (t.ItemName) (s.Linkage s.ItemType t.Pragma e.ItemDef)>;
    494       (EXTERN t.Pragma t.FName) =
    495         <Bind &IsFun (t.FName) (IMPORT "FUNC?" t.Pragma ((EVAR)) ((EVAR)))>;
     514        <Bind s.tab (t.ItemName) (s.Linkage s.ItemType e.ItemDef)>;
     515      (EXTERN e.Pragma t.FName) =
     516        <Bind &IsFun (t.FName) (IMPORT "FUNC?" ((EVAR)) ((EVAR)))>;
    496517    },
    497518      $fail;
    498519    {
    499520      <IsInTable &RFP_Options DBG> =
    500         <Bind &IsFun ((Debug "Stop?")) (IMPORT "FUNC?" (PRAGMA) ((EVAR)) ())>,
    501         <Bind &Fun  ((Debug Debug)) (IMPORT FUNC  (PRAGMA) ((EVAR)) ())>;;
     521        <Bind &IsFun ((Debug "Stop?")) (IMPORT "FUNC?" ((EVAR)) ())>,
     522        <Bind &Fun  ((Debug Debug)) (IMPORT FUNC ((EVAR)) ())>;;
    502523    };
    503524  };
  • to-imperative/trunk/compiler/rfpc.rfi

    r2638 r2727  
    1 //
    2 // Copyright (C) 1999, 2000 Refal+ Development Group
    3 //
    4 // Refal+ is free software; you can redistribute it and/or modify
    5 // it under the terms of the GNU General Public License as published by
    6 // the Free Software Foundation; either version 2 of the License, or
    7 // (at your option) any later version.
    8 //
    9 // Refal+ is distributed in the hope that it will be useful,
    10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12 // GNU General Public License for more details.
    13 //
    14 // You should have received a copy of the GNU General Public License
    15 // along with Refal+; if not, write to the Free Software
    16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    17 //
    18 // $Source$
    19 // $Revision$
    20 // $Date$
     1// $Id$
    212
    223$const RFP_Root = '/usr' ;
     
    3314
    3415$func CompileModule s.env = ;
     16$func CompileASToJBC s.env t.as = ;
    3517
    3618$func RFP_Pretty_Print s.channel (e.indent) e.expr = ;
Note: See TracChangeset for help on using the changeset viewer.