adl.hs revision cfcf65bef8fe90abc7a7ca801539dd80dc71d72d
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon Ulbricht{-# LANGUAGE CPP #-}
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon UlbrichtModule : $Header$
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon UlbrichtDescription : ADL syntax parser
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon UlbrichtCopyright : (c) Stef Joosten, Christian Maeder DFKI GmbH 2010
da4b55f4795a4b585f513eaceb67cda10485febfChristian MaederLicense : GPLv2 or higher
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon UlbrichtMaintainer : Christian.Maeder@dfki.de
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon UlbrichtStability : provisional
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon UlbrichtPortability : portable
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon Ulbrichtmodule Main (main) where
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon Ulbrichtimport Text.ParserCombinators.Parsec (parse, eof)
e4d1479434761dc3eb8d17b6c75de4eb24866f0bSimon Ulbrichtimport Adl.Parse (skip, pArchitecture)
804459c3af78eeee3fd3c940c74594febd030dacSimon Ulbrichtmain = getArgs >>= mapM_ process
4d1df661384f74cd15d2ceba8a9a3c4760e9ddfbSimon Ulbrichtprocess :: String -> IO ()
4bf72807172000becf65e11bd225efc1dfd99713Simon Ulbrichtprocess f = do
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon Ulbricht s <- readFile f
e4d1479434761dc3eb8d17b6c75de4eb24866f0bSimon Ulbricht case parse (skip >> pArchitecture << eof) f s of
4bf72807172000becf65e11bd225efc1dfd99713Simon Ulbricht Right (Context m ps) ->
846ef0914b29a4806ca0444c116fd3cf267c4fb7Christian Maeder let (nps, env) = runState (mapM anaPatElem ps) (toEnv emptySign)
e4d1479434761dc3eb8d17b6c75de4eb24866f0bSimon Ulbricht es = Context m nps
94968509d2764786208bd34b59a93c7cbe3aa6dbSimon Ulbricht . renderLatex Nothing
e4d1479434761dc3eb8d17b6c75de4eb24866f0bSimon Ulbricht . toLatex adlGA
fe6a19b07759bc4190e88dda76a211d86bf32062Simon Ulbricht Left err -> fail $ show err