3 fun foreach (l
, f
) = List.app f l
4 fun map (l
, f
) = List.map f l
5 val tabulate
= List.tabulate
9 List.map (["Int", "IntInf", "LargeInt", "FixedInt", "Position"]
10 @
List.map (List.tabulate (31, fn i
=> i
+ 2) @
[64],
11 fn i
=> concat
["Int", Int.toString i
]),
12 fn s
=> concat
[s
, ".int"])
15 List.map (["Real", "Real32", "Real64", "LargeReal"],
16 fn s
=> concat
[s
, ".real"])
19 List.map (["Word", "LargeWord", "SysWord"]
20 @
List.map (List.tabulate (31, fn i
=> i
+ 2) @
[64],
21 fn i
=> concat
["Word", Int.toString i
]),
22 fn s
=> concat
[s
, ".word"])
24 val text
= ["Char.char", "String.string"]
26 val num
= int @
word @
real
27 val numtext
= num @ text
28 val realint
= int @
real
29 val wordint
= int @
word
31 datatype ty
= Binary | Compare | Unary
36 val () = print
"(* This file is automatically generated. Do not edit. *)\n"
40 ([(2, "~", unary
, num
),
41 (2, "+", binary
, num
),
42 (2, "-", binary
, num
),
43 (2, "*", binary
, num
),
44 (4, "/", binary
, real),
45 (3, "div", binary
, wordint
),
46 (3, "mod", binary
, wordint
),
47 (3, "abs", unary
, realint
),
48 (1, "<", compare
, numtext
),
49 (1, "<=", compare
, numtext
),
50 (1, ">", compare
, numtext
),
51 (1, ">=", compare
, numtext
)],
52 fn (prec
, f
, ty
, class
) =>
55 print (concat
["fun f (x: ", c
, ") = ",
57 Binary
=> concat
["x ", f
, " x"]
58 | Compare
=> concat
["x ", f
, " x"]
59 | Unary
=> concat
[f
, " x"],