source:
applications/trunk/UGPSummerSchool2008/src/Int.rf
@
3829
Last change on this file since 3829 was 3829, checked in by orlov, 13 years ago | |
---|---|
File size: 333 bytes |
Line | |
---|---|
1 | $module Int; |
2 | |
3 | $use Arithm StdIO; |
4 | |
5 | $func Int t = s; |
6 | |
7 | Int { |
8 | (t1 s.op t2) = |
9 | <Int t1> :: s1, |
10 | <Int t2> :: s2, |
11 | s.op : { |
12 | '+' = <Add s1 s2>; |
13 | '-' = <Sub s1 s2>; |
14 | '*' = <Mult s1 s2>; |
15 | '/' = <Div s1 s2>; |
16 | }; |
17 | sn = sn; |
18 | }; |
19 | |
20 | $func Main = e; |
21 | |
22 | Main = (((2 '+' 3) '*' 4) '/' (4 '-' 2)) :: t.exp, <PrintLn t.exp ' = ' <Int t.exp>>; |
Note: See TracBrowser
for help on using the repository browser.