hacapa.hs revision 7de39d39bc1700cc8a9bb9df90b920aad9e18d4a
7ea448352f44eec95bc3e5dcf6f59a4b5dbc5f79Christian Maeder{- |
7ea448352f44eec95bc3e5dcf6f59a4b5dbc5f79Christian MaederModule : $Id$
7ea448352f44eec95bc3e5dcf6f59a4b5dbc5f79Christian MaederDescription : testing HasCASL homogeneously
7ea448352f44eec95bc3e5dcf6f59a4b5dbc5f79Christian MaederCopyright : (c) Christian Maeder, Uni Bremen 2002-2004
1d2c2ebba52ca5c89ca40181064ab30e2ef26403Christian MaederLicense : similar to LGPL, see HetCATS/LICENSE.txt or LIZENZ.txt
7ea448352f44eec95bc3e5dcf6f59a4b5dbc5f79Christian Maeder
7ea448352f44eec95bc3e5dcf6f59a4b5dbc5f79Christian MaederMaintainer : Christian.Maeder@dfki.de
1d2c2ebba52ca5c89ca40181064ab30e2ef26403Christian MaederStability : experimental
1d2c2ebba52ca5c89ca40181064ab30e2ef26403Christian MaederPortability : portable
1d2c2ebba52ca5c89ca40181064ab30e2ef26403Christian Maeder
test some parsers (and printers)
-}
module Main where
import Common.AnnoState
import Common.DocUtils
import Common.GlobalAnnotations
import Common.RunParsers
import HasCASL.HToken
import HasCASL.Builtin
import HasCASL.ParseItem
import HasCASL.ParseTerm
import HasCASL.RunMixfixParser
import HasCASL.RunStaticAna
main :: IO ()
main = exec lineParser fileParser
toHStringParser :: Pretty a => (GlobalAnnos -> AParser () a)
-> StringParser
toHStringParser p ga = let newGa = addBuiltins ga in
fmap (\ a -> showGlobalDoc newGa a "") $ p newGa
fromHAParser :: Pretty a => AParser () a -> StringParser
fromHAParser p ga = fmap (\ a -> showGlobalDoc (addBuiltins ga) a "") p
lineParser, fileParser :: [(String, StringParser)]
lineParser = [
("MixIds", fromAParser opId),
("Kinds", fromAParser kind),
("Types", fromAParser parseType),
("Terms", fromAParser term),
("MixfixTerms", toHStringParser resolveTerm),
("Typepattern", fromAParser typePattern),
("Pattern", fromHAParser pattern),
("BasicItems", fromHAParser basicItems),
("Items", fromHAParser basicSpec)]
fileParser = [ ("BasicSpec", fromHAParser basicSpec)
, ("analysis", anaParser)
, ("sentences", printSen senParser)
, ("translate", printSen transParser)
]