diff --git a/doc/gf-history.html b/doc/gf-history.html index ed0669a1b..3ff42affd 100644 --- a/doc/gf-history.html +++ b/doc/gf-history.html @@ -11,6 +11,22 @@ Changes in functionality since May 17, 2005, release of GF Version 2.2 + +
+ +6/12 (AR) Accept param and oper definitions in +concrete modules. The definitions are just inlined in the +current module and not inherited. The purpose is to support rapid +prototyping of grammars. + +
+ +2/12 (AR) The built-in type Float added to abstract syntax (and +resource). Values are stored as Haskell's Double precision +floats. For the syntax of float literals, see BNFC document. +NB: some bug still prevents parsing float literals in object +languages. +
1/12 (BB,AR) The command at = apply_transfer, which applies diff --git a/lib/resource-1.0/scandinavian/CatScand.gf b/lib/resource-1.0/scandinavian/CatScand.gf index 3e9cb694f..faa210d79 100644 --- a/lib/resource-1.0/scandinavian/CatScand.gf +++ b/lib/resource-1.0/scandinavian/CatScand.gf @@ -47,7 +47,7 @@ incomplete concrete CatScand of Cat = -- Constructed in $Noun$. - Det, Quant = {s : Gender => Str ; n : Number ; det : DetSpecies } ; + Det, Quant = {s : Gender => Str ; n : Number ; det : DetSpecies} ; Predet = {s : GenNum => Str} ; Num = {s : Gender => Str} ; Ord = {s : Str} ; @@ -60,8 +60,8 @@ incomplete concrete CatScand of Cat = N2 = Noun ** {c2 : Str} ; N3 = Noun ** {c2,c3 : Str} ; - IP = NP ; - IDet = Det ; + IP = {s : NPForm => Str ; gn : GenNum} ; + IDet = {s : Gender => Str ; n : Number ; det : DetSpecies} ; IAdv = {s : Str} ; RP = {s : RCase => Str ; a : RAgr} ; diff --git a/lib/resource-1.0/scandinavian/DiffScand.gf b/lib/resource-1.0/scandinavian/DiffScand.gf index ba0eecec8..ebf99e499 100644 --- a/lib/resource-1.0/scandinavian/DiffScand.gf +++ b/lib/resource-1.0/scandinavian/DiffScand.gf @@ -5,6 +5,8 @@ interface DiffScand = open ResScand, Prelude in { param Gender ; + CardOrd = NCard Gender | NOrd AFormSup ; -- sic! (AFormSup) + oper neutrum, utrum : Gender ; @@ -28,6 +30,7 @@ interface DiffScand = open ResScand, Prelude in { artIndef : Gender => Str ; verbHave : {s : VForm => Str} ; + verbBe : {s : VForm => Str} ; auxFut : Str ; auxCond : Str ; @@ -72,4 +75,8 @@ interface DiffScand = open ResScand, Prelude in { en2,ea2,eext : Bool = False -- indicate if the field exists } ; +-- For determiners; mostly two-valued even in Norwegian. + + genderForms : (x1,x2 : Str) -> Gender => Str ; + } diff --git a/lib/resource-1.0/scandinavian/NounScand.gf b/lib/resource-1.0/scandinavian/NounScand.gf index a7a316486..93a2026f5 100644 --- a/lib/resource-1.0/scandinavian/NounScand.gf +++ b/lib/resource-1.0/scandinavian/NounScand.gf @@ -36,8 +36,8 @@ incomplete concrete NounScand of Noun = NoOrd = {s = []} ; NumInt n = {s = \\_ => n.s} ; ----- NumNumeral numeral = {s = \\g => numeral.s ! NCard g} ; - OrdNumeral numeral = {s = numeral.s ! NOrd} ; + NumNumeral numeral = {s = \\g => numeral.s ! NCard g} ; + OrdNumeral numeral = {s = numeral.s ! NOrd SupWeak} ; AdNum adn num = {s = \\g => adn.s ++ num.s ! g} ; @@ -49,8 +49,17 @@ incomplete concrete NounScand of Noun = IndefSg = {s = artIndef ; n = Sg ; det = DIndef} ; IndefPl = {s = \\_ => [] ; n = Pl ; det = DIndef} ; ----- ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ; ----- ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ; +-- The genitive of this $NP$ is not correct: "sonen till mig" (not "migs"). + + ComplN2 f x = { + s = \\n,d,c => f.s ! n ! specDet d ! Nom ++ f.c2 ++ x.s ! accusative ; + g = f.g + } ; + ComplN3 f x = { + s = \\n,d,c => f.s ! n ! d ! Nom ++ f.c2 ++ x.s ! accusative ; + g = f.g ; + c2 = f.c3 + } ; AdjCN ap cn = let g = cn.g in { s = \\n,d,c => preOrPost ap.isPre diff --git a/lib/resource-1.0/scandinavian/ParamScand.gf b/lib/resource-1.0/scandinavian/ParamScand.gf index 0a27c94e1..12c7adc41 100644 --- a/lib/resource-1.0/scandinavian/ParamScand.gf +++ b/lib/resource-1.0/scandinavian/ParamScand.gf @@ -46,8 +46,6 @@ param --- AdjPronForm = APron GenNum Case ; --- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ; - CardOrd = NCard | NOrd ; - RCase = RNom | RAcc | RGen | RPrep ; RAgr = RNoAg | RAg {gn : GenNum ; p : Person} ; diff --git a/lib/resource-1.0/scandinavian/ResScand.gf b/lib/resource-1.0/scandinavian/ResScand.gf index 6df96ef32..27fd2f212 100644 --- a/lib/resource-1.0/scandinavian/ResScand.gf +++ b/lib/resource-1.0/scandinavian/ResScand.gf @@ -162,13 +162,28 @@ resource ResScand = ParamScand ** open Prelude in { eext = vp.eext } ; ------ This is not functional. --- --- insertAdV : Str -> VP -> VP = \adv,vp -> { --- s = vp.s ; --- s2 = vp.s2 --- } ; --- + insertAdv : Str -> VP -> VP = \adv,vp -> { + s = vp.s ; + a1 = vp.a1 ; + n2 = vp.n2 ; + a2 = vp.a2 ++ adv ; + ext = vp.ext ; + en2 = vp.en2 ; + ea2 = True ; + eext = vp.eext + } ; + + insertAdV : Str -> VP -> VP = \adv,vp -> { + s = vp.s ; + a1 = \\b => vp.a1 ! b ++ adv ; + n2 = vp.n2 ; + a2 = vp.a2 ; + ext = vp.ext ; + en2 = vp.en2 ; + ea2 = vp.ea2 ; + eext = vp.eext + } ; + -- presVerb : {s : VForm => Str} -> Agr -> Str = \verb -> -- agrVerb (verb.s ! VPres) (verb.s ! VInf) ; diff --git a/lib/resource-1.0/scandinavian/VerbScand.gf b/lib/resource-1.0/scandinavian/VerbScand.gf index 0fa9b6bda..c122bb837 100644 --- a/lib/resource-1.0/scandinavian/VerbScand.gf +++ b/lib/resource-1.0/scandinavian/VerbScand.gf @@ -11,29 +11,34 @@ incomplete concrete VerbScand of Verb = CatScand ** open DiffScand, ResScand in ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ; ComplVS v s = insertObj (\\_ => conjThat ++ s.s ! Sub) (predV v) ; ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ; -{- - ComplVA v ap = insertObj (ap.s) (predV v) ; + + ComplVA v ap = + insertObj (\\a => ap.s ! agrAdj a.gn DIndef) (predV v) ; ComplV2A v np ap = - insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ; + insertAdv + (ap.s ! agrAdj np.a.gn DIndef) + (insertObj (\\_ => v.c2 ++ np.s ! accusative) (predV v)) ; - UseComp comp = insertObj comp.s (predAux auxBe) ; + UseComp comp = insertObj (\\a => comp.s ! agrAdj a.gn DIndef) (predV verbBe) ; - AdvVP vp adv = insertObj (\\_ => adv.s) vp ; - AdVVP adv vp = insertAdV adv.s vp ; + CompAP ap = ap ; + CompNP np = {s = \\_ => np.s ! accusative} ; + CompAdv a = {s = \\_ => a.s} ; +--- these give parser overflow +--- AdvVP vp adv = insertAdv adv.s vp ; +--- AdVVP adv vp = insertAdV adv.s vp ; + +{- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; PassV2 v = {s = \\_ => v.s ! VPPart} ; +-} UseVV, UseVS, UseVQ = \vv -> {s = vv.s ; c2 = []} ; - CompAP ap = ap ; - CompNP np = {s = \\_ => np.s ! Acc} ; - CompAdv a = {s = \\_ => a.s} ; - - EmbedS s = {s = conjThat ++ s.s} ; + EmbedS s = {s = conjThat ++ s.s ! Sub} ; EmbedQS qs = {s = qs.s ! QIndir} ; - EmbedVP vp = {s = infVP vp (agrP3 Sg)} ; --- agr --} + EmbedVP vp = {s = infVP vp (agrP3 utrum Sg)} ; --- agr } diff --git a/lib/resource-1.0/swedish/DiffSwe.gf b/lib/resource-1.0/swedish/DiffSwe.gf index 0e1a688bf..2e2e79d6e 100644 --- a/lib/resource-1.0/swedish/DiffSwe.gf +++ b/lib/resource-1.0/swedish/DiffSwe.gf @@ -31,6 +31,8 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in { verbHave = mkVerb "ha" "har" "ha" "hade" "haft" "havd" "havt" "havda" ; + verbBe = + mkVerb "vara" "är" "var" "var" "varit" "varen" "varet" "varna" ; auxFut = "ska" ; -- "skall" in ExtSwe auxCond = "skulle" ; @@ -39,4 +41,11 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in { Pos => [] ; Neg => "inte" } ; + + genderForms : (x1,x2 : Str) -> Gender => Str = \all,allt -> + table { + Utr => all ; + Neutr => allt + } ; + } diff --git a/lib/resource-1.0/swedish/LexSwe.gf b/lib/resource-1.0/swedish/LexSwe.gf index 14ead07e4..bc544d4c5 100644 --- a/lib/resource-1.0/swedish/LexSwe.gf +++ b/lib/resource-1.0/swedish/LexSwe.gf @@ -25,7 +25,7 @@ concrete LexSwe of Lex = CatSwe ** open ResSwe, Prelude in { mkAdjective "varm" "varmt" "varma" "varma" "varmare" "varmast" "varmaste" ; close_A2 = mkAdjective "nära" "nära" "nära" "nära" "närmare" "närmast" "närmaste" - ** {c2 = "to"} ; + ** {c2 = "till"} ; here_Adv = {s = "här"} ; very_AdA = {s = "mycket"} ; @@ -33,25 +33,39 @@ concrete LexSwe of Lex = CatSwe ** open ResSwe, Prelude in { only_Predet = {s = \\_ => "bara"} ; all_Predet = {s = gennumForms "all" "allt" "alla"} ; --- this_Quant = {s = "this" ; n = Sg} ; --- these_Quant = {s = "these" ; n = Pl} ; --- + this_Quant = {s = genderForms "denna" "detta" ; n = Sg ; det = DDef Indef} ; + these_Quant = {s = \\_ => "dessa" ; n = Pl ; det = DDef Indef} ; + i_Pron = mkNP "jag" "mig" "min" "mitt" "mina" SgUtr P1 ; he_Pron = mkNP "han" "honom" "hans" "hans" "hans" SgUtr P3 ; we_Pron = mkNP "vi" "oss" "vår" "vårt" "våra" SgUtr P1 ; --- --- whoSg_IP = mkIP "who" "whom" "whose" Sg ; --- whoPl_IP = mkIP "who" "whom" "whose" Pl ; --- + + whoSg_IP = {s = vem.s ; gn = SgUtr} ; + whoPl_IP = {s = vem.s ; gn = Plg} ; + when_IAdv = {s = "när"} ; where_IAdv = {s = "var"} ; why_IAdv = {s = "varför"} ; --- --- whichSg_IDet = {s = "which" ; n = Sg} ; --- whichPl_IDet = {s = "which" ; n = Pl} ; --- --- one_Numeral = {s = table {NCard => "one" ; NOrd => "first"} ; n = Sg} ; --- forty_Numeral = {s = table {NCard => "forty" ; NOrd => "fortieth"} ; n = Pl} ; + + whichSg_IDet = {s = genderForms "vilken" "vilket" ; n = Sg ; det = DDef Indef} ; + whichPl_IDet = {s = \\_ => "vilka" ; n = Pl ; det = DDef Indef} ; + + one_Numeral = { + s = table { + NCard Utr => "en" ; + NCard Neutr => "ett" ; + NOrd SupStrong => "först" ; + NOrd SupWeak => "första" + } ; + n = Sg + } ; + forty_Numeral = { + s = table { + NCard _ => "fyrtio" ; + NOrd _ => "fyrtionde" + } ; + n = Sg + } ; in_Prep = {s = "i"} ; of_Prep = {s = "av"} ; @@ -69,4 +83,9 @@ concrete LexSwe of Lex = CatSwe ** open ResSwe, Prelude in { more_CAdv = ss "mera" ; less_CAdv = ss "mindre" ; +-- Auxiliaries that are used repeatedly. + + oper + vem = mkNP "vem" "vem" "vems" "vems" "vems" SgUtr P3 ; + } diff --git a/lib/resource-1.0/swedish/swedish.gfnoparse b/lib/resource-1.0/swedish/swedish.gfnoparse new file mode 100644 index 000000000..27976a5b0 --- /dev/null +++ b/lib/resource-1.0/swedish/swedish.gfnoparse @@ -0,0 +1 @@ +--# noparse AdvVP AdVVP