packages feed

ace 0.1 → 0.2

raw patch · 6 files changed

+519/−61 lines, 6 files

Files

ace.cabal view
@@ -1,5 +1,5 @@ name:                ace-version:             0.1+version:             0.2 synopsis:            Attempto Controlled English parser and printer description:         Attempto Controlled English is a formally defined unambiguous language which                      is a subset of the English language. This package provides a tokenizer,@@ -20,8 +20,15 @@  library   hs-source-dirs:    src/-  ghc-options:       -Wall -O2-  exposed-modules:   ACE, ACE.Types.Syntax, ACE.Parsers, ACE.Tokenizer, ACE.Types.Tokens, ACE.Combinators, ACE.Types.Pretty, ACE.Pretty+  ghc-options:       -Wall -O0+  exposed-modules:   ACE+                     ACE.Types.Syntax+                     ACE.Parsers+                     ACE.Tokenizer+                     ACE.Types.Tokens+                     ACE.Combinators+                     ACE.Types.Pretty+                     ACE.Pretty   build-depends:     attoparsec >= 0.11.1.0,                      parsec >= 3.1.5,                      data-default >= 0.5.3,
src/ACE/Parsers.hs view
@@ -487,8 +487,8 @@   (string "an" *> pure An) <|>   (string "a" *> pure A) <|>   (string "some" *> pure Some) <|>-  (strings ["not","every"] *> pure NotEveryEach) <|>-  (strings ["not","each"] *> pure NotEveryEach) <|>+  (strings ["not","every"] *> pure NotEvery) <|>+  (strings ["not","each"] *> pure NotEach) <|>   (strings ["not","all"] *> pure NotAll) <|>   (string "no" *> pure No) <|>   (string "every" *> pure EveryEach) <|>@@ -546,8 +546,10 @@  -- | A possessive pronoun: his, her, his/her. possessivePronoun =-  hisHer <|> its-  where hisHer =+  his <|> her <|> hisHer <|> its+  where his = string "his" *> pure His+        her = string "her" *> pure Her+        hisHer =           (string "his" <|> string "her" <|> string "his/her") *>           pure HisHer         its = string "its" *> pure Its@@ -555,5 +557,6 @@ -- | A universal global quantor: for every/for each, for all. universalGlobalQuantor =   string "for" *> (everyEach <|> forAll)-  where everyEach = (string "every" <|> string "each") *> pure ForEveryEach+  where everyEach = ((string "every" *> pure ForEvery) <|>+                     (string "each" *> pure ForEach))         forAll = string "all" *> pure ForAll
src/ACE/Pretty.hs view
@@ -1,14 +1,405 @@--- |+{-# LANGUAGE OverloadedStrings #-} +{-# OPTIONS -fno-warn-orphans #-}++-- | Pretty printing classes.+ module ACE.Pretty-  (module ACE.Types.Pretty-  ,human)+  (module ACE.Types.Pretty)   where  import ACE.Types.Pretty+import ACE.Types.Syntax+import Data.Monoid hiding (All)+import Data.Text (pack)+import Data.Text.Lazy.Builder -import Data.Default+-- | Maybe pretty print if anything.+mpretty :: Pretty a => Builder -> Maybe a -> Builder+mpretty x = maybe "" ((x <>) . pretty) --- | Human-readable pretty printing settings.-human :: PrettySettings-human = def { prettyShowPrecedence = False }+-- | Maybe pretty print if anything. Other side.+prettym :: Pretty a => Builder -> Maybe a -> Builder+prettym x = maybe "" ((<> x) . pretty)++instance Pretty Specification where+  pretty (Specification c mspec) =+    pretty c <> "." <> mpretty " " mspec++instance Pretty SentenceCoord where+  pretty (SentenceCoord c mcoord) =+    pretty c <> mpretty " or " mcoord++instance Pretty SentenceCoord_1 where+  pretty (SentenceCoord_1 c mcoord) =+    pretty c <> mpretty " and " mcoord++instance Pretty SentenceCoord_2 where+  pretty (SentenceCoord_2 c mcoord) =+    pretty c <> mpretty " or " mcoord++instance Pretty SentenceCoord_3 where+  pretty (SentenceCoord_3 c mcoord) =+    pretty c <> mpretty " and " mcoord++instance Pretty TopicalizedSentence where+  pretty t =+    case t of+      TopicalizedSentenceExistential t' c -> pretty t' <> mpretty " " c+      TopicalizedSentenceUniversal u s   -> pretty u <> " " <> pretty s+      TopicalizedSentenceComposite c     -> pretty c++instance Pretty UniversalTopic where+  pretty (UniversalTopic q n) = pretty q <> " " <> pretty n++instance Pretty CompositeSentence where+  pretty c =+    case c of+      CompositeSentenceCond s -> pretty s+      CompositeSentenceNeg s -> pretty s+      CompositeSentence s -> pretty s++instance Pretty ConditionalSentence where+  pretty (ConditionalSentence x y) =+    "if " <> pretty x <> " then " <> pretty y++instance Pretty NegatedSentence where+  pretty (NegatedSentence s) = "it is not the case that " <> pretty s++instance Pretty Sentence where+  pretty (Sentence n v) =+    pretty n <> " " <> pretty v++instance Pretty ExistentialTopic where+  pretty (ExistentialTopic g np) =+    pretty g <> " " <> pretty np++instance Pretty NPCoord where+  pretty n =+    case n of+      NPCoordDistributed d u -> pretty d <> " " <> pretty u+      NPCoordUnmarked u -> pretty u++instance Pretty UnmarkedNPCoord where+  pretty (UnmarkedNPCoord np mu) =+    pretty np <> mpretty " and " mu++instance Pretty N' where+  pretty (N' mad n mappos mnp mrel) =+    prettym " " mad <>+    pretty n <>+    mpretty " " mappos <>+    mpretty " of " mnp <>+    mpretty " " mrel++instance Pretty NP where+  pretty (NP s n') = pretty s <> " " <> pretty n'++instance Pretty N where+  pretty (N t) = fromText t++instance Pretty PP where+  pretty (PP p np) = pretty p <> " " <> pretty np++instance Pretty Preposition where+  pretty (Preposition t) = fromText t++instance Pretty ApposCoord where+  pretty (ApposCoord a ma) = pretty a <> mpretty " " ma++instance Pretty Apposition where+  pretty a =+    case a of+      AppositionVar v -> pretty v+      AppositionQuote q -> pretty q++instance Pretty Quotation where+  pretty (Quotation q) =+    "\"" <> fromText q <> "\""++instance Pretty Variable where+  pretty (Variable t) = fromText t++instance Pretty RelativeClauseCoord where+  pretty (RelativeClauseCoord r me) =+    pretty r <>+    case me of+      Nothing -> ""+      Just (c,r') -> " " <> pretty c <> " " <> pretty r'++instance Pretty PossessiveNPCoord where+  pretty p =+    case p of+      PossessiveNPCoordGen g -> pretty g+      PossessiveNPCoordPronoun p' -> pretty p'++instance Pretty GenitiveNPCoord where+  pretty g =+    case g of+      GenitiveNPCoord s n t -> pretty s <> " " <> pretty n <> pretty t+      GenitiveNPCoordName n t -> pretty n <> pretty t++instance Pretty ProperName where+  pretty (ProperName t) = fromText t++instance Pretty PossessivePronounCoord where+  pretty (PossessivePronounCoord p mp) = pretty p <> mpretty " and " mp++instance Pretty GenitiveTail where+  pretty g = case g of+               GenitiveTailSaxonTail t -> pretty t+               GenitiveTailCoordtail t -> pretty t++instance Pretty GenitiveCoordTail where+  pretty (GenitiveCoordTail t) = " and " <> pretty t++instance Pretty SaxonGenitiveTail where+  pretty (SaxonGenitiveTail m mg) =+    pretty m <>+    case mg of+      Nothing -> ""+      Just (c,r) -> pretty c <> " " <> pretty r++instance Pretty RelativeClause where+  pretty r =+    case r of+      RelativeClauseThat v       -> "that " <> pretty v+      RelativeClauseNP a b       -> pretty a <> " " <> pretty b+      RelativeClauseThatNPVP a b -> "that " <> pretty a <> " " <> pretty b+      RelativeClauseNPVP a b c   -> pretty a <> " " <> pretty b <> " " <> pretty c+      RelativeClausePP p n v     -> pretty p <> " " <> pretty n <> " " <> pretty v++instance Pretty VPCoord where+  pretty v =+    case v of+      VPCoord' vp coord vpcoord -> pretty vp <> " " <> pretty coord <> " " <> pretty vpcoord+      VPCoordVP vp -> pretty vp++instance Pretty GenitiveSpecifier where+  pretty g =+    case g of+      GenitiveSpecifierD d -> pretty d+      GenitiveSpecifierPPC p -> pretty p+      GenitiveSpecifierN i -> fromText (pack (show i))++instance Pretty GenitiveN' where+  pretty (GenitiveN' ma n mac) =+    prettym " " ma <> pretty n <> mpretty " " mac++instance Pretty VP where+  pretty v =+    case v of+      VP v' -> pretty v'+      VPNeg cop v' -> pretty cop <> " not " <> pretty v'++instance Pretty V' where+  pretty (V' madverb compl mo) =+    prettym " " madverb <>+    pretty compl <>+    mconcat (map ((" " <>) . pretty) mo)++instance Pretty AdverbCoord where+  pretty (AdverbCoord ad mad) = pretty ad <> mpretty " and " mad++instance Pretty ComplV where+  pretty c =+    case c of+      ComplVIV i -> pretty i+      ComplVPI pi' pp -> pretty pi' <> " " <> pretty pp+      ComplVTV tv compl -> pretty tv <> " " <> pretty compl+      ComplVPV pt pp compl -> pretty pt <> " " <> pretty pp <> " " <> pretty compl+      ComplVPV' pt compl pp -> pretty pt <> " " <> pretty compl <> " " <> pretty pp+      ComplVDisV dis compl compl' -> pretty dis <> " " <> pretty compl <> " " <> pretty compl'+      ComplVPDV pd compl pp compl' -> pretty pd <> " " <> pretty compl <> " " <> pretty pp <> " " <> pretty compl'+      ComplVCopula cop copcomp -> pretty cop <> " " <> pretty copcomp++instance Pretty PhrasalTransitiveV where+  pretty (PhrasalTransitiveV t) = fromText t++instance Pretty PhrasalDistransitiveV where+  pretty (PhrasalDistransitiveV t) = fromText t++instance Pretty CopulaCompl where+  pretty c =+    case c of+      CopulaComplAPC apc -> pretty apc+      CopulaComplNPC npc -> pretty npc+      CopulaComplPP pp -> pretty pp++instance Pretty APCoord where+  pretty a =+    case a of+      APCoordAnd x y -> pretty x <> " and " <> pretty y+      APCoord a' -> pretty a'++instance Pretty APgrad where+  pretty a =+    case a of+      APgradAPThan x y -> pretty x <> " than " <> pretty y+      APgradAP a' -> pretty a'++instance Pretty AP where+  pretty a =+    case a of+      APIntrans i -> pretty i+      APTrans aj pp -> pretty aj <> " "  <> pretty pp++instance Pretty TransitiveAdjective where+  pretty (TransitiveAdjective t) = fromText t++instance Pretty Compl where+  pretty c =+    case c of+      ComplNP np -> pretty np+      ComplPP pp -> pretty pp++instance Pretty PhrasalIntransitiveV where+  pretty (PhrasalIntransitiveV t) = fromText t++instance Pretty PhrasalParticle where+  pretty (PhrasalParticle t) = fromText t++instance Pretty IntransitiveV where+  pretty (IntransitiveV v) = fromText v++instance Pretty TransitiveV where+  pretty (TransitiveV t) = fromText t++instance Pretty DistransitiveV where+  pretty (DistransitiveV t) = fromText t++instance Pretty IntransitiveAdjective where+  pretty (IntransitiveAdjective t) = fromText t++instance Pretty VModifier where+  pretty v =+    case v of+      VModifierVC adv -> pretty adv+      VModifierPP pp -> pretty pp+      VModifierAVPP x -> pretty x++instance Pretty AdverbialPP where+  pretty (AdverbialPP pp ac) =+    pretty pp <> " " <> pretty ac++instance Pretty Adverb where+  pretty (Adverb a) = fromText a++instance Pretty Specifier where+  pretty s =+    case s of+      SpecifyDeterminer d -> pretty d+      SpecifyPossessive np -> pretty np+      SpecifyNumberP n -> pretty n++instance Pretty AdjectiveCoord where+  pretty (AdjectiveCoord i ma) =+    pretty i <> mpretty " and " ma++instance Pretty NumberP where+  pretty (NumberP mq i) =+    prettym " " mq <> fromText (pack (show i))++instance Pretty ExistentialGlobalQuantor where+  pretty (ExistentialGlobalQuantor c) = "there " <> pretty c++instance Pretty ExistentialGlobalQuestionQuantor where+  pretty (ExistentialGlobalQuestionQuantor c) = pretty c <> " there"++instance Pretty Aux where+  pretty d =+    case d of+      Do -> "do"+      Does -> "does"++instance Pretty Coord where+  pretty c =+    case c of+      And -> "and"+      Or -> "or"++instance Pretty Copula where+  pretty c =+    case c of+      Is -> "is"+      Are -> "are"++instance Pretty Determiner where+  pretty d =+    case d of+      The -> "the"+      A -> "a"+      An -> "an"+      Some -> "some"+      No -> "no"+      EveryEach -> "every/each"+      All -> "all"+      NotEvery -> "not every"+      NotEach -> "not each"+      NotAll -> "not all"+      Which -> "which"++instance Pretty DistributiveGlobalQuantor where+  pretty ForEachOf = "for each of"++instance Pretty DistributiveMarker where+  pretty EachOf = "each of"++instance Pretty GeneralizedQuantor where+  pretty g =+    case g of+      AtMost -> "at most"+      AtLeast -> "at least"+      MoreThan -> "more than"+      LessThan -> "less than"+      NotMoreThan -> "not more than"+      NotLessThan -> "not less than"++instance Pretty PossessivePronoun where+  pretty p =+    case p of+      His -> "his"+      Her -> "her"+      HisHer -> "his/her"+      Its -> "its"+      Their -> "their"+      HisHerOwn -> "his own/her own"+      ItsOwn -> "its own"+      TheirOwn -> "their own"+      Whose -> "whose"++instance Pretty Pronoun where+  pretty p =+    case p of+      It                   -> "it"+      HeShe                -> "he/she"+      Himher               -> "him/her"+      They                 -> "they"+      Them                 -> "them"+      Itself               -> "itself"+      HimHerSelf           -> "himself/herself"+      Themselves           -> "themselves"+      SomeoneSomebody      -> "someone/somebody"+      Something            -> "something"+      NoOneNobody          -> "no-one/nobody"+      NoThing              -> "nothing"+      EveryoneEverybody    -> "everyone/everybody"+      Everything           -> "everything"+      NotEveryoneEverybody -> "not everyone/not everybody"+      NotEverything        -> "not everything"+      WhatWho              -> "what/who"+      Whom                 -> "whom"+      WhichWho             -> "which/who"++instance Pretty SaxonGenitiveMarker where+  pretty a =+    case a of+      Apostrophe -> "'"+      ApostropheS -> "'s"++instance Pretty UniversalGlobalQuantor where+  pretty u =+    case u of+      ForEvery -> "for every"+      ForEach -> "for each"+      ForAll -> "for all"
src/ACE/Types/Pretty.hs view
@@ -1,22 +1,15 @@+{-# LANGUAGE OverloadedStrings #-}+ -- | Pretty printing types and classes.  module ACE.Types.Pretty where -import Data.Default+import Data.Text.Lazy.Builder  -- | Pretty print a syntax tree node to a string. class Pretty p where-  pretty :: PrettySettings -> p -> String+  pretty :: p -> Builder  -- | Prints no string if nothing. instance Pretty a => Pretty (Maybe a) where-  pretty s = maybe "" (pretty s)---- | Settings used for pretty printing.-data PrettySettings = PrettySettings-  { prettyShowPrecedence :: Bool -- ^ Show precedence?-  }---- | Precedence showing enabled by default.-instance Default PrettySettings where-  def = PrettySettings { prettyShowPrecedence = True }+  pretty = maybe "" pretty
src/ACE/Types/Syntax.hs view
@@ -7,9 +7,6 @@  module ACE.Types.Syntax where -import ACE.Pretty--import Data.Monoid import Data.Text (Text) import Prelude hiding (String) @@ -62,12 +59,6 @@   SentenceCoord_3 !TopicalizedSentence !(Maybe SentenceCoord_3)   deriving (Show,Eq) --- | Singular/plural.-data Plurality-  = Singular-  | Plural-  deriving (Show,Eq)- -- | A topicalized sentence can start with an existential topic or a -- universal topic. It needs, however, not be topicalized at all but -- can just be an ordinary composite sentence.@@ -342,37 +333,21 @@   ExistentialGlobalQuestionQuantor !Copula   deriving (Show,Eq) -instance Pretty ExistentialGlobalQuestionQuantor where-  pretty s x =-    pretty s x <> " there"- data Aux   = Do -- ^ \"do\"   | Does -- ^ \"does\"   deriving (Show,Eq) -instance Pretty Aux where-  pretty _ Do = "do"-  pretty _ Does = "does"- data Coord   = And -- ^ \"and\"   | Or -- ^ \"or\"   deriving (Show,Eq) -instance Pretty Coord where-  pretty _ And = "and"-  pretty _ Or = "or"- data Copula   = Is -- ^ \"is\"   | Are -- ^ \"are\"   deriving (Show,Eq) -instance Pretty Copula where-  pretty _ Is = "is"-  pretty _ Are = "are"- data Determiner   = The -- ^ \"the\"   | A -- ^ \"a\"@@ -381,7 +356,8 @@   | No -- ^ \"no\"   | EveryEach -- ^ \"every\" / \"each\"   | All -- ^ \"all\"-  | NotEveryEach -- ^ \"not every\" / \"not each\"+  | NotEvery -- ^ \"not every\"+  | NotEach -- ^ \"not each\"   | NotAll -- ^ \"not all\"   | Which -- ^ \"which\"   deriving (Show,Eq)@@ -404,7 +380,9 @@   deriving (Show,Eq)  data PossessivePronoun-  = HisHer -- ^ \"his\" / \"her\" / \"his/her\"+  = His -- ^ \"his\"+  | Her -- ^ \"her\"+  | HisHer -- ^ \"his/her\"   | Its -- ^ \"its\"   | Their -- ^ \"their\"   | HisHerOwn -- ^ \"his own\" / \"her own\" / \"his/her own\"@@ -442,6 +420,7 @@   deriving (Show,Eq)  data UniversalGlobalQuantor-  = ForEveryEach -- ^ \"for every\" / \"for each\"+  = ForEvery -- ^ \"for every\"+  | ForEach -- ^ \"for each\"   | ForAll -- ^ \"for all\"   deriving (Show,Eq)
test/Main.hs view
@@ -8,9 +8,11 @@  import ACE.Combinators import ACE.Parsers+import ACE.Pretty import ACE.Tokenizer (tokenize) import ACE.Types.Syntax import ACE.Types.Tokens+import Data.Text.Lazy.Builder (fromText)  import Control.Applicative import Control.Monad hiding (ap)@@ -31,6 +33,7 @@ spec = do   describe "tokenizer" tokenizer   describe "parser" parser+  describe "printer" printer  -- | Tests for the tokenizer. tokenizer :: Spec@@ -420,18 +423,18 @@          Right (GenitiveSpecifierD Some))      it "genitiveSpecifier"         (parsed genitiveSpecifier "his" ==-         Right (GenitiveSpecifierPPC (PossessivePronounCoord HisHer Nothing)))+         Right (GenitiveSpecifierPPC (PossessivePronounCoord His Nothing)))  possessives =   do it "possessivePronounCoord"         (parsed possessivePronounCoord "his and her" ==-         Right (PossessivePronounCoord HisHer (Just (PossessivePronounCoord HisHer Nothing))))+         Right (PossessivePronounCoord His (Just (PossessivePronounCoord Her Nothing))))      it "possessivePronounCoord"         (parsed possessivePronounCoord "its" ==          Right (PossessivePronounCoord Its Nothing))      it "possessiveNPCoord"         (parsed possessiveNPCoord "his and her" ==-         Right (PossessiveNPCoordPronoun (PossessivePronounCoord HisHer (Just (PossessivePronounCoord HisHer Nothing)))))+         Right (PossessiveNPCoordPronoun (PossessivePronounCoord His (Just (PossessivePronounCoord Her Nothing)))))      it "possessiveNPCoord"         (parsed possessiveNPCoord "a <noun>'s" ==          Right (PossessiveNPCoordGen@@ -519,9 +522,9 @@  simple =   do it "universalGlobalQuantor"-        (parsed universalGlobalQuantor "for every" == Right ForEveryEach)+        (parsed universalGlobalQuantor "for every" == Right ForEvery)      it "possessivePronoun"-        (parsed possessivePronoun "his" == Right HisHer)+        (parsed possessivePronoun "his" == Right His)      it "generalizedQuantor"         (parsed generalizedQuantor "not more than" == Right NotMoreThan)      it "distributiveMarker"@@ -542,7 +545,7 @@      it "determiner"         (parsed determiner "the" == Right The)      it "determiner"-        (parsed determiner "not every" == Right NotEveryEach)+        (parsed determiner "not every" == Right NotEvery)  complVs =   do it "complVPI"@@ -592,6 +595,86 @@                  Nothing                  Nothing)) +printer =+  do isomorphic "existentialTopic" existentialTopic "there is a <noun>"+     isomorphic "sentence" sentence "a <noun> <intrans-verb>"+     isomorphic "sentence" sentence "a <noun> that <intrans-verb> <intrans-verb>"+     isomorphic "conditionalSentence" conditionalSentence "if a <noun> <intrans-verb> then some <noun> <intrans-verb>"+     isomorphic "universalTopic" universalTopic "for all <noun>"+     isomorphic "negatedSentence" negatedSentence "it is not the case that a <noun> <intrans-verb>"+     isomorphic "specification" specification "it is not the case that a <noun> <intrans-verb>."+     isomorphic "pp" pp "<prep> a <noun>"+     isomorphic "(n' False)" (n' False) "<noun>"+     isomorphic "(n' False)" (n' False) "<intrans-adj> <noun>"+     isomorphic "(n' False)" (n' False) "<intrans-adj> <noun> <var>"+     isomorphic "(n' False)" (n' False) "<intrans-adj> <noun> <var> of a <noun> a <noun> <intrans-verb>"+     isomorphic "relativeClauseCoord" relativeClauseCoord "that <intrans-verb> and a <noun> <intrans-verb>"+     isomorphic "relativeClause" relativeClause "that <intrans-verb>"+     isomorphic "relativeClause" relativeClause "a <noun> <intrans-verb>"+     isomorphic "relativeClause" relativeClause "that a <noun> <intrans-verb>"+     isomorphic "relativeClause" relativeClause "a <noun> a <noun> <intrans-verb>"+     isomorphic "relativeClause" relativeClause "<prep> a <noun> a <noun> <intrans-verb>"+     isomorphic "genitiveN'" genitiveN' "<noun> <var>"+     isomorphic "genitiveN'" genitiveN' "<intrans-adj> and <intrans-adj> <noun> <var>"+     isomorphic "npCoord" npCoord "each of some <noun>"+     isomorphic "npCoord" npCoord "some <noun>"+     isomorphic "vModifier" vModifier "<adverb> and <adverb>"+     isomorphic "vModifier" vModifier "<prep> a <noun>"+     isomorphic "vModifier" vModifier "<prep> <adverb> and <adverb>"+     isomorphic "adverbialPP" adverbialPP "<prep> <adverb> and <adverb>"+     isomorphic "v'" v' "<intrans-verb>"+     isomorphic "v'" v' "<trans-verb> <prep> a <noun>"+     isomorphic "v'" v' "<adverb> <ptrans-verb> <pparticle> <prep> a <noun> <adverb>"+     isomorphic "vp" vp "<intrans-verb>"+     isomorphic "vp" vp "is not <intrans-verb>"+     isomorphic "vpCoord" vpCoord "<intrans-verb> and is not <intrans-verb>"+     isomorphic "specifier" specifier "<proper-name>'s"+     isomorphic "specifier" specifier "1"+     isomorphic "specifier" specifier "a"+     isomorphic "genitiveSpecifier" genitiveSpecifier "1"+     isomorphic "genitiveSpecifier" genitiveSpecifier "a"+     isomorphic "genitiveSpecifier" genitiveSpecifier "some"+     isomorphic "genitiveSpecifier" genitiveSpecifier "his"+     isomorphic "possessivePronounCoord" possessivePronounCoord "his and her"+     isomorphic "possessivePronounCoord" possessivePronounCoord "its"+     isomorphic "possessiveNPCoord" possessiveNPCoord "his and her"+     isomorphic "possessiveNPCoord" possessiveNPCoord "a <noun>'s"+     isomorphic "genitiveNPCoord" genitiveNPCoord "<proper-name>'s"+     isomorphic "genitiveNPCoord" genitiveNPCoord "some <noun>'s"+     isomorphic "genitiveNPCoord" genitiveNPCoord "some <noun> and a <noun>'s"+     isomorphic "adjectiveCoord" adjectiveCoord "<intrans-adj>"+     isomorphic "adjectiveCoord" adjectiveCoord "<intrans-adj> and <intrans-adj>"+     isomorphic "adverbCoord" adverbCoord "<adverb> and <adverb>"+     isomorphic "ap" ap "<intrans-adj>"+     isomorphic "ap" ap "<trans-adj> <prep> a <noun>"+     isomorphic "apGrad" apGrad "<intrans-adj> than a <noun>"+     isomorphic "apCoord" apCoord "<intrans-adj> than a <noun> and <intrans-adj> than a <noun>"+     isomorphic "copulaCompl" copulaCompl "<prep> a <noun>"+     isomorphic "copulaCompl" copulaCompl "a <noun> and a <noun>"+     isomorphic "copulaCompl" copulaCompl "<intrans-adj> than a <noun> and a <noun>"+     isomorphic "universalGlobalQuantor" universalGlobalQuantor "for every"+     isomorphic "possessivePronoun" possessivePronoun "his"+     isomorphic "generalizedQuantor" generalizedQuantor "not more than"+     isomorphic "distributiveMarker" distributiveMarker "each of"+     isomorphic "distributiveGlobalQuantor" distributiveGlobalQuantor "for each of"+     isomorphic "existentialGlobalQuestionQuantor" existentialGlobalQuestionQuantor "is there"+     isomorphic "existentialGlobalQuantor" existentialGlobalQuantor "there is"+     isomorphic "numberP" numberP "not more than 5"+     isomorphic "numberP" numberP "5"+     isomorphic "determiner" determiner "the"+     isomorphic "determiner" determiner "not every"+     isomorphic "complV" complV "<pintrans-verb> <pparticle>"+     isomorphic "complV" complV "<intrans-verb>"+     isomorphic "complV" complV "<trans-verb> <prep> a <noun>"+     isomorphic "complV" complV "<ptrans-verb> <pparticle> a <noun>"+     isomorphic "complV" complV "<distrans-verb> a <noun> <prep> a <noun>"+     isomorphic "complV" complV "<pdistrans-verb> a <noun> <pparticle> a <noun>"+     isomorphic "complV" complV "is a <noun>"++  where isomorphic name parser text =+          it name+             (printed parser text == Right (fromText text))+ -- | Is that left? isLeft :: Either a b -> Bool isLeft = either (const True) (const False)@@ -599,6 +682,8 @@ -- | Get the parsed result after tokenizing. parsed :: Parsec [Token] (ACEParser [Token] Identity) c -> Text -> Either String c parsed p = tokenize >=> bimap show id . runP (p <* eof) defaultACEParser "<test>"++printed p = fmap pretty . parsed p  -- | Test a parser. testp :: Show a => Parsec [Token] (ACEParser [Token] Identity) a -> Text -> IO ()