blob: 62daa55bd7acac051567635fe1c52f7d04c4e686 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
main = interact (unlines . map (mkTerm . words) . lines)
mkTerm ws = case ws of
"==":cat:"-":expl -> unlines [
mkFun "Cat" cat,
mkLin "Cat" "mkN" cat (unwords (takeWhile (/= "==") expl))
]
mkFun pref s = unwords ["fun", pref ++ s, ":", pref, ";"]
---mkLin pref p s e = unwords ["lin", pref ++ s, "=", p, quoted e, ";"]
mkLin pref p s e = unwords ["lin", pref ++ s, "=", quoted s, ";"]
quoted s = "\"" ++ s ++ "\""
|