diff --git a/Data/Char/CEDICT/GenerateCode.hs b/Data/Char/CEDICT/GenerateCode.hs
new file mode 100644
--- /dev/null
+++ b/Data/Char/CEDICT/GenerateCode.hs
@@ -0,0 +1,83 @@
+
+module Data.Char.CEDICT.GenerateCode
+  ( readAndWrite
+  ) where
+
+import Data.Char.CEDICT.Reader.Parser
+import Data.Char.CEDICT.Reader.ListRebuild
+import Data.Char.CEDICT.C.Declarations
+
+import System.IO.UTF8
+import System.IO hiding
+  ( appendFile
+  , getContents
+  , getLine
+  , print
+  , putStr
+  , putStrLn
+  , readFile
+  , readLn
+  , writeFile
+  , hGetContents
+  , hGetLine
+  , hPutStr
+  , hPutStrLn
+  )
+import Prelude hiding
+  ( appendFile
+  , getContents
+  , getLine
+  , print
+  , putStr
+  , putStrLn
+  , readFile
+  , readLn
+  , writeFile
+  )
+
+import qualified Data.ByteString
+import Control.Monad
+import System.Time
+import System.Locale
+
+readAndWrite                ::  FilePath -> FilePath -> IO ()
+readAndWrite dF cF           =  do
+  parseHappening            <-  parseFile dF
+  case parseHappening of
+    Left err                ->  print err
+    Right stuff             ->  do
+      time                  <-  liftM toUTCTime getClockTime
+      Data.ByteString.writeFile cF $ handleResults time stuff
+
+
+handleResults time (tag, list) = Data.ByteString.concat
+  [ toBytes . cHeader $ message time tag
+  , toBytes "\n\n" 
+  , toCDecl ts "ts"
+  , toBytes "\n\n" 
+  , toCDecl st "st"
+  , toBytes "\n\n" 
+  , toCDecl d "d"
+  ] 
+ where
+  (d, ts, st)                =  majorLists list
+
+
+cHeader note                 =  unlines
+  [ " /* /"
+  , note
+  , " / */"
+  , ""
+  , "#include <stddef.h>"
+  , ""
+  ] 
+
+
+message time tag             =  unlines
+  [ "  Generated on " ++ (fmt time) ++ " from:"
+  , "        " ++ tag
+  , "  Changes will be overwritten the next time the generation script is run."
+  ]
+ where
+  fmt = formatCalendarTime defaultTimeLocale "%Y-%m-%dT%H:%M:%SZ"
+
diff --git a/cedict.cabal b/cedict.cabal
--- a/cedict.cabal
+++ b/cedict.cabal
@@ -1,5 +1,5 @@
 name:               cedict
-version:            0.2.1
+version:            0.2.2
 category:           Text
 description:        Convenient Chinese character lookup.
 synopsis:           Convenient Chinese character lookup.
@@ -12,6 +12,7 @@
 extra-tmp-files:    c/data.h
 extra-source-files: d/cedict_readme.txt
                     d/utf8-cedict
+                    Data/Char/CEDICT/GenerateCode.hs
 
 library
   build-depends:    base, containers, parsec, utf8-string, bytestring, mtl
