# Constructors: the High-Level Syntax API

Last update: 2007-05-09 17:52:28 CEST

- Texts, phrases, and utterances
- Sentences, and clauses
- Verb phrases and imperatives
- Noun phrases and determiners
- Numerals - cardinal and ordinal
- Common nouns
- Adjectival phrases
- Adverbs
- Questions and interrogative pronouns
- Relative clauses and relative pronouns
- Objectless sentences and sentence complements

Produced by gfdoc - a rudimentary GF document generator. (c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.

This module gives access to (almost) all functions in the resource syntax API defined in Grammar. It uses overloaded function names to reduce the burden of remembering different names.

The principle is simply: to construct an object of type `C`, use the function `mkC`.

For example, to the object

`PredVP (UsePron she_Pron) (ComplV2 love_V2 (UsePN paris_PN))`

can now also be written

`mkCl (mkNP she_Pron) (mkVP love_V2 (mkNP paris_PN))`

In addition to exact variants of the `Grammar` functions, the module gives some common special cases using deeper terms and default arguments. An example of deeper terms is two-place coordination such as

`mkNP : Conj -> NP -> NP -> NP`.

An example of default arguments is present-tense sentences,

`mkS : Cl -> S`.

The old API can of course be used simultaneously with this one. Typically, `Grammar` and `Paradigms` are needed to be `open`ed in addition to this.

        incomplete resource Constructors = open Grammar in {

          oper

## Texts, phrases, and utterances

            mkText : overload {
              mkText : Text               ;   -- [empty text]
              mkText : Phr -> Text        ;   -- John walks.
              mkText : Utt -> Text        ;   -- John walks.
              mkText : S -> Text          ;   -- John walks.
              mkText : Cl -> Text         ;   -- John walks.
              mkText : QS -> Text         ;   -- Does John walk?
              mkText : Imp -> Text        ;   -- Walk!
              mkText : Pol -> Imp -> Text ;   -- Don't walk!
              mkText : Phr -> Text -> Text    -- John walks. ...
              } ;

            mkPhr : overload {
              mkPhr : PConj -> Utt -> Voc -> Phr;   -- But go home my friend
              mkPhr : Utt -> Phr                ;   -- Go home
              mkPhr : S -> Phr                      -- I go home
              } ;

            mkUtt : overload {
              mkUtt : S -> Utt                  ;   -- John walked
              mkUtt : Cl -> Utt                 ;   -- John walks
              mkUtt : QS -> Utt                 ;   -- is it good
              mkUtt : Pol -> Imp -> Utt         ;   -- (don't) help yourself
              mkUtt : Imp -> Utt                ;   -- help yourself
              mkUtt : IP   -> Utt               ;   -- who
              mkUtt : IAdv -> Utt               ;   -- why
              mkUtt : NP   -> Utt               ;   -- this man
              mkUtt : Adv  -> Utt               ;   -- here
              mkUtt : VP   -> Utt                   -- to sleep
              } ;

## Sentences, and clauses

            mkS : overload {
              mkS : Cl -> S ;                        -- John walks
              mkS : Tense -> Cl -> S ;               -- John walked
              mkS : Ant -> Cl -> S ;                 -- John has walked
              mkS : Pol -> Cl -> S ;                 -- John doesn't walk
              mkS : Tense -> Ant -> Cl -> S ;        -- John had walked
              mkS : Tense -> Pol -> Cl -> S ;        -- John didn't walk
              mkS : Ant -> Pol -> Cl -> S ;          -- John hasn't walked
              mkS : Tense -> Ant -> Pol -> Cl -> S ; -- John wouldn't have walked
              mkS : Conj -> S -> S -> S ;            -- John walks and Mary talks
              mkS : DConj -> S -> S -> S ;           -- either I leave or you come
              mkS : Conj -> ListS -> S ;             -- John walks, Mary talks, and Bob runs
              mkS : DConj -> ListS -> S ;            -- either I leave, you come, or he runs
              mkS : Adv -> S -> S                    -- today, I will sleep
              } ;

            mkCl : overload {
              mkCl : NP -> VP -> Cl   ;   -- John wants to walk
              mkCl : NP -> V -> Cl    ;   -- John walks
              mkCl : NP -> V2 -> NP -> Cl ; -- John uses it
              mkCl : VP -> Cl         ;   -- it rains
              mkCl : NP  -> RS -> Cl  ;   -- it is you who did it
              mkCl : Adv -> S  -> Cl  ;   -- it is yesterday she arrived
              mkCl : NP -> Cl         ;   -- there is a house
              mkCl : NP -> AP -> Cl   ;   -- John is nice and warm
              mkCl : NP -> A  -> Cl   ;   -- John is warm
              mkCl : NP -> A -> NP -> Cl; -- John is warmer than Mary
              mkCl : NP -> A2 -> NP -> Cl; -- John is married to Mary
              mkCl : NP -> NP -> Cl   ;   -- John is a man
              mkCl : NP -> Adv -> Cl      -- John is here
              } ;

## Verb phrases and imperatives

            mkVP : overload {
              mkVP : V   -> VP            ;   -- sleep
              mkVP : V2  -> NP -> VP      ;   -- use it
              mkVP : V3  -> NP -> NP -> VP ;  -- send a message to her
              mkVP : VV  -> VP -> VP      ;   -- want to run
              mkVP : VS  -> S  -> VP      ;   -- know that she runs
              mkVP : VQ  -> QS -> VP      ;   -- ask if she runs
              mkVP : VA  -> AP -> VP      ;   -- look red
              mkVP : V2A -> NP -> AP -> VP ;  -- paint the house red
              mkVP : AP -> VP             ;   -- be warm
              mkVP : NP -> VP             ;   -- be a man
              mkVP : Adv -> VP            ;   -- be here
              mkVP : VP -> Adv -> VP      ;   -- sleep here
              mkVP : AdV -> VP -> VP          -- always sleep
              } ;

            mkImp : overload {
              mkImp : VP -> Imp              ;   -- go there now
              mkImp : V  -> Imp              ;   -- go
              mkImp : V2 -> NP -> Imp            -- take it
              } ;

## Noun phrases and determiners

            mkNP : overload {
              mkNP : Det -> CN -> NP  ;        -- the old man
              mkNP : Det -> N -> NP   ;        -- the man
              mkNP : Num -> CN -> NP  ;        -- forty-five old men
              mkNP : Num -> N -> NP   ;        -- forty-five men
              mkNP : Int -> CN -> NP  ;        -- 51 old men
              mkNP : Int -> N -> NP   ;        -- 51 men
              mkNP : Digit -> CN -> NP;        -- five old men
              mkNP : Digit -> N -> NP ;        -- five men
              mkNP : PN -> NP         ;        -- John
              mkNP : Pron -> NP       ;        -- he
              mkNP : Predet -> NP -> NP ;      -- all the men
              mkNP : NP -> V2  -> NP  ;        -- the number squared
              mkNP : NP -> Adv -> NP  ;        -- Paris at midnight
              mkNP : Conj -> NP -> NP -> NP ;  -- John and Mary walk
              mkNP : DConj -> NP -> NP -> NP ; -- both John and Mary walk
              mkNP : Conj -> ListNP -> NP ;    -- John, Mary, and Bill walk
              mkNP : DConj -> ListNP -> NP     -- both John, Mary, and Bill walk

              } ;

            mkDet : overload {
              mkDet : QuantSg -> Ord -> Det        ;   -- this best (man)
              mkDet : Det                          ;   -- the (man)
              mkDet : QuantSg ->  Det              ;   -- this (man)
              mkDet : QuantPl -> Num -> Ord -> Det ;   -- these five best (men)
              mkDet : QuantPl -> Det               ;   -- these (men)
              mkDet : Quant ->  Det                ;   -- this (man)
              mkDet : Num -> Det                   ;   -- forty-five (men)
              mkDet : Int -> Det                   ;   -- 51 (men)
              mkDet : Digit -> Det                 ;   -- five (men)
              mkDet : Pron -> Det                      -- my (house)
              } ;

           def_Det : Det ;   -- the (man)
           indef_Det : Det ; -- a (man)
           mass_Det : Det ;  -- (water)

More determiners are available in the Structural module

## Numerals - cardinal and ordinal

            mkNum : overload {
              mkNum : Num            ;   -- [no num]
              mkNum : Int -> Num     ;   -- 51
              mkNum : Digit -> Num
              } ;

            mkOrd : overload {
              mkOrd : Ord            ;   -- [no ord]
              mkOrd : Int -> Ord     ;   -- 51st
              mkOrd : Digit -> Ord   ;   -- fifth
              mkOrd : A -> Ord           -- largest
              } ;

## Common nouns

            mkCN : overload {
              mkCN : N  -> CN               ;   -- house
              mkCN : N2 -> NP -> CN         ;   -- son of the king
              mkCN : N3 -> NP -> NP -> CN   ;   -- flight from Moscow (to Paris)
              mkCN : N2 -> CN               ;   -- son
              mkCN : N3 -> CN               ;   -- flight
              mkCN : AP -> CN  -> CN        ;   -- nice and big blue house
              mkCN : AP ->  N  -> CN        ;   -- nice and big house
              mkCN : CN -> AP  -> CN        ;   -- nice and big blue house
              mkCN :  N -> AP  -> CN        ;   -- nice and big house
              mkCN :  A -> CN  -> CN        ;   -- big blue house
              mkCN :  A ->  N  -> CN        ;   -- big house
              mkCN : CN -> RS  -> CN        ;   -- house that John owns
              mkCN :  N -> RS  -> CN        ;   -- house that John owns
              mkCN : CN -> Adv -> CN        ;   -- house on the hill
              mkCN :  N -> Adv -> CN        ;   -- house on the hill
              mkCN : CN -> SC  -> CN        ;   -- fact that John smokes, question if he does
              mkCN :  N -> SC  -> CN        ;   -- fact that John smokes, question if he does
              mkCN : CN -> NP  -> CN        ;   -- number x, numbers x and y
              mkCN :  N -> NP  -> CN            -- number x, numbers x and y
              } ;

## Adjectival phrases

            mkAP : overload {
              mkAP : A -> AP        ;         -- warm
              mkAP : A -> NP -> AP  ;         -- warmer than Spain
              mkAP : A2 -> NP -> AP ;         -- divisible by 2
              mkAP : A2 -> AP       ;         -- divisible by itself
              mkAP : AP -> SC -> AP ;         -- great that she won; uncertain if she did
              mkAP : AdA -> AP -> AP ;        -- very uncertain
              mkAP : Conj -> AP -> AP -> AP ; -- warm and nice
              mkAP : DConj -> AP -> AP -> AP ;-- both warm and nice
              mkAP : Conj -> ListAP -> AP ;   -- warm, nice, and cheap
              mkAP : DConj -> ListAP -> AP    -- both warm, nice, and cheap

              } ;

## Adverbs

            mkAdv : overload {
              mkAdv : A -> Adv               ;    -- quickly
              mkAdv : Prep -> NP -> Adv      ;    -- in the house
              mkAdv : CAdv -> A -> NP -> Adv ;    -- more quickly than John
              mkAdv : CAdv -> A -> S -> Adv  ;    -- more quickly than he runs
              mkAdv : AdA -> Adv -> Adv      ;    -- very quickly
              mkAdv : Subj -> S -> Adv       ;    -- when he arrives
              mkAdv : Conj -> Adv -> Adv -> Adv;  -- here and now
              mkAdv : DConj -> Adv -> Adv -> Adv; -- both here and now
              mkAdv : Conj -> ListAdv -> Adv ;    -- here, now, and with you
              mkAdv : DConj -> ListAdv -> Adv     -- both here, now, and with you
              } ;

## Questions and interrogative pronouns

            mkQS : overload {
              mkQS : Tense -> Ant -> Pol -> QCl -> QS ; -- wouldn't John have walked
              mkQS : QCl  -> QS                       ; -- who walks
              mkQS : Cl   -> QS                         -- does John walk
              } ;

            mkQCl : overload {
              mkQCl : Cl -> QCl                ;   -- does John walk
              mkQCl : IP -> VP -> QCl          ;   -- who walks
              mkQCl : IP -> Slash -> QCl       ;   -- who does John love
              mkQCl : IP -> NP -> V2 -> QCl    ;   -- who does John love
              mkQCl : IAdv -> Cl -> QCl        ;   -- why does John walk
              mkQCl : Prep -> IP -> Cl -> QCl  ;   -- with whom does John walk
              mkQCl : IAdv -> NP -> QCl        ;   -- where is John
              mkQCl : IP -> QCl                    -- which houses are there
              } ;

            mkIP : overload {
              mkIP : IDet -> Num -> Ord -> CN -> IP ; -- which five best songs
              mkIP : IDet -> N -> IP              ;   -- which song
              mkIP : IP -> Adv -> IP                  -- who in Europe
              } ;

## Relative clauses and relative pronouns

            mkRS : overload {
              mkRS : Tense -> Ant -> Pol -> RCl -> RS ; -- who wouldn't have walked
              mkRS : RCl  -> RS                         -- who walks
              } ;

            mkRCl : overload {
              mkRCl : Cl -> RCl          ;   -- such that John loves her
              mkRCl : RP -> VP -> RCl    ;   -- who loves John
              mkRCl : RP -> Slash -> RCl     -- whom John loves
              } ;

            mkRP : overload {
              mkRP : RP                    ;   -- which
              mkRP : Prep -> NP -> RP -> RP    -- all the roots of which
              } ;

## Objectless sentences and sentence complements

            mkSlash : overload {
              mkSlash : NP -> V2 -> Slash    ;    -- (whom) he sees
              mkSlash : NP -> VV -> V2 -> Slash ; -- (whom) he wants to see
              mkSlash : Slash -> Adv -> Slash ;   -- (whom) he sees tomorrow
              mkSlash : Cl -> Prep -> Slash       -- (with whom) he walks
              } ;

            mkSC : overload {
              mkSC : S  -> SC             ;   -- that you go
              mkSC : QS -> SC             ;   -- whether you go
              mkSC : VP -> SC                 -- to go
              } ;