From 1910010e707bc14906a168f32323fc88fc83efaf Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 5 May 2026 11:05:50 +0200 Subject: [PATCH] sketch of the grammar generated with Codex --- src/faroese/AdjectiveFao.gf | 5 +++- src/faroese/CatFao.gf | 12 ++++++++- src/faroese/GrammarFao.gf | 3 +++ src/faroese/LexiconFao.gf | 11 +++++++-- src/faroese/NounFao.gf | 49 ++++++++++++++++++++++++++++++++++++- src/faroese/ParadigmsFao.gf | 4 +-- src/faroese/PhraseFao.gf | 4 ++- src/faroese/RelativeFao.gf | 7 ++++++ src/faroese/ResFao.gf | 47 ++++++++++++++++++++++++++++++++--- src/faroese/SentenceFao.gf | 31 +++++++++++++++++++++++ 10 files changed, 161 insertions(+), 12 deletions(-) create mode 100644 src/faroese/RelativeFao.gf create mode 100644 src/faroese/SentenceFao.gf diff --git a/src/faroese/AdjectiveFao.gf b/src/faroese/AdjectiveFao.gf index 40d87ff0..0ff3ebbb 100644 --- a/src/faroese/AdjectiveFao.gf +++ b/src/faroese/AdjectiveFao.gf @@ -1,4 +1,7 @@ -concrete AdjectiveFao of Adjective = CatFao ** { +concrete AdjectiveFao of Adjective = CatFao ** open ResFao in { lin PositA a = a ; + ComparA a np = { + s = \\g,n,c => "meir" ++ a.s ! g ! n ! c ++ "enn" ++ np.s ! Nom + } ; } diff --git a/src/faroese/CatFao.gf b/src/faroese/CatFao.gf index 63de07dd..9396855e 100644 --- a/src/faroese/CatFao.gf +++ b/src/faroese/CatFao.gf @@ -9,10 +9,20 @@ lincat V = Verb ; lincat VV,VS,VQ,VA = Verb ; lincat V2 = Verb ** {c2 : Compl} ; lincat V3,V2A,V2S,V2Q,V2V = Verb ** {c2,c3 : Compl} ; +lincat VP = VerbPhrase ; +lincat VPSlash = Verb ** {c2 : Compl} ; +lincat Comp = {s : Gender => Number => Str} ; +lincat Cl = Clause ; lincat Prep = Compl ; -lincat Pron = {s : Case => Str; g : Gender; n : Number; p : Person} ; lincat CN = CommonNoun ; +lincat NP, Pron = {s : Case => Str ; g : Gender ; n : Number ; p : Person} ; +lincat RCl = {s : Tense => Polarity => Gender => PersNum => Str} ; +lincat RS = {s : Gender => PersNum => Str} ; +lincat RP = {s : Str} ; lincat AP = AdjPhrase ; +lincat Det = {s : Gender => Case => Str ; n : Number ; sp : Species} ; +lincat Quant = {s : Gender => Number => Case => Str ; sp : Species} ; +lincat Num = {s : Gender => Case => Str ; n : Number} ; lincat S = {s : Str} ; lincat LN,SN,GN,PN = {s : Str} ; diff --git a/src/faroese/GrammarFao.gf b/src/faroese/GrammarFao.gf index 10ab6adc..5095f584 100644 --- a/src/faroese/GrammarFao.gf +++ b/src/faroese/GrammarFao.gf @@ -2,6 +2,9 @@ concrete GrammarFao of Grammar = TenseX, PhraseFao, NounFao, + VerbFao, AdjectiveFao, + SentenceFao, + RelativeFao, StructuralFao ** { } diff --git a/src/faroese/LexiconFao.gf b/src/faroese/LexiconFao.gf index 4d14c39a..0bd1c95a 100644 --- a/src/faroese/LexiconFao.gf +++ b/src/faroese/LexiconFao.gf @@ -1,2 +1,9 @@ -concrete LexiconFao of Lexicon = CatFao ** open ParadigmsFao in { -} \ No newline at end of file +concrete LexiconFao of Lexicon = CatFao ** open ParadigmsFao, ResFao in { +lin + apple_N = mkN "epli" ; + big_A = mkA "stórur" ; + child_N = mkN "barn" ; + die_V = mkV "doyggja" "doyrt" ; + good_A = mkA "góður" ; + go_V = mkVerb "farið" "far" "farið" "fari" "fert" "fer" "fara" "fór" "fórt" "fór" "fóru" "fara" "farandi" "farin" ; +} diff --git a/src/faroese/NounFao.gf b/src/faroese/NounFao.gf index b9133c36..32bfa5bb 100644 --- a/src/faroese/NounFao.gf +++ b/src/faroese/NounFao.gf @@ -1,4 +1,51 @@ -concrete NounFao of Noun = CatFao ** { +concrete NounFao of Noun = CatFao ** open ResFao in { lin UseN n = n ; + UsePron p = p ; + RelNP np rs = + np ** {s = \\c => np.s ! c ++ "," ++ rs.s ! np.g ! persNum np.n np.p} ; + DetCN det cn = { + s = \\c => det.s ! cn.g ! c ++ cn.s ! det.sp ! det.n ! c ; + g = cn.g ; + n = det.n ; + p = P3 + } ; + DefArt = { + s = \\_,_,_ => [] ; + sp = Def + } ; + IndefArt = { + s = table { + Masc => table { + Sg => table {Nom => "ein" ; Acc => "ein" ; Dat => "einum" ; Gen => "eins"} ; + Pl => \\_ => [] + } ; + Fem => table { + Sg => table {Nom => "ein" ; Acc => "eina" ; Dat => "einari" ; Gen => "einar"} ; + Pl => \\_ => [] + } ; + Neuter => table { + Sg => table {Nom => "eitt" ; Acc => "eitt" ; Dat => "einum" ; Gen => "eins"} ; + Pl => \\_ => [] + } + } ; + sp = Indef + } ; + DetQuant quant num = { + s = \\g,c => quant.s ! g ! num.n ! c ++ num.s ! g ! c ; + n = num.n ; + sp = quant.sp + } ; + NumSg = { + s = \\_,_ => [] ; + n = Sg + } ; + NumPl = { + s = \\_,_ => [] ; + n = Pl + } ; + AdjCN ap cn = { + s = \\sp,n,c => ap.s ! cn.g ! n ! c ++ cn.s ! sp ! n ! c ; + g = cn.g + } ; } diff --git a/src/faroese/ParadigmsFao.gf b/src/faroese/ParadigmsFao.gf index d37e1305..b4eb8c54 100644 --- a/src/faroese/ParadigmsFao.gf +++ b/src/faroese/ParadigmsFao.gf @@ -569,9 +569,9 @@ oper mkIQuant : Str -> IQuant = \s -> lin IQuant {s=s} ; mkIDet : Str -> IDet = \s -> lin IDet {s=s} ; mkSubj : Str -> Subj = \s -> lin Subj {s=s} ; - mkQuant : Str -> Quant = \s -> lin Quant {s=s} ; + mkQuant : Str -> Quant = \s -> lin Quant {s=\\_,_,_ => s; sp=Indef} ; mkPredet : Str -> Predet = \s -> lin Predet {s=s} ; - mkDet : Str -> Det = \s -> lin Det {s=s} ; + mkDet : Str -> Det = \s -> lin Det {s=\\_,_ => s; n=Sg; sp=Indef} ; mkCard : Str -> Card = \s -> lin Card {s=s} ; mkACard : Str -> ACard = \s -> lin ACard {s=s} ; mkConj : Str -> Conj = \s -> lin Conj {s=s} ; diff --git a/src/faroese/PhraseFao.gf b/src/faroese/PhraseFao.gf index 23bc77c2..6e377004 100644 --- a/src/faroese/PhraseFao.gf +++ b/src/faroese/PhraseFao.gf @@ -1,8 +1,10 @@ -concrete PhraseFao of Phrase = CatFao ** { +concrete PhraseFao of Phrase = CatFao ** open ResFao in { lin PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; UttS s = s ; + UttNP np = {s = np.s ! Nom} ; + UttVP vp = {s = vp.Nonfinite} ; UttInterj i = i ; NoPConj = {s = []} ; diff --git a/src/faroese/RelativeFao.gf b/src/faroese/RelativeFao.gf new file mode 100644 index 00000000..a6827a50 --- /dev/null +++ b/src/faroese/RelativeFao.gf @@ -0,0 +1,7 @@ +concrete RelativeFao of Relative = CatFao ** open ResFao in { +lin + IdRP = {s = "sum"} ; + RelVP rp vp = { + s = \\t,pol,g,pn => rp.s ++ vp.Indicative ! t ! pol ! g ! pn + } ; +} diff --git a/src/faroese/ResFao.gf b/src/faroese/ResFao.gf index c12962e7..9dccfe34 100644 --- a/src/faroese/ResFao.gf +++ b/src/faroese/ResFao.gf @@ -1,7 +1,6 @@ -resource ResFao = { +resource ResFao = ParamX - [Tense,Pres,Past] ** { param Species = Indef | Def ; -param Number = Sg | Pl ; param Case = Nom | Acc | Dat | Gen ; param Gender = Masc | Fem | Neuter ; oper Noun = {s: Species => Number => Case => Str; g : Gender} ; -- 2135 @@ -90,9 +89,20 @@ oper mkAdj : (_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Adj = } } ; -param Tense = Past | Pres ; +param Tense = Pres | Past ; + param PersNum = PSg Person | PPl ; -param Person = P1 | P3 | P2 ; +oper persNum : Number -> Person -> PersNum = + \n,p -> case n of { + Sg => PSg p ; + Pl => PPl + } ; +oper persNumNumber : PersNum -> Number = + \pn -> case pn of { + PSg _ => Sg ; + PPl => Pl + } ; + oper Verb = {Converb: Str; imperative: Number => Str; Indicative: Tense => PersNum => Str; Nonfinite: Str; Participle: Tense => Str ; particle : Str} ; -- 596 oper mkVerb : (_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Verb = \f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14 -> @@ -129,5 +139,34 @@ oper noPrep : Compl = {s=""; c=Acc} ; oper CommonNoun = Noun ; oper AdjPhrase = Adj ; +oper VerbPhrase = { + Converb : Str ; + Indicative : Tense => Polarity => Gender => PersNum => Str ; + Nonfinite : Str ; + Participle : Tense => Str ; +} ; +oper Clause = { + Converb : Str ; + Indicative : Tense => Polarity => Str ; + Nonfinite : Str ; + Participle : Tense => Str +} ; + +oper + copula : Tense => PersNum => Str = + table { + Pres => table { + PSg P1 => "eri" ; + PSg P2 => "ert" ; + PSg P3 => "er" ; + PPl => "eru" + } ; + Past => table { + PSg P1 => "var" ; + PSg P2 => "vart" ; + PSg P3 => "var" ; + PPl => "vóru" + } + } ; } diff --git a/src/faroese/SentenceFao.gf b/src/faroese/SentenceFao.gf new file mode 100644 index 00000000..0d75479e --- /dev/null +++ b/src/faroese/SentenceFao.gf @@ -0,0 +1,31 @@ +concrete SentenceFao of Sentence = CatFao ** open Prelude, ResFao, (P = ParamX) in { + lin PredVP np vp = {Converb = np.s ! Nom ++ vp.Converb; + Indicative = \\t,pol => + let p = persNum np.n np.p + in np.s ! Nom ++ vp.Indicative ! t ! pol ! np.g ! p; + Nonfinite = np.s ! Nom ++ vp.Nonfinite; + Participle = \\t => np.s ! Nom ++ vp.Participle ! t} ; + UseCl temp pol cl = + let + tense = case temp.t of { + P.Pres => Pres ; + P.Past => Past ; + P.Fut => Pres ; + P.Cond => Past + } ; + in { + s = temp.s ++ pol.s ++ cl.Indicative ! tense ! pol.p + } ; + UseRCl temp pol rcl = + let + tense = case temp.t of { + P.Pres => Pres ; + P.Past => Past ; + P.Fut => Pres ; + P.Cond => Past + } + in { + s = \\g,pn => + temp.s ++ pol.s ++ rcl.s ! tense ! pol.p ! g ! pn + } ; +}