source: applications/trunk/Makanin/src/Makanin.rf @ 3674

Last change on this file since 3674 was 3674, checked in by orlov, 13 years ago
  • Initial version (nothing interesting yet).
File size: 1.0 KB
Line 
1$use Access Arithm Box Compare Convert List StdIO;
2
3$func Main = e;
4Main = <WriteLn <GEN ('xaby') ('ybax')>>;
5
6$func GEN (e.left) (e.right) = (e.consts) (e.vars) s.BDnum e.GEs;
7GEN (e.left) (e.right) =
8  <Split &Gt ('p') (<Paren <Nub e.left e.right>>)> :: (e.consts) (e.vars),
9  <ToQuadratic <Concat e.vars> (e.left) (e.right)> :: (e.left) (e.right) e.EQs,
10  (<Concat e.consts>) (e.vars <Concat <MapIn &R 0 (e.EQs)>>) 0 (e.left) (e.right);
11
12$func ToQuadratic e.vars (e.left) (e.right) = (e.left) (e.right) e.EQs;
13ToQuadratic {
14  e1 sx e2 (e.left) (e.right), e.left e.right : ea sx eb sx ec sx ed =
15    <NewVar sx> :: sx1,
16    {
17      e.right : ef sx ed = <ToQuadratic sx e2 (e.left) (ef sx1 ed)> (sx sx1);
18      e.d : ef e.right = <ToQuadratic sx e2 (ea sx eb sx ec sx1 ef) (e.right)> (sx sx1);
19    };
20  e (e.left) (e.right) = (e.left) (e.right);
21};
22
23$box FreeIdx;
24
25$func NewVar s.var = s.new_var;
26NewVar s.var =
27  {
28    <Get &FreeIdx> : s.idx,
29      <Store &FreeIdx <Add s.idx 1>>, s.idx;
30    <Store &FreeIdx 1>, 0;
31  } :: s.idx,
32  <ToWord s.var s.idx>;
Note: See TracBrowser for help on using the repository browser.