Parse_CspCASL.hs revision dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy Gimblett{- |
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian MaederModule : $Header$
e071fb22ea9923a2a4ff41184d80ca46b55ee932Till MossakowskiDescription : Parser for CspCASL specifications
63f8854d42e766ff77125c6e532c5fce3b5ebdefChristian MaederCopyright : (c) Uni Bremen 2007
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu ProdescuLicense : GPLv2 or higher, see LICENSE.txt
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy Gimblett
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettMaintainer : a.m.gimblett@swan.ac.uk
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettStability : experimental
63f8854d42e766ff77125c6e532c5fce3b5ebdefChristian MaederPortability : portable
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy Gimblett
8267b99c0d7a187abe6f87ad50530dc08f5d1cdcAndy GimblettParser for CSP-CASL specifications.
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-}
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
45ec7dde04370e30e219a8ba6f4ce71d4bba3f2bChristian Maedermodule CspCASL.Parse_CspCASL (cspBasicExt) where
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
9f93b2a8b552789cd939d599504d39732672dc84Christian Maederimport Text.ParserCombinators.Parsec
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maederimport Common.AnnoState
9f93b2a8b552789cd939d599504d39732672dc84Christian Maederimport Common.Lexer
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettimport CspCASL.AS_CspCASL
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettimport CspCASL.CspCASL_Keywords
c3f3b3166ed4c19c72a27a2d6f8176730e94e71eAndy Gimblettimport CspCASL.Parse_CspCASL_Process
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maederinstance AParsable CspBasicExt where
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder aparser = cspBasicExt
5d48a25007fbfa021ca32df2d75770c02d531285Andy Gimblett
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian MaedercspBasicExt :: AParser st CspBasicExt
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian MaedercspBasicExt =
38504dc968167ba2e82dd568edeae8d6af4dc145Christian Maeder itemList cspKeywords channelS (const chanDecl) (\ l _ -> Channels l)
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder <|> do
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder p <- asKey processS
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder auxItemList cspStartKeys [p] procItem (\ l _ -> ProcItems l)
f909337bf7012aca169c0b56b89efbd4a310f8daAndy Gimblett
53f89daf88665d3ea96d871110a5c0d9d8326bd2Andy GimblettchanDecl :: AParser st CHANNEL_DECL
9f93b2a8b552789cd939d599504d39732672dc84Christian MaederchanDecl = do
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder vs <- commaSep1 channel_name
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder colonT
38504dc968167ba2e82dd568edeae8d6af4dc145Christian Maeder es <- cspSortId
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder return (ChannelDecl vs es)
f909337bf7012aca169c0b56b89efbd4a310f8daAndy Gimblett
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian MaederprocItem :: AParser st PROC_ITEM
70a691ea12f53381209a3709cdd325df5fc0a0c8Christian MaederprocItem = do
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder ep <- procDeclOrDefn
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder case ep of
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder Left (fpn, vs) -> do
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder p <- csp_casl_process
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder return $ Proc_Eq (ParmProcname fpn vs) p
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder Right (pn, eas, al) -> case eas of
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder Left ss -> return $ Proc_Decl pn ss al
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder Right vds -> do
70a691ea12f53381209a3709cdd325df5fc0a0c8Christian Maeder p <- csp_casl_process
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder return $ Proc_Defn pn vds al p