From d67c87b7d8a462665acc4be579d045c4b584a516 Mon Sep 17 00:00:00 2001 From: aarne Date: Sat, 15 Nov 2008 20:08:09 +0000 Subject: [PATCH] Attempto complete up to spec --- examples/attempto/Attempto.gf | 6 +++--- examples/attempto/AttemptoI.gf | 11 +++++------ examples/attempto/LexAttempto.gf | 1 + examples/attempto/LexAttemptoEng.gf | 1 + examples/attempto/LexAttemptoFre.gf | 1 + examples/attempto/LexAttemptoGer.gf | 1 + examples/attempto/LexAttemptoSwe.gf | 1 + examples/attempto/Symbols.gf | 17 ++++++++++++++++- examples/attempto/SymbolsC.gf | 19 ++++++++++++++++++- next-lib/src/api/Constructors.gf | 7 +++++++ next-lib/src/english/MakeStructuralEng.gf | 2 ++ next-lib/src/french/MakeStructuralFre.gf | 3 +++ next-lib/src/german/MakeStructuralGer.gf | 2 ++ next-lib/src/swedish/MakeStructuralSwe.gf | 12 ++++++++++-- 14 files changed, 71 insertions(+), 13 deletions(-) diff --git a/examples/attempto/Attempto.gf b/examples/attempto/Attempto.gf index 744652775..e8e0f46b9 100644 --- a/examples/attempto/Attempto.gf +++ b/examples/attempto/Attempto.gf @@ -62,7 +62,6 @@ fun ten_Card : Card ; fun pnNP : PN -> NP ; fun intNP : Int -> NP ; -fun intNegNP : Int -> NP ; fun floatNP : Float -> NP ; @@ -112,7 +111,7 @@ fun unit_ofNP : Card -> Unit -> CN -> NP ; -- 3 kg of apples fun unit_ofMassNP : Card -> Unit -> MCN -> NP ; -- 3 l of water fun apposVarCN : CN -> Var -> CN ; -- a man X -fun varNP : Var -> NP ; +fun termNP : Term -> NP ; fun conjNP : NP -> NP -> NP ; @@ -189,7 +188,8 @@ fun modVP : VP -> Adv -> VP ; fun thereNP : NP -> S ; -- there is/are -- 3.3 --- Boolean formulas = \= < > <= >= + +fun formulaS : Formula -> S ; -- 3.4.1 diff --git a/examples/attempto/AttemptoI.gf b/examples/attempto/AttemptoI.gf index 1dbdc448d..bad6dd342 100644 --- a/examples/attempto/AttemptoI.gf +++ b/examples/attempto/AttemptoI.gf @@ -1,6 +1,7 @@ incomplete concrete AttemptoI of Attempto = SymbolsC ** open Syntax, Symbolic, + Prelude, LexAttempto in { @@ -64,7 +65,6 @@ lin ten_Card = mkCard n10_Numeral ; lin pnNP = mkNP ; lin intNP = symb ; lin floatNP = symb ; ---lin intNegNP : Int -> NP ; lin it_NP = mkNP it_Pron ; lin he_NP = mkNP he_Pron ; @@ -105,7 +105,7 @@ lin unit_ofMassNP ca u cn = mkNP (mkNP ca u) (mkAdv part_Prep (mkNP cn)) ; lin apposVarCN cn v = mkCN cn (symb v) ; -lin varNP x = symb x ; +lin termNP x = symb (ss x.s) ; -- 2.2.1 @@ -186,8 +186,8 @@ lin thereNP np = mkS (mkCl np) ; -- 3.3 --- Boolean formulas = \= < > <= >= +lin formulaS f = symb (ss f.s) ; -- 3.4.1 @@ -233,9 +233,8 @@ lin when_IAdv = Syntax.when_IAdv ; lin whoSg_IP = Syntax.whoSg_IP ; lin whoPl_IP = Syntax.whoPl_IP ; - ---lin there_ipQS : IP -> QS ; -- there is who ---lin whoseIP : CN -> IP ; -- whose dog +lin there_ipQS ip = mkQS (mkQCl ip) ; ---- who is there, not there is who +lin whoseIP = mkIP whose_IDet ; -- 3.6 diff --git a/examples/attempto/LexAttempto.gf b/examples/attempto/LexAttempto.gf index 7bfa593d3..3d18d3ca4 100644 --- a/examples/attempto/LexAttempto.gf +++ b/examples/attempto/LexAttempto.gf @@ -22,4 +22,5 @@ oper comma_and_Conj : Conj ; comma_or_Conj : Conj ; + whose_IDet : IDet ; } diff --git a/examples/attempto/LexAttemptoEng.gf b/examples/attempto/LexAttemptoEng.gf index 395e00c35..ad54d6de9 100644 --- a/examples/attempto/LexAttemptoEng.gf +++ b/examples/attempto/LexAttemptoEng.gf @@ -29,5 +29,6 @@ oper comma_or_Conj = M.mkConj [] ", or" singular ; slash_Conj = M.mkConj [] "/" singular ; + whose_IDet = M.mkIDet "whose" singular ; } diff --git a/examples/attempto/LexAttemptoFre.gf b/examples/attempto/LexAttemptoFre.gf index 91cd2eadf..b6f983c24 100644 --- a/examples/attempto/LexAttemptoFre.gf +++ b/examples/attempto/LexAttemptoFre.gf @@ -23,5 +23,6 @@ oper comma_or_Conj = mkConj [] ", ou" singular ; slash_Conj = mkConj [] "/" singular ; + whose_IDet = mkIDet (mkIQuant "de qui") ; ---- } diff --git a/examples/attempto/LexAttemptoGer.gf b/examples/attempto/LexAttemptoGer.gf index 38bc4935d..05a4e59ff 100644 --- a/examples/attempto/LexAttemptoGer.gf +++ b/examples/attempto/LexAttemptoGer.gf @@ -23,5 +23,6 @@ oper comma_or_Conj = mkConj [] ", oder" singular ; slash_Conj = mkConj [] "/" singular ; + whose_IDet = mkIDet (mkIQuant "wessen") ; } diff --git a/examples/attempto/LexAttemptoSwe.gf b/examples/attempto/LexAttemptoSwe.gf index 31d145f19..c95ce035e 100644 --- a/examples/attempto/LexAttemptoSwe.gf +++ b/examples/attempto/LexAttemptoSwe.gf @@ -21,6 +21,7 @@ oper comma_and_Conj = mkConj [] ", och" plural ; comma_or_Conj = mkConj [] ", eller" singular ; slash_Conj = mkConj [] "/" singular ; + whose_IDet = mkIDet (mkIQuant "vems" "vems" "vems" dDefIndef) ; } diff --git a/examples/attempto/Symbols.gf b/examples/attempto/Symbols.gf index 3744ecd4a..3f92d3b21 100644 --- a/examples/attempto/Symbols.gf +++ b/examples/attempto/Symbols.gf @@ -1,6 +1,21 @@ abstract Symbols = { -cat Var ; +cat Var ; Formula ; Term ; + +fun plus_Term : Term -> Term -> Term ; +fun minus_Term : Term -> Term -> Term ; +fun div_Term : Term -> Term -> Term ; +fun times_Term : Term -> Term -> Term ; +fun neg_Term : Term -> Term ; +fun int_Term : Int -> Term ; +fun var_Term : Var -> Term ; + +fun eq_Formula : Term -> Term -> Formula ; +fun lt_Formula : Term -> Term -> Formula ; +fun gt_Formula : Term -> Term -> Formula ; +fun le_Formula : Term -> Term -> Formula ; +fun ge_Formula : Term -> Term -> Formula ; +fun ne_Formula : Term -> Term -> Formula ; fun X_Var : Var ; fun Y_Var : Var ; diff --git a/examples/attempto/SymbolsC.gf b/examples/attempto/SymbolsC.gf index 9949912ca..b92885bb9 100644 --- a/examples/attempto/SymbolsC.gf +++ b/examples/attempto/SymbolsC.gf @@ -1,7 +1,24 @@ -concrete SymbolsC of Symbols = open Prelude in { +concrete SymbolsC of Symbols = open Precedence, Prelude in { +lincat Term = TermWithPrec ; +lincat Formula = SS ; lincat Var = SS ; +lin plus_Term = mkpInfixL "+" p1 ; +lin minus_Term = mkpInfixL "-" p1 ; +lin div_Term = mkpInfixL "/" p2 ; +lin times_Term = mkpInfixL "*" p2 ; +lin neg_Term = mkpFun1 "-" ; +lin int_Term i = mkpConst i.s ; +lin var_Term i = mkpConst i.s ; + +lin eq_Formula = infixSS "=" ; +lin lt_Formula = infixSS "<" ; +lin gt_Formula = infixSS ">" ; +lin le_Formula = infixSS "=<" ; +lin ge_Formula = infixSS ">=" ; +lin ne_Formula = infixSS "\\=" ; + lin X_Var = ss "X" ; lin Y_Var = ss "Y" ; diff --git a/next-lib/src/api/Constructors.gf b/next-lib/src/api/Constructors.gf index 305c30c6d..2c93f6769 100644 --- a/next-lib/src/api/Constructors.gf +++ b/next-lib/src/api/Constructors.gf @@ -1378,6 +1378,13 @@ incomplete resource Constructors = open Grammar in { = AdvIP } ; + mkIDet = overload { + mkIDet : IQuant -> Num -> IDet -- which (songs) + = \i,nu -> IdetQuant i nu ; + mkIDet : IQuant -> IDet -- which (song) + = \i -> IdetQuant i NumSg ; + } ; + whichSg_IDet : IDet = IdetQuant which_IQuant NumSg ; whichPl_IDet : IDet = IdetQuant which_IQuant NumPl ; diff --git a/next-lib/src/english/MakeStructuralEng.gf b/next-lib/src/english/MakeStructuralEng.gf index 7871cb3c6..eeaee1dcf 100644 --- a/next-lib/src/english/MakeStructuralEng.gf +++ b/next-lib/src/english/MakeStructuralEng.gf @@ -9,5 +9,7 @@ oper {s = x ; lock_Subj = <>} ; mkNP : Str -> Number -> NP = \s,n -> regNP s n ** {lock_NP = <>} ; + mkIDet : Str -> Number -> IDet = \s,n -> + {s = s ; n = n ; lock_IDet = <>} ; } diff --git a/next-lib/src/french/MakeStructuralFre.gf b/next-lib/src/french/MakeStructuralFre.gf index 282e1c3e7..5aa94dcfe 100644 --- a/next-lib/src/french/MakeStructuralFre.gf +++ b/next-lib/src/french/MakeStructuralFre.gf @@ -10,4 +10,7 @@ oper mkSubjSubj : Str -> Subj = \x -> {s = x ; m = Conjunct ; lock_Subj = <>} ; + mkIQuant : Str -> IQuant = \s -> + {s = \\_,_,c => prepCase c ++ s ; lock_IQuant = <>} ; + } diff --git a/next-lib/src/german/MakeStructuralGer.gf b/next-lib/src/german/MakeStructuralGer.gf index 8f5006df9..1a26e59cd 100644 --- a/next-lib/src/german/MakeStructuralGer.gf +++ b/next-lib/src/german/MakeStructuralGer.gf @@ -7,5 +7,7 @@ oper {s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ; mkSubj : Str -> Subj = \x -> {s = x ; lock_Subj = <>} ; + mkIQuant : Str -> IQuant = \s -> + {s = \\_,_,_ => s ; lock_IQuant = <>} ; } diff --git a/next-lib/src/swedish/MakeStructuralSwe.gf b/next-lib/src/swedish/MakeStructuralSwe.gf index 48d0a1225..1da7840df 100644 --- a/next-lib/src/swedish/MakeStructuralSwe.gf +++ b/next-lib/src/swedish/MakeStructuralSwe.gf @@ -1,11 +1,19 @@ --# -path=.:../scandinavian:../common:../abstract -resource MakeStructuralSwe = open CatSwe, ParadigmsSwe, MorphoSwe, Prelude in { +resource MakeStructuralSwe = open CatSwe, ParadigmsSwe, + (P=ParadigmsSwe), MorphoSwe, Prelude in { oper - mkConj : Str -> Str -> Number -> Conj = \x,y,n -> + mkConj : Str -> Str -> P.Number -> Conj = \x,y,n -> {s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ; mkSubj : Str -> Subj = \x -> {s = x ; lock_Subj = <>} ; + mkIQuant : Str -> Str -> Str -> DetSpecies -> IQuant = \vilken,vilket,vilka,d -> + {s = table (P.Number) + [table (P.Gender) [vilken;vilket] ; table (P.Gender) [vilka;vilka]] ; + det = d ; lock_IQuant = <>} ; + + dDefIndef : DetSpecies = DDef Indef ; + ---- other DetSpecies }