diff --git a/src/latin/NounLat.gf b/src/latin/NounLat.gf index b7d759e8..7c0df412 100644 --- a/src/latin/NounLat.gf +++ b/src/latin/NounLat.gf @@ -105,8 +105,10 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude, ConjunctionLat in { -- OrdDigits n = {s = n.s ! NOrd} ; -- lin --- NumNumeral numeral = numeral.s ; --- OrdNumeral numeral = numeral.ord ; + -- NumNumeral : Numeral -> Card ; -- fifty-one + NumNumeral numeral = { s = numeral.s ; n = numeral.n } ; + -- OrdNumeral : Numeral -> Ord ; -- fifty-first + OrdNumeral numeral = { s = numeral.ord } ; -- -- AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ; -- diff --git a/src/latin/NumeralLat.gf b/src/latin/NumeralLat.gf index 075915b6..0ed4fe40 100644 --- a/src/latin/NumeralLat.gf +++ b/src/latin/NumeralLat.gf @@ -18,111 +18,136 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr n9 = lin Digit ( mkDigit "novem" "undeviginti" "nonaginta" "nongenti" "nonus" "centum" No9 ) ; -- 1 - pot01 = { s = n1.s ! one ; d = n1.s ; n = singular ; below8 = n1.below8 } ; + pot01 = { + s = n1.s ! one ; + d = { num, ord = n1.s } ; + n = singular ; + below8 = n1.below8 ; + ord = n1.ord ! one + } ; -- d * 1 pot0 d = { s = d.s ! one ; - d = table { - thousand => \\g,c => d.s ! one ! g ! c ++ d.s ! thousand ! g ! c ; - u => \\g,c => d.s ! u ! g ! c - } ; + d = { num,ord = table { + thousand => \\g,c => d.s ! one ! g ! c ++ d.s ! thousand ! g ! c ; + u => \\g,c => d.s ! u ! g ! c + } + }; n = plural ; - below8 = d.below8 + below8 = d.below8 ; + ord = d.ord ! one ; } ; -- 10 pot110 = { s = n1.s ! ten ; - d = table { - thousand => \\g,c => n1.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ; - u => \\g,c => n1.s ! u ! g ! c - } ; + d = { num, ord = table { + thousand => \\g,c => n1.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ; + u => \\g,c => n1.s ! u ! g ! c + } + }; n = singular ; - below8 = Yes + below8 = Yes ; + ord = n1.ord ! ten } ; -- 11 pot111 = pot1to19 n1 ; -- 10 + d pot1to19 d = { s = d.s ! eleven ; - d = table { - thousand => \\g,c => d.s ! eleven ! g ! c ++ n1.s ! thousand ! g ! c ; - u => \\g,c => d.s ! u ! g ! c - } ; + d = { num, ord = table { + thousand => \\g,c => d.s ! eleven ! g ! c ++ n1.s ! thousand ! g ! c ; + u => \\g,c => d.s ! u ! g ! c + } + }; n = plural ; - below8 = Ign + below8 = Ign ; + ord = n1.ord ! eleven } ; -- coercion of 1..9 pot0as1 n = n ; -- d * 10 pot1 d = { s = d.s ! ten ; - d = table { - thousand => \\g,c => d.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ; - u => \\g,c => d.s ! u ! g ! c - } ; + d = { num, ord = table { + thousand => \\g,c => d.s ! ten ! g ! c ++ n1.s ! thousand ! g ! c ; + u => \\g,c => d.s ! u ! g ! c + } + }; n = plural ; - below8 = Yes + below8 = Yes ; + ord = d.ord ! ten } ; -- d * 10 + n pot1plus d n = let newS : Gender => Case => Str = \\g,c => case n.below8 of { - No8 => "duo" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ d.tenNext ; - No9 => "un" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ "-" ++ Prelude.BIND ++ d.tenNext ; + No8 => "duo" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ d.tenNext ; + No9 => "un" ++ Prelude.BIND ++ "de" ++ Prelude.BIND ++ d.tenNext ; _ => d.s ! ten ! g ! c ++ n.s ! g ! c } in { s = newS ; - d = table { - thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ; - u => \\g,c => n.d ! u ! g ! c - } ; + d = { num, ord = table { + thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ; + u => \\g,c => n.d.num ! u ! g ! c + } + }; below8 = Ign ; - n = plural + n = plural ; + ord = \\_,_,_ => nonExist -- TODO } ; -- coercion of 1..99 pot1as2 n = n ; -- m * 100 pot2 n = { - s = n.d ! hundred ; - d = table { - thousand => \\g,c => n.d ! hundred ! g ! c ++ n1.s ! thousand ! g ! c ; - u => \\g,c => n.d ! u ! g ! c - } ; + s = n.d.num ! hundred ; + d = { num, ord = table { + thousand => \\g,c => n.d.num ! hundred ! g ! c ++ n1.s ! thousand ! g ! c ; + u => \\g,c => n.d.num ! u ! g ! c + } + }; n = plural ; - below8 = Yes} ; + below8 = Yes ; + ord = \\_,_,_ => nonExist -- TODO + } ; -- d * 100 + n pot2plus d n = let - newS : Gender => Case => Str = \\g,c => d.d ! hundred ! g ! c ++ "et" ++ n.s ! g ! c + newS : Gender => Case => Str = \\g,c => d.d.num ! hundred ! g ! c ++ "et" ++ n.s ! g ! c in { s = newS ; - d = table { - thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ; - u => \\g,c => n.d ! u ! g ! c - } ; + d = { num, ord = table { + thousand => \\g,c => newS ! g ! c ++ n1.s ! thousand ! g ! c ; + u => \\g,c => n.d.num ! u ! g ! c + } + }; below8 = Ign ; - n = plural + n = plural; + ord = \\_,_,_ => nonExist -- TODO } ; -- coercion of 1..999 pot2as3 n = n ; -- m * 1000 pot3 n = { - s = \\g,c => n.s ! g ! c ++ n.d ! thousand ! g ! c ; - d = table { thousand => \\g,c => n.s ! g ! c ++ n.d ! thousand ! g ! c ; - u => \\g,c => n.d ! u ! g ! c + s = \\g,c => n.s ! g ! c ++ n.d.num ! thousand ! g ! c ; + d = { num,ord = table { + thousand => \\g,c => n.s ! g ! c ++ n.d.num ! thousand ! g ! c ; + u => \\g,c => n.d.num ! u ! g ! c + } } ; below8 = Ign ; - n = plural + n = plural ; + ord = \\_,_,_ => nonExist -- TODO } ; -- d * 1000 + n pot3plus d n = { - s = \\g,c => d.d ! thousand ! g ! c ++ "et" ++ n.s ! g ! c ; - d = n.d ; + s = \\g,c => d.d.num ! thousand ! g ! c ++ "et" ++ n.s ! g ! c ; + d = n.d ; -- ??? below8 = Ign ; - n = plural + n = plural ; + ord = \\_,_,_ => nonExist -- TODO } ; oper @@ -146,14 +171,15 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr hundred_thousand => \\_,_ => nonExist } ; -- n = case ones of { "unus" => singular ; _ => plural } ; - -- ord = - -- \\_,_ => [] ; - -- -- table { one => (mkA ord1).s ! Posit; - -- -- ten => (mkA ord10).s ! Posit ; - -- -- hundred => (mkA ord100).s ! Posit ; - -- -- thousand => \\_,_ => nonExist ; - -- -- ten_thousand => \\_ => nonExist ; - -- -- hundred_thousand => \\_ => nonExist } ; + ord = + table { one => ordFlex ord1 ; + eleven => \\_,_,_ => nonExist ; + ten => ordFlex ord10 ; + hundred => ordFlex ord100 ; + thousand => \\_,_,_ => nonExist ; + ten_thousand => \\_,_,_ => nonExist ; + hundred_thousand => \\_,_,_ => nonExist + } ; tenNext = tenNext ; below8 = b8 } ; diff --git a/src/latin/ResLat.gf b/src/latin/ResLat.gf index 75a76ea3..702e2bea 100644 --- a/src/latin/ResLat.gf +++ b/src/latin/ResLat.gf @@ -1472,8 +1472,8 @@ oper Below8 = Yes | No8 | No9 | Ign ; oper -- Numerals are by default cardinal numbers but have a field for ordinal numbers - TDigit : Type = { s : Unit => Gender => Case => Str ; tenNext : Str ; below8 : Below8 } ; -- ord : Unit => Agr => Str } ; - TNumeral : Type = { s : Gender => Case => Str ; d : Unit => Gender => Case => Str ; n : Number ; below8 : Below8 } ; -- ord : Unit => Agr => Str } ; + TDigit : Type = { s : Unit => Gender => Case => Str ; tenNext : Str ; below8 : Below8 ; ord : Unit => Gender => Number => Case => Str } ; + TNumeral : Type = { s : Gender => Case => Str ; d : { num, ord : Unit => Gender => Case => Str } ; n : Number ; below8 : Below8 ; ord : Gender => Number => Case => Str } ; -- Inflection for cardinal numbers cardFlex : Str -> Gender => Case => Str = @@ -1496,21 +1496,21 @@ oper } ; _ => \\_,_ => c } ; - -- ordFlex : Gender => Number => Case => Str = - -- case o of { - -- stem + "us" => table { - -- Masc => table Number [ table Case [ stem + "us" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "e" ] ; - -- table Case [ stem + "i" ; stem + "os" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "i" ] ; - -- ]; - -- Fem => table Number [ table Case [ stem + "a" ; stem + "am" ; stem + "ae" ; stem + "ae" ; stem + "a" ; stem + "a" ] ; - -- table Case [ stem + "ae" ; stem + "as" ; stem + "arum" ; stem + "is" ; stem + "is" ; stem + "ae" ] ; - -- ] ; - -- Neutr => table Number [ table Case [ stem + "um" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "um" ] ; - -- table Case [ stem + "a" ; stem + "a" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "a" ] ; - -- ] - -- } ; - -- _ => error "unsupported ordinal form" - -- } + ordFlex : Str -> Gender => Number => Case => Str = + \o -> case o of { + stem + "us" => table { + Masc => table Number [ table Case [ stem + "us" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "e" ] ; + table Case [ stem + "i" ; stem + "os" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "i" ] ; + ]; + Fem => table Number [ table Case [ stem + "a" ; stem + "am" ; stem + "ae" ; stem + "ae" ; stem + "a" ; stem + "a" ] ; + table Case [ stem + "ae" ; stem + "as" ; stem + "arum" ; stem + "is" ; stem + "is" ; stem + "ae" ] ; + ] ; + Neutr => table Number [ table Case [ stem + "um" ; stem + "um" ; stem + "i" ; stem + "o" ; stem + "o" ; stem + "um" ] ; + table Case [ stem + "a" ; stem + "a" ; stem + "orum" ; stem + "is" ; stem + "is" ; stem + "a" ] ; + ] + } ; + _ => error "unsupported ordinal form" + } ; -- in -- { s = cardFlex ; n = case c of { "unus" => Sg ; _ => Pl } ; ord = ordFlex } ;