summaryrefslogtreecommitdiff
path: root/deprecated/old-lib/resource/hindi/utf8/MkLex.hs
blob: 248f6f875733aa6a508144954886edd1977150fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
main = interact (concat . map mkOne . zip [10001..] . lines)

mkOne (i,line) = case line of
  '<':cs -> case pos line of
    "nuon" -> entry (show i) (word line) "N"
    "brev" -> entry (show i) (word line) "V"
    "evitcejda" -> entry (show i) (word line) "A"
    _ -> ""
  _ -> ""

pos line = case reverse line of
  '>':cs -> takeWhile (/='<') cs
  _ -> ""

word line = takeWhile (/='>') line

entry i w c = 
  "fun w" ++ i ++ "_" ++ c ++ " : " ++ c ++ " ;\n" ++
  "lin w" ++ i ++ "_" ++ c ++ " = mk" ++ c ++ " \"" ++ w ++ "\" ;\n"