preparing resource api for multilingual documentation

This commit is contained in:
aarne
2010-12-10 08:48:26 +00:00
parent 847561d2f6
commit 7b9e55650b
7 changed files with 562 additions and 114 deletions

71
lib/doc/MkExx.hs Normal file
View File

@@ -0,0 +1,71 @@
-- make a script for computing examples
-- usage: runghc MkExx.hs <koe.txt >koe.gfs
-- then: gf -retain -s ../alltenses/TryRon.gfo <koe.gfs
main = interact (unlines . concatMap mkScript . lines)
mkScript l = case l of
' ':_ ->
let ident = mkIdent $ unwords $ takeWhile (/="--") $ words l
in [add $ psq ident]
'-':_ -> []
_ -> [
add $ psq l,
add $ "cc -one " ++ l
]
add = ('\n':)
psq s = "ps \"" ++ s ++ "\""
-- makes mkUtt : QS -> Utt to mkUtt-QS-Utt
mkIdent :: String -> String
mkIdent = concatMap unspec where
unspec c = case c of
' ' -> ""
'>' -> ""
'(' -> ""
')' -> ""
':' -> "-"
_ -> [c]
langsCoding = [
(("amharic", "Amh"),""),
(("arabic", "Ara"),""),
(("bulgarian","Bul"),""),
(("catalan", "Cat"),"Romance"),
(("danish", "Dan"),"Scand"),
(("dutch", "Dut"),""),
(("english", "Eng"),""),
(("finnish", "Fin"),""),
(("french", "Fre"),"Romance"),
(("hindi", "Hin"),"Hindustani"),
(("german", "Ger"),""),
(("interlingua","Ina"),""),
(("italian", "Ita"),"Romance"),
(("latin", "Lat"),""),
(("norwegian","Nor"),"Scand"),
(("polish", "Pol"),""),
(("punjabi", "Pnb"),""),
(("romanian", "Ron"),""),
(("russian", "Rus"),""),
(("spanish", "Spa"),"Romance"),
(("swedish", "Swe"),"Scand"),
(("thai", "Tha"),""),
(("turkish", "Tur"),""),
(("urdu", "Urd"),"Hindustani")
]
langs = map fst langsCoding
-- languagues for which Try is normally compiled
langsLang = langs `except` langsIncomplete
-- languages for which Lang can be compiled but which are incomplete
langsIncomplete = ["Amh","Ara","Hin","Lat","Pnb","Rus","Tha","Tur","Urd"]
except ls es = filter (flip notElem es . snd) ls

View File

@@ -46,7 +46,9 @@ main = do
--- putStrLn $ unlines ["p -cat=" ++ last (words t) ++
--- " \"" ++ e ++ "\"" | (_,t,e) <- rs, not (null e)] ----
rs2 <- getRules structuralAPI
delimit $ mkSplitTables True isLatex cs $ rs ++ rs2
let rss = rs ++ rs2
mapM_ putStrLn [f ++ " " ++ e | (f,_,e) <- rss]
delimit $ mkSplitTables True isLatex cs rss
space
-- title "Structural Words"
-- space

367
lib/doc/api-examples.txt Normal file
View File

@@ -0,0 +1,367 @@
mkText : Phr -> (Punct) -> (Text) -> Text -- Does she sleep? Yes.
mkText (mkPhr (mkQS (mkCl she_NP sleep_V))) questMarkPunct (mkText (mkPhr yes_Utt) fullStopPunct)
mkText : Utt -> Text -- Yes.
mkText yes_Utt
mkText : S -> Text -- She slept.
mkText (mkS pastTense (mkCl she_NP sleep_V))
mkText : Cl -> Text -- She sleeps.
mkText (mkCl she_NP sleep_V)
mkText : QS -> Text -- Did she sleep?
mkText (mkQS pastTense (mkQCl (mkCl she_NP sleep_V)))
mkText : (Pol) -> Imp -> Text -- Don't sleep!
mkText negativePol (mkImp sleep_V)
mkText : Text -> Text -> Text -- Where? Here. When? Now!
mkText (mkText (mkPhr (mkUtt where_IAdv)) questMarkPunct (mkText (mkPhr (mkUtt here_Adv)))) (mkText (mkPhr (mkUtt when_IAdv)) questMarkPunct (mkText (mkPhr (mkUtt now_Adv)) exclMarkPunct))
-- emptyText : Text -- (empty text)
--emptyText
-- fullStopPunct : Punct -- .
--fullStopPunct
-- questMarkPunct : Punct -- ?
--questMarkPunct
-- exclMarkPunct : Punct -- !
--exclMarkPunct
-- mkPhr : (PConj) -> Utt -> (Voc) -> Phr -- but sleep, my friend
mkPhr but_PConj (mkUtt (mkImp sleep_V)) (mkVoc (mkNP i_Pron friend_N))
mkPhr : S -> Phr -- she won't sleep
mkPhr (mkS futureTense negativePol (mkCl she_NP sleep_V))
mkPhr : Cl -> Phr -- she sleeps
mkPhr (mkCl she_NP sleep_V)
mkPhr : QS -> Phr -- would she sleep
mkPhr (mkQS conditionalTense (mkQCl (mkCl she_NP sleep_V)))
mkPhr : Imp -> Phr -- sleep
mkPhr (mkImp sleep_V)
mkPConj : Conj -> PConj -- and
mkPConj and_Conj
mkVoc : NP -> Voc -- my friend
mkVoc (mkNP i_Pron friend_N)
mkUtt : S -> Utt -- she slept
mkUtt (mkS pastTense (mkCl she_NP sleep_V))
mkUtt : Cl -> Utt -- she sleeps
mkUtt (mkCl she_NP sleep_V)
mkUtt : QS -> Utt -- who didn't sleep
mkUtt (mkQS pastTense negativePol (mkQCl who_IP sleep_V))
mkUtt : QCl -> Utt -- who sleeps
mkUtt (mkQCl who_IP sleep_V)
mkUtt : (ImpForm) -> (Pol) -> Imp -> Utt -- don't be men
mkUtt pluralImpForm negativePol (mkImp (mkVP man_N))
mkUtt : IP -> Utt -- who
mkUtt who_IP
mkUtt : IAdv -> Utt -- why
mkUtt why_IAdv
mkUtt : NP -> Utt -- this man
mkUtt (mkNP this_Det man_N)
mkUtt : Adv -> Utt -- here
mkUtt here_Adv
mkUtt : VP -> Utt -- to sleep
mkUtt (mkVP sleep_V)
mkUtt : CN -> Utt -- beer
mkUtt (mkCN beer_N)
mkUtt : AP -> Utt -- good
mkUtt (mkAP good_A)
mkUtt : Card -> Utt -- five
mkUtt (mkCard (mkNumeral "5"))
lets_Utt : VP -> Utt -- let's sleep
mkPhr (lets_Utt (mkVP sleep_V))
positivePol : Pol -- she sleeps [default]
mkS positivePol (mkCl she_NP sleep_V)
negativePol : Pol -- she doesn't sleep
mkS negativePol (mkCl she_NP sleep_V)
simultaneousAnt : Ant -- she sleeps [default]
mkS simultaneousAnt (mkCl she_NP sleep_V)
anteriorAnt : Ant -- she has slept --# notpresent
mkS anteriorAnt (mkCl she_NP sleep_V)
presentTense : Tense -- she sleeps [default]
mkS presentTense (mkCl she_NP sleep_V)
pastTense : Tense -- she slept --# notpresent
mkS pastTense (mkCl she_NP sleep_V)
futureTense : Tense -- she will sleep --# notpresent
mkS futureTense (mkCl she_NP sleep_V)
conditionalTense : Tense -- she would sleep --# notpresent
mkS conditionalTense (mkCl she_NP sleep_V)
singularImpForm : ImpForm -- be a man [default]
mkUtt singularImpForm (mkImp (mkVP man_N))
pluralImpForm : ImpForm -- be men
mkUtt pluralImpForm (mkImp (mkVP man_N))
politeImpForm : ImpForm -- be a man [polite singular]
mkUtt politeImpForm (mkImp (mkVP man_N))
mkS : (Tense) -> (Ant) -> (Pol) -> Cl -> S -- she wouldn't have slept
mkS conditionalTense anteriorAnt negativePol (mkCl she_NP sleep_V)
mkS : Conj -> S -> S -> S -- she sleeps and I run
mkS : Conj -> ListS -> S -- she sleeps, I run and you sleep
mkS : Adv -> S -> S -- today, she sleeps
mkCl : NP -> V -> Cl -- she sleeps
mkCl : NP -> V2 -> NP -> Cl -- she loves him
mkCl : NP -> V3 -> NP -> NP -> Cl -- she sends it to him
mkCl : NP -> VV -> VP -> Cl -- she wants to sleep
mkCl : NP -> VS -> S -> Cl -- she says that she sleeps
mkCl : NP -> VQ -> QS -> Cl -- she wonders who sleeps
mkCl : NP -> VA -> AP -> Cl -- she becomes old
mkCl : NP -> V2A -> NP -> AP -> Cl -- she paints it red
mkCl : NP -> V2S -> NP -> S -> Cl -- she tells him that we sleep
mkCl : NP -> V2Q -> NP -> QS -> Cl -- she asks him who sleeps
mkCl : NP -> V2V -> NP -> VP -> Cl -- she forces him to sleep
mkCl : NP -> A -> Cl -- she is old
mkCl : NP -> A -> NP -> Cl -- she is older than him
mkCl : NP -> A2 -> NP -> Cl -- she is married to him
mkCl : NP -> AP -> Cl -- she is very old
mkCl : NP -> NP -> Cl -- she is the man
mkCl : NP -> N -> Cl -- she is a man
mkCl : NP -> CN -> Cl -- she is an old man
mkCl : NP -> Adv -> Cl -- she is here
mkCl : NP -> VP -> Cl -- she always sleeps here
mkCl : N -> Cl -- there is a house
mkCl : CN -> Cl -- there is an old house
mkCl : NP -> Cl -- there are five houses
mkCl : NP -> RS -> Cl -- it is she who sleeps
mkCl : Adv -> S -> Cl -- it is here he sleeps
mkCl : V -> Cl -- it rains
mkCl : VP -> Cl -- it is raining
mkCl : SC -> VP -> Cl
genericCl : VP -> Cl -- one sleeps
mkVP : V -> VP -- sleep
mkVP : V2 -> NP -> VP -- love it
mkVP : V3 -> NP -> NP -> VP -- send a message to him
mkVP : VV -> VP -> VP -- want to run
mkVP : VS -> S -> VP -- know that she runs
mkVP : VQ -> QS -> VP -- wonder if she runs
mkVP : VA -> AP -> VP -- become red
mkVP : V2A -> NP -> AP -> VP -- paint it red
mkVP : V2S -> NP -> S -> VP -- tell him that we sleep
mkVP : V2Q -> NP -> QS -> VP -- ask him who sleeps
mkVP : V2V -> NP -> VP -> VP -- force him to sleep
mkVP : A -> VP -- be warm
mkVP : A -> NP -> VP -- be older than him
mkVP : A2 -> NP -> VP -- be married to him
mkVP : AP -> VP -- be warm
mkVP : N -> VP -- be a man
mkVP : CN -> VP -- be an old man
mkVP : NP -> VP -- be this man
mkVP : Adv -> VP -- be here
mkVP : VP -> Adv -> VP -- sleep here
mkVP : AdV -> VP -> VP -- always sleep
mkVP : VPSlash -> NP -> VP -- paint it black
mkVP : VPSlash -> VP -- paint itself black
mkVP : Comp -> VP -- be warm
reflexiveVP : V2 -> VP -- love itself
passiveVP : V2 -> VP -- be loved
passiveVP : V2 -> NP -> VP -- be loved by her
progressiveVP : VP -> VP -- be sleeping
mkComp : AP -> Comp -- very old
mkComp : NP -> Comp -- this man
mkComp : Adv -> Comp -- here
mkSC : S -> SC -- that he sleeps
mkSC : QS -> SC -- whether he sleeps
mkSC : VP -> SC -- to sleep
mkImp : VP -> Imp -- go
mkImp : V -> Imp -- take it
mkImp : V2 -> NP -> Imp -- come here now
mkNP : Quant -> N -> NP -- this man
mkNP : Quant -> CN -> NP -- this old man
mkNP : Quant -> Num -> CN -> NP -- these five old men
mkNP : Quant -> Num -> N -> NP -- these five men
mkNP : Det -> CN -> NP -- the first old man
mkNP : Det -> N -> NP -- the first man
mkNP : Numeral -> CN -> NP -- fifty old men
mkNP : Numeral -> N -> NP -- fifty men
mkNP : Digits -> CN -> NP -- 51 old men
mkNP : Digits -> N -> NP -- 51 men
mkNP : Card -> CN -> NP -- forty-five old men
mkNP : Card -> N -> NP -- forty-five men
mkNP : Pron -> CN -> NP -- my old man
mkNP : Pron -> N -> NP -- my man
mkNP : PN -> NP -- she
mkNP : Pron -> NP -- he
mkNP : Quant -> NP -- this
mkNP : Quant -> Num -> NP -- these five
mkNP : Det -> NP -- these five best
mkNP : CN -> NP -- old beer
mkNP : N -> NP -- beer
mkNP : Predet -> NP -> NP -- only the man
mkNP : NP -> V2 -> NP -- the man seen
mkNP : NP -> Adv -> NP -- Paris today
mkNP : NP -> RS -> NP -- John, who lives in Paris
mkNP : Conj -> NP -> NP -> NP
mkNP : Conj -> ListNP -> NP
mkDet : Quant -> Det -- this
mkDet : Quant -> Card -> Det -- these five
mkDet : Quant -> Ord -> Det -- the best
mkDet : Quant -> Num -> Ord -> Det -- these five best
mkDet : Quant -> Num -> Det -- these five
mkDet : Card -> Det -- forty
mkDet : Digits -> Det -- 51
mkDet : Numeral -> Det -- five
mkDet : Pron -> Det -- my
mkDet : Pron -> Num -> Det -- my five
the_Det : Det -- the (house)
a_Det : Det -- a (house)
theSg_Det : Det -- the (houses)
thePl_Det : Det -- the (houses)
aSg_Det : Det -- a (house)
aPl_Det : Det -- (houses)
mkQuant : Pron -> Quant -- my
the_Quant : Quant -- the
a_Quant : Quant -- a
mkNum : Str -> Num -- thirty-five (given by "35")
mkNum : Numeral -> Num -- twenty
mkNum : Digits -> Num -- 21
mkNum : Digit -> Num -- five
mkNum : Card -> Num -- almost ten
mkNum : AdN -> Card -> Num -- almost ten
singularNum : Num -- singular
pluralNum : Num -- plural
mkCard : Str -> Card -- thirty-five (given as "35")
mkCard : Numeral -> Card -- twenty
mkCard : Digits -> Card -- 51
mkCard : AdN -> Card -> Card -- almost fifty
mkOrd : Numeral -> Ord -- twentieth
mkOrd : Digits -> Ord -- 51st
mkOrd : Digit -> Ord -- fifth
mkOrd : A -> Ord -- largest
mkAdN : CAdv -> AdN -- more than
mkNumeral : Sub1000 -> Numeral -- coerce 1..999
mkNumeral : Sub1000 -> Sub1000 -> Numeral -- 1000m + n
mkNumeral : Str -> Numeral -- thirty-five (given by "35")
thousandfoldNumeral : Sub1000 -> Numeral -- 1000n
mkSub1000 : Sub100 -> Sub1000 -- coerce 1..99
mkSub1000 : Sub10 -> Sub1000 -- 100n
mkSub1000 : Sub10 -> Sub100 -> Sub1000 -- 100m + n
mkSub100 : Unit -> Sub100 -- coerce 1..9
mkSub100 : Unit -> Unit -> Sub100 -- 10m + n
tenfoldSub100 : Unit -> Sub100 -- 10n
n1_Unit : Unit -- one
n2_Unit : Unit -- two
n3_Unit : Unit -- three
n4_Unit : Unit -- four
n5_Unit : Unit -- five
n6_Unit : Unit -- six
n7_Unit : Unit -- seven
n8_Unit : Unit -- eight
n9_Unit : Unit -- nine
mkDigits : Str -> Digits -- 35 (from string "35")
mkDigits : Dig -> Digits -- 4
mkDigits : Dig -> Digits -> Digits -- 1,233,432
n0_Dig : Dig -- 0
n1_Dig : Dig -- 1
n2_Dig : Dig -- 2
n3_Dig : Dig -- 3
n4_Dig : Dig -- 4
n5_Dig : Dig -- 5
n6_Dig : Dig -- 6
n7_Dig : Dig -- 7
n8_Dig : Dig -- 8
n9_Dig : Dig -- 9
mkCN : N -> CN -- house
mkCN : N2 -> NP -> CN -- mother of John
mkCN : N3 -> NP -> NP -> CN -- distance from this city to Paris
mkCN : N2 -> CN -- mother
mkCN : N3 -> CN -- distance
mkCN : A -> N -> CN -- big house
mkCN : A -> CN -> CN -- big blue house
mkCN : AP -> N -> CN -- very big house
mkCN : AP -> CN -> CN -- very big blue house
mkCN : N -> RS -> CN -- house that she owns
mkCN : CN -> RS -> CN -- big house that she loves
mkCN : N -> Adv -> CN -- house on the hill
mkCN : CN -> Adv -> CN -- big house on the hill
mkCN : CN -> S -> CN -- rule that she sleeps
mkCN : CN -> QS -> CN -- question if she sleeps
mkCN : CN -> VP -> CN -- reason to sleep
mkCN : CN -> SC -> CN -- reason to sleep
mkCN : N -> NP -> CN -- king John
mkCN : CN -> NP -> CN -- old king John
mkAP : A -> AP -- warm
mkAP : A -> NP -> AP -- warmer than Paris
mkAP : A2 -> NP -> AP -- married to her
mkAP : A2 -> AP -- married
mkAP : AP -> S -> AP -- probable that she sleeps
mkAP : AP -> QS -> AP -- uncertain if she sleeps
mkAP : AP -> VP -> AP -- ready to go
mkAP : AP -> SC -> AP -- ready to go
mkAP : AdA -> A -> AP -- very old
mkAP : AdA -> AP -> AP -- very very old
mkAP : Conj -> AP -> AP -> AP -- old and big
mkAP : Conj -> ListAP -> AP -- old, big and warm
mkAP : Ord -> AP -- oldest
mkAP : CAdv -> AP -> NP -> AP -- as old as she
reflAP : A2 -> AP -- married to himself
comparAP : A -> AP -- warmer
mkAdv : A -> Adv -- warmly
mkAdv : Prep -> NP -> Adv -- in the house
mkAdv : Subj -> S -> Adv -- when she sleeps
mkAdv : CAdv -> A -> NP -> Adv -- more warmly than she
mkAdv : CAdv -> A -> S -> Adv -- more warmly than he runs
mkAdv : AdA -> Adv -> Adv -- very warmly
mkAdv : Conj -> Adv -> Adv -> Adv -- here and now
mkAdv : Conj -> ListAdv -> Adv -- with John, here and now
mkQS : (Tense) -> (Ant) -> (Pol) -> QCl -> QS -- who wouldn't have slept
mkQS : Cl -> QS
mkQCl : Cl -> QCl -- does she sleep
mkQCl : IP -> VP -> QCl -- who sleeps
mkQCl : IP -> V -> QCl -- who sleeps
mkQCl : IP -> V2 -> NP -> QCl -- who loves her
mkQCl : IP -> V3 -> NP -> NP -> QCl -- who sends it to her
mkQCl : IP -> VV -> VP -> QCl -- who wants to sleep
mkQCl : IP -> VS -> S -> QCl -- who says that she sleeps
mkQCl : IP -> VQ -> QS -> QCl -- who wonders who sleeps
mkQCl : IP -> VA -> AP -> QCl -- who becomes old
mkQCl : IP -> V2A -> NP -> AP -> QCl -- who paints it red
mkQCl : IP -> V2S -> NP -> S -> QCl -- who tells her that we sleep
mkQCl : IP -> V2Q -> NP -> QS -> QCl -- who asks her who sleeps
mkQCl : IP -> V2V -> NP -> VP -> QCl -- who forces her to sleep
mkQCl : IP -> A -> QCl -- who is old
mkQCl : IP -> A -> NP -> QCl -- who is older than her
mkQCl : IP -> A2 -> NP -> QCl -- who is married to her
mkQCl : IP -> AP -> QCl -- who is very old
mkQCl : IP -> NP -> QCl -- who is the man
mkQCl : IP -> N -> QCl -- who is a man
mkQCl : IP -> CN -> QCl -- who is an old man
mkQCl : IP -> Adv -> QCl -- who is here
mkQCl : IP -> NP -> V2 -> QCl -- who does she love
mkQCl : IP -> ClSlash -> QCl -- who does she today
mkQCl : IAdv -> Cl -> QCl -- why does she sleep
mkQCl : Prep -> IP -> Cl -> QCl -- with whom does she sleep
mkQCl : IAdv -> NP -> QCl -- where is she
mkQCl : IComp -> NP -> QCl -- who is this man
mkQCl : IP -> QCl -- which houses are there
mkIP : IDet -> CN -> IP -- which five big cities
mkIP : IDet -> N -> IP -- which five cities
mkIP : IDet -> IP -- which five
mkIP : IQuant -> CN -> IP -- which big cities
mkIP : IQuant -> Num -> CN -> IP -- which five cities
mkIP : IQuant -> N -> IP -- which city
mkIP : IP -> Adv -> IP -- who in Paris
what_IP : IP -- what (singular)
who_IP : IP -- who (singular)
mkIAdv : Prep -> IP -> IAdv -- in which city
mkIAdv : IAdv -> Adv -> IAdv -- where in Paris
mkIDet : IQuant -> Num -> IDet -- which (songs)
mkIDet : IQuant -> IDet
which_IDet : IDet
whichPl_IDet : IDet
mkRS : (Tense) -> (Ant) -> (Pol) -> RCl -> RS -- that wouldn't have slept
mkRS : Conj -> RS -> RS -> RS -- who sleeps and whose mother runsx
mkRS : Conj -> ListRS -> RS -- who sleeps, whom I see and who sleeps
mkRCl : RP -> VP -> RCl -- that loves she
mkRCl : RP -> ClSlash -> RCl -- whom she loves today
mkRCl : RP -> NP -> V2 -> RCl -- whom she loves
mkRCl : Cl -> RCl -- such that she loves him
which_RP : RP -- which
mkRP : Prep -> NP -> RP -> RP -- all the houses in which
mkSSlash : Temp -> Pol -> ClSlash -> SSlash
mkClSlash : NP -> VPSlash -> ClSlash -- (whom) he sees here
mkClSlash : NP -> V2 -> ClSlash -- (whom) he sees
mkClSlash : NP -> VV -> V2 -> ClSlash -- (whom) he wants to see
mkClSlash : Cl -> Prep -> ClSlash -- (with whom) he sleeps
mkClSlash : ClSlash -> Adv -> ClSlash -- (whom) he sees tomorrow
mkClSlash : NP -> VS -> SSlash -> ClSlash -- (whom) she says that he loves
mkVPSlash : V2 -> VPSlash -- (whom) (she) loves
mkVPSlash : V3 -> NP -> VPSlash -- (whom) (she) gives an apple
mkVPSlash : V2A -> AP -> VPSlash -- (whom) (she) paints red
mkVPSlash : V2Q -> QS -> VPSlash -- (whom) (she) asks who sleeps
mkVPSlash : V2S -> S -> VPSlash -- (whom) (she) tells that we sleep
mkVPSlash : V2V -> VP -> VPSlash -- (whom) (she) forces to sleep
mkVPSlash : VV -> VPSlash -> VPSlash -- want always to buy
mkVPSlash : V2V -> NP -> VPSlash -> VPSlash -- beg me always to buy

View File

@@ -74,13 +74,13 @@ incomplete resource Constructors = open Grammar in { --%
oper
mkText = overload { --%
mkText : Phr -> (Punct) -> (Text) -> Text -- John walks? Yes. --:
mkText : Phr -> (Punct) -> (Text) -> Text -- Does she sleep? Yes. --:
= \phr,punct,text -> case punct of { --%
PFullStop => TFullStop phr text ; --%
PExclMark => TExclMark phr text ; --%
PQuestMark => TQuestMark phr text --%
} ; --%
mkText : Phr -> Text -> Text -- 1. But John walks. Yes! --%
mkText : Phr -> Text -> Text -- But she sleeps. Yes! --%
= \x,t -> TFullStop x t ; --%
mkText : Phr -> Punct -> Text --%
= \phr,punct -> case punct of { --%
@@ -88,7 +88,7 @@ incomplete resource Constructors = open Grammar in { --%
PExclMark => TExclMark phr TEmpty ; --%
PQuestMark => TQuestMark phr TEmpty --%
} ; --%
mkText : Phr -> Text -- 1. But John walks. --%
mkText : Phr -> Text -- But she sleeps. --%
= \x -> TFullStop x TEmpty ; --%
@@ -98,19 +98,20 @@ incomplete resource Constructors = open Grammar in { --%
mkText : Utt -> Text -- Yes.
= \u -> TFullStop (PhrUtt NoPConj u NoVoc) TEmpty ; --%
mkText : S -> Text -- John walked.
mkText : S -> Text -- She slept.
= \s -> TFullStop (PhrUtt NoPConj (UttS s) NoVoc) TEmpty ; --%
mkText : Cl -> Text -- John walks.
mkText : Cl -> Text -- She sleeps.
= \c -> TFullStop (PhrUtt NoPConj (UttS (TUseCl TPres ASimul PPos c)) NoVoc) TEmpty ; --%
mkText : QS -> Text -- Did John walk?
mkText : QS -> Text -- Did she sleep?
= \q -> TQuestMark (PhrUtt NoPConj (UttQS q) NoVoc) TEmpty ; --%
mkText : (Pol) -> Imp -> Text -- Walk!
mkText : (Pol) -> Imp -> Text -- Don't sleep!
= \p,i -> TExclMark (PhrUtt NoPConj (UttImpSg p i) NoVoc) TEmpty; --%
mkText : Imp -> Text -- Walk! --%
mkText : Imp -> Text -- Sleep! --%
= \i -> TExclMark (PhrUtt NoPConj (UttImpSg PPos i) NoVoc) TEmpty; --%
-- Finally, two texts can be combined into a text.
mkText : Text -> Text -> Text -- Where? When? Here. Now!
mkText : Text -> Text -> Text -- Where? Here. When? Here. Now!
= \t,u -> {s = t.s ++ u.s ; lock_Text = <>} ; --%
} ; --%
@@ -142,7 +143,7 @@ incomplete resource Constructors = open Grammar in { --%
-- and a vocative, both of which are by default empty.
mkPhr = overload { --%
mkPhr : (PConj) -> Utt -> (Voc) -> Phr -- but come here John --:
mkPhr : (PConj) -> Utt -> (Voc) -> Phr -- but sleep, my friend --:
= PhrUtt ; --%
mkPhr : Utt -> Voc -> Phr -- come here John --%
= \u,v -> PhrUtt NoPConj u v ; --%
@@ -154,13 +155,13 @@ incomplete resource Constructors = open Grammar in { --%
-- A phrase can also be directly built by a sentence, a present-tense
-- clause, a question, or a positive singular imperative.
mkPhr : S -> Phr -- I go home
mkPhr : S -> Phr -- she won't sleep
= \s -> PhrUtt NoPConj (UttS s) NoVoc ; --%
mkPhr : Cl -> Phr -- I go home
mkPhr : Cl -> Phr -- she sleeps
= \s -> PhrUtt NoPConj (UttS (TUseCl TPres ASimul PPos s)) NoVoc ; --%
mkPhr : QS -> Phr -- I go home
mkPhr : QS -> Phr -- would she sleep
= \s -> PhrUtt NoPConj (UttQS s) NoVoc ; --%
mkPhr : Imp -> Phr -- I go home
mkPhr : Imp -> Phr -- sleep
= \s -> PhrUtt NoPConj (UttImpSg PPos s) NoVoc --%
} ; --%
@@ -172,7 +173,7 @@ incomplete resource Constructors = open Grammar in { --%
mkPConj : Conj -> PConj -- and --:
= PConjConj ; --%
noPConj : PConj --%
noPConj : PConj --: --%
= NoPConj ; --%
@@ -181,7 +182,7 @@ incomplete resource Constructors = open Grammar in { --%
-- Any noun phrase can be turned into a vocative.
-- More vocatives are defined in $Structural$.
mkVoc : NP -> Voc -- John --:
mkVoc : NP -> Voc -- my friend --:
= VocNP ; --%
noVoc : Voc --%
= NoVoc ; --%
@@ -192,20 +193,19 @@ incomplete resource Constructors = open Grammar in { --%
-- Utterances are formed from sentences, clauses, questions, and imperatives.
mkUtt = overload {
mkUtt : S -> Utt -- John walked --:
mkUtt : S -> Utt -- she slept --:
= UttS ; --%
mkUtt : Cl -> Utt -- John walks
mkUtt : Cl -> Utt -- she sleeps
= \c -> UttS (TUseCl TPres ASimul PPos c) ; --%
mkUtt : QS -> Utt -- did John walk --:
mkUtt : QS -> Utt -- who didn't sleep --:
= UttQS ; --%
mkUtt : QCl -> Utt -- does John walk
mkUtt : QCl -> Utt -- who sleeps
= \c -> UttQS (TUseQCl TPres ASimul PPos c) ; --%
mkUtt : (ImpForm) -> (Pol) -> Imp -> Utt -- don't love yourselves --:
mkUtt : (ImpForm) -> (Pol) -> Imp -> Utt -- don't be men --:
= mkUttImp ; --%
mkUtt : ImpForm -> Imp -> Utt -- love yourselves --%
mkUtt : ImpForm -> Imp -> Utt -- be men --%
= \f -> mkUttImp f PPos ; --%
mkUtt : Pol -> Imp -> Utt -- don't love yourself --%
mkUtt : Pol -> Imp -> Utt -- don't be men --%
= UttImpSg ; --%
mkUtt : Imp -> Utt -- love yourself --%
= UttImpSg PPos ; --%
@@ -233,7 +233,7 @@ incomplete resource Constructors = open Grammar in { --%
-- The plural first-person imperative is a special construction.
lets_Utt : VP -> Utt -- let's walk --:
lets_Utt : VP -> Utt -- let's sleep --:
= ImpPl1 ; --%
@@ -244,9 +244,9 @@ incomplete resource Constructors = open Grammar in { --%
-- Polarity is a parameter that sets a clause to positive or negative
-- form. Since positive is the default, it need never be given explicitly.
positivePol : Pol -- John walks [default] --:
positivePol : Pol -- she sleeps [default] --:
= PPos ; --%
negativePol : Pol -- John doesn't walk --:
negativePol : Pol -- she doesn't sleep --:
= PNeg ; --%
--3 Ant, anteriority
@@ -255,9 +255,9 @@ incomplete resource Constructors = open Grammar in { --%
-- anterior to some other reference time.
-- Since simultaneous is the default, it need never be given explicitly.
simultaneousAnt : Ant -- John walks [default] --:
simultaneousAnt : Ant -- she sleeps [default] --:
= ASimul ; --%
anteriorAnt : Ant -- John has walked --# notpresent --:
anteriorAnt : Ant -- she has slept --# notpresent --:
= AAnter ; --# notpresent --%
--3 Tense, tense
@@ -266,13 +266,13 @@ incomplete resource Constructors = open Grammar in { --%
-- to the time of speaking about it.
-- Since present is the default, it need never be given explicitly.
presentTense : Tense -- John walks [default] --:
presentTense : Tense -- she sleeps [default] --:
= TPres ; --%
pastTense : Tense -- John walked --# notpresent --:
pastTense : Tense -- she slept --# notpresent --:
= TPast ; --# notpresent --%
futureTense : Tense -- John will walk --# notpresent --:
futureTense : Tense -- she will sleep --# notpresent --:
= TFut ; --# notpresent --%
conditionalTense : Tense -- John would walk --# notpresent --:
conditionalTense : Tense -- she would sleep --# notpresent --:
= TCond ; --# notpresent --%
--3 ImpForm, imperative form
@@ -281,11 +281,11 @@ incomplete resource Constructors = open Grammar in { --%
-- by reference to the person or persons addressed.
-- Since singular is the default, it need never be given explicitly.
singularImpForm : ImpForm -- help yourself [default] --:
singularImpForm : ImpForm -- be a man [default] --:
= IFSg ; --%
pluralImpForm : ImpForm -- help yourselves --:
pluralImpForm : ImpForm -- be men --:
= IFPl ; --%
politeImpForm : ImpForm -- help yourself [polite singular] --:
politeImpForm : ImpForm -- be a man [polite singular] --:
= IFPol ; --%
-- This is how imperatives are implemented internally. --%
@@ -322,20 +322,20 @@ incomplete resource Constructors = open Grammar in { --%
= \t,p -> TUseCl t ASimul p ; --%
mkS : Ant -> Pol -> Cl -> S --%
= \a,p -> TUseCl TPres a p ; --%
mkS : (Tense) -> (Ant) -> (Pol) -> Cl -> S -- John wouldn't have walked --:
mkS : (Tense) -> (Ant) -> (Pol) -> Cl -> S -- she wouldn't have slept --:
= \t,a -> TUseCl t a ; --%
-- Sentences can be combined with conjunctions. This can apply to a pair
-- of sentences, but also to a list of more than two.
mkS : Conj -> S -> S -> S -- John walks and I run
mkS : Conj -> S -> S -> S -- she sleeps and I run
= \c,x,y -> ConjS c (BaseS x y) ; --%
mkS : Conj -> ListS -> S -- John walks, I run and you sleep --:
mkS : Conj -> ListS -> S -- she sleeps, I run and you sleep --:
= \c,xy -> ConjS c xy ; --%
-- A sentence can be prefixed by an adverb.
mkS : Adv -> S -> S -- today, John walks --:
mkS : Adv -> S -> S -- today, she sleeps --:
= AdvS ; --%
} ;
@@ -347,50 +347,50 @@ incomplete resource Constructors = open Grammar in { --%
mkCl = overload {
mkCl : NP -> V -> Cl -- John walks
mkCl : NP -> V -> Cl -- she sleeps
= \s,v -> PredVP s (UseV v); --%
mkCl : NP -> V2 -> NP -> Cl -- John loves her
mkCl : NP -> V2 -> NP -> Cl -- she loves him
= \s,v,o -> PredVP s (ComplV2 v o); --%
mkCl : NP -> V3 -> NP -> NP -> Cl -- John sends it to her
mkCl : NP -> V3 -> NP -> NP -> Cl -- she sends it to him
= \s,v,o,i -> PredVP s (ComplV3 v o i); --%
mkCl : NP -> VV -> VP -> Cl -- John wants to walk
mkCl : NP -> VV -> VP -> Cl -- she wants to sleep
= \s,v,vp -> PredVP s (ComplVV v vp) ; --%
mkCl : NP -> VS -> S -> Cl -- John says that she walks
mkCl : NP -> VS -> S -> Cl -- she says that she sleeps
= \s,v,p -> PredVP s (ComplVS v p) ; --%
mkCl : NP -> VQ -> QS -> Cl -- John wonders who walks
mkCl : NP -> VQ -> QS -> Cl -- she wonders who sleeps
= \s,v,q -> PredVP s (ComplVQ v q) ; --%
mkCl : NP -> VA -> AP -> Cl -- John becomes old
mkCl : NP -> VA -> AP -> Cl -- she becomes old
= \s,v,q -> PredVP s (ComplVA v q) ; --%
mkCl : NP -> V2A -> NP -> AP -> Cl -- John paints it red
mkCl : NP -> V2A -> NP -> AP -> Cl -- she paints it red
= \s,v,n,q -> PredVP s (ComplV2A v n q) ; --%
mkCl : NP -> V2S -> NP -> S -> Cl -- John tells her that we walk
mkCl : NP -> V2S -> NP -> S -> Cl -- she tells him that we sleep
= \s,v,n,q -> PredVP s (ComplSlash (SlashV2S v q) n) ; --%
mkCl : NP -> V2Q -> NP -> QS -> Cl -- John asks her who walks
mkCl : NP -> V2Q -> NP -> QS -> Cl -- she asks him who sleeps
= \s,v,n,q -> PredVP s (ComplSlash (SlashV2Q v q) n) ; --%
mkCl : NP -> V2V -> NP -> VP -> Cl -- John forces her to walk
mkCl : NP -> V2V -> NP -> VP -> Cl -- she forces him to sleep
= \s,v,n,q -> PredVP s (ComplSlash (SlashV2V v q) n) ; --%
mkCl : NP -> A -> Cl -- John is old
mkCl : NP -> A -> Cl -- she is old
= \x,y -> PredVP x (UseComp (CompAP (PositA y))) ; --%
mkCl : NP -> A -> NP -> Cl -- John is older than her
mkCl : NP -> A -> NP -> Cl -- she is older than him
= \x,y,z -> PredVP x (UseComp (CompAP (ComparA y z))) ; --%
mkCl : NP -> A2 -> NP -> Cl -- John is married to her
mkCl : NP -> A2 -> NP -> Cl -- she is married to him
= \x,y,z -> PredVP x (UseComp (CompAP (ComplA2 y z))) ; --%
mkCl : NP -> AP -> Cl -- John is very old
mkCl : NP -> AP -> Cl -- she is very old
= \x,y -> PredVP x (UseComp (CompAP y)) ; --%
mkCl : NP -> NP -> Cl -- John is the man
mkCl : NP -> NP -> Cl -- she is the man
= \x,y -> PredVP x (UseComp (CompNP y)) ; --%
mkCl : NP -> N -> Cl -- John is a man
mkCl : NP -> N -> Cl -- she is a man
= \x,y -> PredVP x (UseComp (CompCN (UseN y))) ; --%
mkCl : NP -> CN -> Cl -- John is an old man
mkCl : NP -> CN -> Cl -- she is an old man
= \x,y -> PredVP x (UseComp (CompCN y)) ; --%
mkCl : NP -> Adv -> Cl -- John is here
mkCl : NP -> Adv -> Cl -- she is here
= \x,y -> PredVP x (UseComp (CompAdv y)) ; --%
-- As the general rule, a clause can be built from a subject noun phrase and
-- a verb phrase.
mkCl : NP -> VP -> Cl -- John always walks here --:
mkCl : NP -> VP -> Cl -- she always sleeps here --:
= PredVP ; --%
-- Existentials are a special form of clauses.
@@ -405,9 +405,9 @@ incomplete resource Constructors = open Grammar in { --%
-- There are also special forms in which a noun phrase or an adverb is
-- emphasized.
mkCl : NP -> RS -> Cl -- it is John who walks --:
mkCl : NP -> RS -> Cl -- it is she who sleeps --:
= CleftNP ; --%
mkCl : Adv -> S -> Cl -- it is here he walks --:
mkCl : Adv -> S -> Cl -- it is here he sleeps --:
= CleftAdv ; --%
-- Subjectless verb phrases are used for impersonal actions.
@@ -423,7 +423,7 @@ incomplete resource Constructors = open Grammar in { --%
-- Generic clauses are those with an impersonal subject.
genericCl : VP -> Cl -- one walks
genericCl : VP -> Cl -- one sleeps
= GenericCl ; --%
--2 Verb phrases and imperatives
@@ -437,7 +437,7 @@ incomplete resource Constructors = open Grammar in { --%
= UseV ; --%
mkVP : V2 -> NP -> VP -- love it
= ComplV2 ; --%
mkVP : V3 -> NP -> NP -> VP -- send a message to her
mkVP : V3 -> NP -> NP -> VP -- send a message to him
= ComplV3 ; --%
mkVP : VV -> VP -> VP -- want to run --:
= ComplVV ; --%
@@ -449,11 +449,11 @@ incomplete resource Constructors = open Grammar in { --%
= ComplVA ; --%
mkVP : V2A -> NP -> AP -> VP -- paint it red
= ComplV2A ; --%
mkVP : V2S -> NP -> S -> VP -- tell her that we walk
mkVP : V2S -> NP -> S -> VP -- tell him that we sleep
= \v,n,q -> (ComplSlash (SlashV2S v q) n) ; --%
mkVP : V2Q -> NP -> QS -> VP -- ask her who walks
mkVP : V2Q -> NP -> QS -> VP -- ask him who sleeps
= \v,n,q -> (ComplSlash (SlashV2Q v q) n) ; --%
mkVP : V2V -> NP -> VP -> VP -- force her to walk
mkVP : V2V -> NP -> VP -> VP -- force him to sleep
= \v,n,q -> (ComplSlash (SlashV2V v q) n) ; --%
-- The verb can also be a copula ("be"), and the relevant argument is
@@ -461,9 +461,9 @@ incomplete resource Constructors = open Grammar in { --%
mkVP : A -> VP -- be warm
= \a -> UseComp (CompAP (PositA a)) ; --%
mkVP : A -> NP -> VP -- be older than her
mkVP : A -> NP -> VP -- be older than him
= \y,z -> (UseComp (CompAP (ComparA y z))) ; --%
mkVP : A2 -> NP -> VP -- be married to her
mkVP : A2 -> NP -> VP -- be married to him
= \y,z -> (UseComp (CompAP (ComplA2 y z))) ; --%
mkVP : AP -> VP -- be warm
= \a -> UseComp (CompAP a) ; --%
@@ -530,11 +530,11 @@ incomplete resource Constructors = open Grammar in { --%
--3 SC, embedded sentence
mkSC = overload { --%
mkSC : S -> SC -- that he walks --:
mkSC : S -> SC -- that he sleeps --:
= EmbedS ; --%
mkSC : QS -> SC -- whether he walks --:
mkSC : QS -> SC -- whether he sleeps --:
= EmbedQS ; --%
mkSC : VP -> SC -- to walk --:
mkSC : VP -> SC -- to sleep --:
= EmbedVP ; --%
} ; --%
@@ -599,7 +599,7 @@ incomplete resource Constructors = open Grammar in { --%
-- Proper names and pronouns can be used as noun phrases.
mkNP : PN -> NP -- John --:
mkNP : PN -> NP -- she --:
= UsePN ; --%
mkNP : Pron -> NP -- he --:
= UsePron ; --%
@@ -940,9 +940,9 @@ incomplete resource Constructors = open Grammar in { --%
-- A common noun phrase can be modified by a relative clause or an adverb.
mkCN : N -> RS -> CN -- house that John owns
mkCN : N -> RS -> CN -- house that she owns
= \x,y -> RelCN (UseN x) y ; --%
mkCN : CN -> RS -> CN -- big house that John loves --:
mkCN : CN -> RS -> CN -- big house that she loves --:
= RelCN ; --%
mkCN : N -> Adv -> CN -- house on the hill
= \x,y -> AdvCN (UseN x) y ; --%
@@ -953,13 +953,13 @@ incomplete resource Constructors = open Grammar in { --%
-- questions, or infinitives. But syntactically this is possible for
-- all nouns.
mkCN : CN -> S -> CN -- rule that John walks
mkCN : CN -> S -> CN -- rule that she sleeps
= \cn,s -> SentCN cn (EmbedS s) ; --%
mkCN : CN -> QS -> CN -- question if John walks
mkCN : CN -> QS -> CN -- question if she sleeps
= \cn,s -> SentCN cn (EmbedQS s) ; --%
mkCN : CN -> VP -> CN -- reason to walk
mkCN : CN -> VP -> CN -- reason to sleep
= \cn,s -> SentCN cn (EmbedVP s) ; --%
mkCN : CN -> SC -> CN -- reason to walk --:
mkCN : CN -> SC -> CN -- reason to sleep --:
= \cn,s -> SentCN cn s ; --%
-- A noun can be used in apposition to a noun phrase, especially a proper name.
@@ -996,9 +996,9 @@ incomplete resource Constructors = open Grammar in { --%
-- questions, or infinitives. Syntactically this is possible for
-- all adjectives.
mkAP : AP -> S -> AP -- probable that John walks
mkAP : AP -> S -> AP -- probable that she sleeps
= \ap,s -> SentAP ap (EmbedS s) ; --%
mkAP : AP -> QS -> AP -- uncertain if John walks
mkAP : AP -> QS -> AP -- uncertain if she sleeps
= \ap,s -> SentAP ap (EmbedQS s) ; --%
mkAP : AP -> VP -> AP -- ready to go
= \ap,s -> SentAP ap (EmbedVP s) ; --%
@@ -1023,7 +1023,7 @@ incomplete resource Constructors = open Grammar in { --%
mkAP : Ord -> AP -- oldest
= AdjOrd ; --%
mkAP : CAdv -> AP -> NP -> AP -- as old as John
mkAP : CAdv -> AP -> NP -> AP -- as old as she
= CAdvAP ; --%
} ; --%
@@ -1048,12 +1048,12 @@ incomplete resource Constructors = open Grammar in { --%
-- Subordinate sentences are treated as adverbs.
mkAdv : Subj -> S -> Adv -- when John walks --:
mkAdv : Subj -> S -> Adv -- when she sleeps --:
= SubjS ; --%
-- An adjectival adverb can be compared to a noun phrase or a sentence.
mkAdv : CAdv -> A -> NP -> Adv -- more warmly than John --:
mkAdv : CAdv -> A -> NP -> Adv -- more warmly than she --:
= ComparAdvAdj ; --%
mkAdv : CAdv -> A -> S -> Adv -- more warmly than he runs --:
= ComparAdvAdjS ; --%
@@ -1098,7 +1098,7 @@ incomplete resource Constructors = open Grammar in { --%
= \t,p -> TUseQCl t ASimul p ; --%
mkQS : Ant -> Pol -> QCl -> QS --%
= \a,p -> TUseQCl TPres a p ; --%
mkQS : (Tense) -> (Ant) -> (Pol) -> QCl -> QS -- who wouldn't have walked
mkQS : (Tense) -> (Ant) -> (Pol) -> QCl -> QS -- who wouldn't have slept
= TUseQCl ; --%
-- Since 'yes-no' question clauses can be built from clauses (see below),
@@ -1117,7 +1117,7 @@ incomplete resource Constructors = open Grammar in { --%
-- 'Yes-no' question clauses are built from 'declarative' clauses.
mkQCl : Cl -> QCl -- does John walk --:
mkQCl : Cl -> QCl -- does she sleep --:
= QuestCl ; --%
-- 'Wh' questions are built from interrogative pronouns in subject
@@ -1126,29 +1126,29 @@ incomplete resource Constructors = open Grammar in { --%
-- The latter uses the 'slash' category of objectless clauses
-- (see below); we give the common special case with a two-place verb.
mkQCl : IP -> VP -> QCl -- who walks --:
mkQCl : IP -> VP -> QCl -- who sleeps --:
= QuestVP ; --%
mkQCl : IP -> V -> QCl -- who walks
mkQCl : IP -> V -> QCl -- who sleeps
= \s,v -> QuestVP s (UseV v); --%
mkQCl : IP -> V2 -> NP -> QCl -- who loves her
= \s,v,o -> QuestVP s (ComplV2 v o); --%
mkQCl : IP -> V3 -> NP -> NP -> QCl -- who sends it to her
= \s,v,o,i -> QuestVP s (ComplV3 v o i); --%
mkQCl : IP -> VV -> VP -> QCl -- who wants to walk
mkQCl : IP -> VV -> VP -> QCl -- who wants to sleep
= \s,v,vp -> QuestVP s (ComplVV v vp) ; --%
mkQCl : IP -> VS -> S -> QCl -- who says that she walks
mkQCl : IP -> VS -> S -> QCl -- who says that she sleeps
= \s,v,p -> QuestVP s (ComplVS v p) ; --%
mkQCl : IP -> VQ -> QS -> QCl -- who wonders who walks
mkQCl : IP -> VQ -> QS -> QCl -- who wonders who sleeps
= \s,v,q -> QuestVP s (ComplVQ v q) ; --%
mkQCl : IP -> VA -> AP -> QCl -- who becomes old
= \s,v,q -> QuestVP s (ComplVA v q) ; --%
mkQCl : IP -> V2A -> NP -> AP -> QCl -- who paints it red
= \s,v,n,q -> QuestVP s (ComplV2A v n q) ; --%
mkQCl : IP -> V2S -> NP -> S -> QCl -- who tells her that we walk
mkQCl : IP -> V2S -> NP -> S -> QCl -- who tells her that we sleep
= \s,v,n,q -> QuestVP s (ComplSlash (SlashV2S v q) n) ; --%
mkQCl : IP -> V2Q -> NP -> QS -> QCl -- who asks her who walks
mkQCl : IP -> V2Q -> NP -> QS -> QCl -- who asks her who sleeps
= \s,v,n,q -> QuestVP s (ComplSlash (SlashV2Q v q) n) ; --%
mkQCl : IP -> V2V -> NP -> VP -> QCl -- who forces her to walk
mkQCl : IP -> V2V -> NP -> VP -> QCl -- who forces her to sleep
= \s,v,n,q -> QuestVP s (ComplSlash (SlashV2V v q) n) ; --%
mkQCl : IP -> A -> QCl -- who is old
= \x,y -> QuestVP x (UseComp (CompAP (PositA y))) ; --%
@@ -1166,22 +1166,22 @@ incomplete resource Constructors = open Grammar in { --%
= \x,y -> QuestVP x (UseComp (CompCN y)) ; --%
mkQCl : IP -> Adv -> QCl -- who is here
= \x,y -> QuestVP x (UseComp (CompAdv y)) ; --%
mkQCl : IP -> NP -> V2 -> QCl -- who does John love
mkQCl : IP -> NP -> V2 -> QCl -- who does she love
= \ip,np,v -> QuestSlash ip (SlashVP np (SlashV2a v)) ; --%
mkQCl : IP -> ClSlash -> QCl -- who does John today --:
mkQCl : IP -> ClSlash -> QCl -- who does she today --:
= QuestSlash ; --%
-- Adverbial 'wh' questions are built with interrogative adverbials, with the
-- special case of prepositional phrases with interrogative pronouns.
mkQCl : IAdv -> Cl -> QCl -- why does John walk --:
mkQCl : IAdv -> Cl -> QCl -- why does she sleep --:
= QuestIAdv ; --%
mkQCl : Prep -> IP -> Cl -> QCl -- with whom does John walk
mkQCl : Prep -> IP -> Cl -> QCl -- with whom does she sleep
= \p,ip -> QuestIAdv (PrepIP p ip) ; --%
-- An interrogative adverbial can serve as the complement of a copula.
mkQCl : IAdv -> NP -> QCl -- where is John
mkQCl : IAdv -> NP -> QCl -- where is she
= \a -> QuestIComp (CompIAdv a) ; --%
-- Asking about a known subject.
@@ -1289,11 +1289,11 @@ incomplete resource Constructors = open Grammar in { --%
= \t,p -> TUseRCl t ASimul p ; --%
mkRS : Ant -> Pol -> RCl -> RS --%
= \a,p -> TUseRCl TPres a p ; --%
mkRS : (Tense) -> (Ant) -> (Pol) -> RCl -> RS -- that wouldn't have walked
mkRS : (Tense) -> (Ant) -> (Pol) -> RCl -> RS -- that wouldn't have slept
= TUseRCl ; --%
mkRS : Conj -> RS -> RS -> RS -- who walks and whose mother runsx
mkRS : Conj -> RS -> RS -> RS -- who sleeps and whose mother runsx
= \c,x,y -> ConjRS c (BaseRS x y) ; --%
mkRS : Conj -> ListRS -> RS -- who walks, whom I see and who sleeps --:
mkRS : Conj -> ListRS -> RS -- who sleeps, whom I see and who sleeps --:
= \c,xy -> ConjRS c xy ; --%
} ; --%
@@ -1307,17 +1307,17 @@ incomplete resource Constructors = open Grammar in { --%
-- The latter uses the 'slash' category of objectless clauses (see below);
-- we give the common special case with a two-place verb.
mkRCl : RP -> VP -> RCl -- that loves John --:
mkRCl : RP -> VP -> RCl -- that loves she --:
= RelVP ; --%
mkRCl : RP -> ClSlash -> RCl -- whom John loves today --:
mkRCl : RP -> ClSlash -> RCl -- whom she loves today --:
= RelSlash ; --%
mkRCl : RP -> NP -> V2 -> RCl -- whom John loves
mkRCl : RP -> NP -> V2 -> RCl -- whom she loves
= \rp,np,v2 -> RelSlash rp (SlashVP np (SlashV2a v2)) ; --%
-- There is a simple 'such that' construction for forming relative
-- clauses from clauses.
mkRCl : Cl -> RCl -- such that John loves her
mkRCl : Cl -> RCl -- such that she loves him
= RelCl ; --%
} ; --%
@@ -1361,7 +1361,7 @@ incomplete resource Constructors = open Grammar in { --%
-- The missing object can also be the noun phrase in a prepositional phrase.
mkClSlash : Cl -> Prep -> ClSlash -- (with whom) he walks --:
mkClSlash : Cl -> Prep -> ClSlash -- (with whom) he sleeps --:
= SlashPrep ; --%
-- An objectless sentence can be modified by an adverb.
@@ -1383,17 +1383,17 @@ incomplete resource Constructors = open Grammar in { --%
-- This is the deep level of many-argument predication, permitting extraction.
mkVPSlash : V2 -> VPSlash -- (whom) (John) loves --:
mkVPSlash : V2 -> VPSlash -- (whom) (she) loves --:
= SlashV2a ; --%
mkVPSlash : V3 -> NP -> VPSlash -- (whom) (John) gives an apple --:
mkVPSlash : V3 -> NP -> VPSlash -- (whom) (she) gives an apple --:
= Slash2V3 ; --%
mkVPSlash : V2A -> AP -> VPSlash -- (whom) (John) paints red --:
mkVPSlash : V2A -> AP -> VPSlash -- (whom) (she) paints red --:
= SlashV2A ; --%
mkVPSlash : V2Q -> QS -> VPSlash -- (whom) (John) asks who sleeps --:
mkVPSlash : V2Q -> QS -> VPSlash -- (whom) (she) asks who sleeps --:
= SlashV2Q ; --%
mkVPSlash : V2S -> S -> VPSlash -- (whom) (John) tells that we sleep --:
mkVPSlash : V2S -> S -> VPSlash -- (whom) (she) tells that we sleep --:
= SlashV2S ; --%
mkVPSlash : V2V -> VP -> VPSlash -- (whom) (John) forces to sleep --:
mkVPSlash : V2V -> VP -> VPSlash -- (whom) (she) forces to sleep --:
= SlashV2V ; --%
mkVPSlash : VV -> VPSlash -> VPSlash -- want always to buy --:
= SlashVV ; --%
@@ -1687,4 +1687,8 @@ oper
n1000_Numeral : Numeral
= num (pot3 (pot1as2 (pot0as1 pot01))) ; --%
-- for testing
she_NP : NP = mkNP she_Pron ;
}