1
0
forked from GitHub/gf-core

examples/letter: convert grammar files to UTF-8

This commit is contained in:
hallgren
2013-11-26 12:52:05 +00:00
parent c247aa6791
commit d55a3f9d6e
3 changed files with 39 additions and 39 deletions

View File

@@ -5,7 +5,7 @@ concrete LetterFin of Letter = {
-- This file defines the Finnish syntax of the grammar set -- This file defines the Finnish syntax of the grammar set
-- whose abstract syntax is $letter.Abs.gf$. -- whose abstract syntax is $letter.Abs.gf$.
flags lexer=textlit ; unlexer=textlit ; flags lexer=textlit ; unlexer=textlit ; coding=utf8;
-- modified from French in 20 min, 15/6/2002 -- modified from French in 20 min, 15/6/2002
@@ -33,10 +33,10 @@ oper
egosum : Num => Str = egosum : Num => Str =
table {sg => "olen" ; pl => "olemme"} ; table {sg => "olen" ; pl => "olemme"} ;
egohabeo : Num => Str = egohabeo : Num => Str =
table {sg => "minulla" ++ "on" ; pl => "meillä" ++ "on"} ; table {sg => "minulla" ++ "on" ; pl => "meillä" ++ "on"} ;
fuisti : Num => Str = fuisti : Num => Str =
table {sg => "sinut" ++ "on"; pl => "teidät" ++ "on"} ; table {sg => "sinut" ++ "on"; pl => "teidät" ++ "on"} ;
quePrep = "että" ; ---- quePrep = "että" ; ----
tuinformare : Num => Str = tuinformare : Num => Str =
table {sg => "ilmoittaa" ++ "sinulle" ; pl => "ilmoittaa" ++ "teille"} ; table {sg => "ilmoittaa" ++ "sinulle" ; pl => "ilmoittaa" ++ "teille"} ;
@@ -45,13 +45,13 @@ oper
avoir : Num => Str = avoir : Num => Str =
table {sg => "on"; pl => "ovat"} ; table {sg => "on"; pl => "ovat"} ;
mes : Num => Str = table {sg => "minun" ; pl => "meidän"} ; mes : Num => Str = table {sg => "minun" ; pl => "meidän"} ;
teamo : Num => Num => Str = table { teamo : Num => Num => Str = table {
sg => table {sg => "rakastan" ++ "sinua" ; sg => table {sg => "rakastan" ++ "sinua" ;
pl => "rakastan" ++ "teitä"} ; pl => "rakastan" ++ "teitä"} ;
pl => table {sg => "rakastamme" ++ "sinua" ; pl => table {sg => "rakastamme" ++ "sinua" ;
pl => "rakastamme" ++ "teitä"} pl => "rakastamme" ++ "teitä"}
} ; } ;
constNG : Str -> Num -> Gen -> SSSrc2 = \str,num,gen -> constNG : Str -> Num -> Gen -> SSSrc2 = \str,num,gen ->
@@ -132,7 +132,7 @@ Regret = {s =
President = constNG ["presidentti"] sg masc ; President = constNG ["presidentti"] sg masc ;
Mother = constNG ["äiti"] sg fem ; Mother = constNG ["äiti"] sg fem ;
Spouse = {s = table { Spouse = {s = table {
sg => table {fem => ["miehesi"] ; masc => ["vaimosi"]} ; sg => table {fem => ["miehesi"] ; masc => ["vaimosi"]} ;
pl => table {fem => ["miehenne"] ; masc => ["vaimonne"]} pl => table {fem => ["miehenne"] ; masc => ["vaimonne"]}
@@ -174,8 +174,8 @@ Senior = {s = table {sg => table {g => ["vanhemmaksi tutkijaksi"]} ;
ProjectManager = {s = ProjectManager = {s =
table { table {
sg => table {_ => ["projektipäälliköksi"]} ; sg => table {_ => ["projektipäälliköksi"]} ;
pl => table {_ => ["projektipäälliköiksi"]} pl => table {_ => ["projektipäälliköiksi"]}
}} ; }} ;
} }

View File

@@ -6,7 +6,7 @@ concrete LetterFre of Letter = {
-- whose abstract syntax is $letter.Abs.gf$. -- whose abstract syntax is $letter.Abs.gf$.
flags lexer=textlit ; unlexer=textlit ; flags lexer=textlit ; unlexer=textlit ; coding=utf8;
param Gen = masc | fem ; param Gen = masc | fem ;
param Num = sg | pl ; param Num = sg | pl ;
@@ -24,7 +24,7 @@ oper SSSrcGen = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper oper
ss : Str -> SS = \s -> {s = s} ; ss : Str -> SS = \s -> {s = s} ;
cher : Num => Gen => Tok = cher : Num => Gen => Tok =
table {n => table {masc => regNom "cher" ! n ; fem => regNom "chère" ! n}}; table {n => table {masc => regNom "cher" ! n ; fem => regNom "chère" ! n}};
regAdj : Str -> Gen => Num => Str = \s -> regAdj : Str -> Gen => Num => Str = \s ->
table {masc => regNom s ; fem => regNom (s + "e")} ; table {masc => regNom s ; fem => regNom (s + "e")} ;
regNom : Str -> Num => Str = \s -> table {sg => s ; pl => s + "s"} ; regNom : Str -> Num => Str = \s -> table {sg => s ; pl => s + "s"} ;
@@ -33,7 +33,7 @@ oper
egohabeo : Num => Str = egohabeo : Num => Str =
table {sg => "j'ai" ; pl => "nous" ++ "avons"} ; table {sg => "j'ai" ; pl => "nous" ++ "avons"} ;
fuisti : Num => Str = fuisti : Num => Str =
table {sg => "tu" ++ "as" ++ "été"; pl => "vous" ++ "avez" ++ "été"} ; table {sg => "tu" ++ "as" ++ "été"; pl => "vous" ++ "avez" ++ "été"} ;
quePrep = "que" ; ---- quePrep = "que" ; ----
tuinformare : Num => Str = tuinformare : Num => Str =
table {sg => "t'informer"; pl => "vous" ++ "informer"} ; table {sg => "t'informer"; pl => "vous" ++ "informer"} ;
@@ -102,18 +102,18 @@ FormalEnding auth =
{s = {s =
table {n => table {g => table {n => table {g =>
"avec" ++ mes ! dep2num auth.n n ++ "avec" ++ mes ! dep2num auth.n n ++
["salutations distinguées"] ++ RET ++ auth.s ! n ! g}} ; ["salutations distinguées"] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ; n = auth.n ; g = auth.g} ;
InformalEnding auth = InformalEnding auth =
{s = table {n => table {g => ["Amicalement"] ++ RET ++ auth.s ! n ! g}} ; {s = table {n => table {g => ["Amicalement"] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ; n = auth.n ; g = auth.g} ;
ColleaguesHe = {s = regNom "collègue" ! pl ; n = pl ; g = masc} ; ColleaguesHe = {s = regNom "collègue" ! pl ; n = pl ; g = masc} ;
ColleaguesShe = {s = regNom "collègue" ! pl ; n = pl ; g = fem} ; ColleaguesShe = {s = regNom "collègue" ! pl ; n = pl ; g = fem} ;
ColleagueHe = {s = regNom "collègue" ! sg ; n = sg ; g = masc} ; ColleagueHe = {s = regNom "collègue" ! sg ; n = sg ; g = masc} ;
ColleagueShe = {s = regNom "collègue" ! sg ; n = sg ; g = fem} ; ColleagueShe = {s = regNom "collègue" ! sg ; n = sg ; g = fem} ;
DarlingHe = {s = "chéri" ; n = sg ; g = masc} ; DarlingHe = {s = "chéri" ; n = sg ; g = masc} ;
DarlingShe = {s = "chérie" ; n = sg ; g = fem} ; DarlingShe = {s = "chérie" ; n = sg ; g = fem} ;
NameHe s = {s = s.s ; n = sg ; g = masc} ; NameHe s = {s = s.s ; n = sg ; g = masc} ;
NameShe s = {s = s.s ; n = sg ; g = fem} ; NameShe s = {s = s.s ; n = sg ; g = fem} ;
@@ -126,12 +126,12 @@ Honour = {s =
Regret = {s = Regret = {s =
table {na => table {ga => table {nr => table {gr => table {na => table {ga => table {nr => table {gr =>
let {dga = dep2gen ga gr ; dna = dep2num na nr} in let {dga = dep2gen ga gr ; dna = dep2num na nr} in
egosum ! dna ++ regAdj "désolé" ! dga ! dna ++ egosum ! dna ++ regAdj "désolé" ! dga ! dna ++
["d'informer"] ++ quePrep}}}} ["d'informer"] ++ quePrep}}}}
} ; } ;
President = constNG ["le président"] sg masc ; President = constNG ["le président"] sg masc ;
Mother = constNG ["maman"] sg fem ; Mother = constNG ["maman"] sg fem ;
Spouse = {s = table { Spouse = {s = table {
sg => table {fem => ["ton mari"] ; masc => ["ta femme"]} ; sg => table {fem => ["ton mari"] ; masc => ["ta femme"]} ;
@@ -155,7 +155,7 @@ ILoveYou = {s =
} ; } ;
Company = {s = ["notre entreprise"] ; n = sg ; g = fem} ; Company = {s = ["notre entreprise"] ; n = sg ; g = fem} ;
Competitor = {s = ["notre pire compétiteur"] ; n = sg ; g = masc} ; Competitor = {s = ["notre pire compétiteur"] ; n = sg ; g = masc} ;
OurCustomers = {s = ["nos clients"] ; n = pl ; g = masc} ; OurCustomers = {s = ["nos clients"] ; n = pl ; g = masc} ;
Senior = {s = table {sg => table {g => ["responsable scientifique"]} ; Senior = {s = table {sg => table {g => ["responsable scientifique"]} ;

View File

@@ -6,7 +6,7 @@ concrete LetterSwe of Letter = {
-- whose abstract syntax is $letter.Abs.gf$. -- whose abstract syntax is $letter.Abs.gf$.
flags lexer=textlit ; unlexer=textlit ; flags lexer=textlit ; unlexer=textlit ; coding=utf8;
printname cat Letter = "Brev" ; printname cat Letter = "Brev" ;
printname fun MkLetter = "brevmall" ; printname fun MkLetter = "brevmall" ;
@@ -70,30 +70,30 @@ PlainSent sent = sent ;
FormalEnding auth = FormalEnding auth =
{s = table {n => table {x => {s = table {n => table {x =>
["Med vänlig hälsning"] ++ RET ++ auth.s ! n ! x}} ; n = auth.n ; x = auth.x} ; ["Med vänlig hälsning"] ++ RET ++ auth.s ! n ! x}} ; n = auth.n ; x = auth.x} ;
InformalEnding auth = InformalEnding auth =
{s = table {n => table {x => {s = table {n => table {x =>
["Med hälsningar"] ++ RET ++ auth.s ! n ! x}} ; n = auth.n ; x = auth.x} ; ["Med hälsningar"] ++ RET ++ auth.s ! n ! x}} ; n = auth.n ; x = auth.x} ;
ColleaguesHe = {s = kollega ! pl ; n = pl ; x = masc} ; ColleaguesHe = {s = kollega ! pl ; n = pl ; x = masc} ;
ColleaguesShe = {s = kollega ! pl ; n = pl ; x = fem} ; ColleaguesShe = {s = kollega ! pl ; n = pl ; x = fem} ;
ColleagueHe = {s = kollega ! sg ; n = sg ; x = masc} ; ColleagueHe = {s = kollega ! sg ; n = sg ; x = masc} ;
ColleagueShe = {s = kollega ! sg ; n = sg ; x = fem} ; ColleagueShe = {s = kollega ! sg ; n = sg ; x = fem} ;
DarlingHe = {s = "älskling" ; n = sg ; x = masc} ; DarlingHe = {s = "älskling" ; n = sg ; x = masc} ;
DarlingShe = {s = "älskling" ; n = sg ; x = fem} ; DarlingShe = {s = "älskling" ; n = sg ; x = fem} ;
NameHe s = {s = s.s ; n = sg ; x = masc} ; NameHe s = {s = s.s ; n = sg ; x = masc} ;
NameShe s = {s = s.s ; n = sg ; x = fem} ; NameShe s = {s = s.s ; n = sg ; x = fem} ;
Honour = {s = Honour = {s =
table {na => table {xa => table {nr => table {xr => table {na => table {xa => table {nr => table {xr =>
jag ! dep2num na nr ! nom ++ ["har äran att meddela"] ++ jag ! dep2num na nr ! nom ++ ["har äran att meddela"] ++
du ! nr ! acc ++ "att"}}}} du ! nr ! acc ++ "att"}}}}
} ; } ;
Regret = {s = Regret = {s =
table {na => table {xa => table {nr => table {xr => table {na => table {xa => table {nr => table {xr =>
jag ! dep2num na nr ! nom ++ ["måste tyvärr meddela"] ++ jag ! dep2num na nr ! nom ++ ["måste tyvärr meddela"] ++
du ! nr ! acc ++ "att"}}}} du ! nr ! acc ++ "att"}}}}
} ; } ;
@@ -102,7 +102,7 @@ President = constNX ["Presidenten"] sg masc ;
Mother = constNX ["Mamma"] sg fem ; Mother = constNX ["Mamma"] sg fem ;
Spouse = {s = table { Spouse = {s = table {
sg => table {fem => ["din man"] ; masc => ["din hustru"]} ; sg => table {fem => ["din man"] ; masc => ["din hustru"]} ;
pl => table {fem => ["era män"] ; masc => ["era hustrur"]} pl => table {fem => ["era män"] ; masc => ["era hustrur"]}
} ; n = depnum ; x = masc} ; -- sex does not matter here } ; n = depnum ; x = masc} ; -- sex does not matter here
Dean = constNX ["Dekanus"] sg masc ; Dean = constNX ["Dekanus"] sg masc ;
Name s = constNX s.s sg masc ; --- Name s = constNX s.s sg masc ; ---
@@ -114,18 +114,18 @@ BePromoted pos = {s =
} ; } ;
GoBankrupt np = {s = GoBankrupt np = {s =
table {na => table {xa => table {nr => table {xr => table {na => table {xa => table {nr => table {xr =>
np.s ++ ["har gått i konkurs"]}}}} np.s ++ ["har gått i konkurs"]}}}}
} ; } ;
ILoveYou = {s = ILoveYou = {s =
table {na => table {xa => table {nr => table {xr => table {na => table {xa => table {nr => table {xr =>
jag ! dep2num na nr ! nom ++ ["älskar"] ++ du ! nr ! acc}}}} jag ! dep2num na nr ! nom ++ ["älskar"] ++ du ! nr ! acc}}}}
} ; } ;
Company = {s = ["vårt företag"] ; n = sg ; g = ett} ; Company = {s = ["vårt företag"] ; n = sg ; g = ett} ;
Competitor = {s = ["vår värsta konkurrent"] ; n = sg ; g = en} ; Competitor = {s = ["vår värsta konkurrent"] ; n = sg ; g = en} ;
OurCustomers = {s = ["våra kunder"] ; n = pl ; g = en} ; OurCustomers = {s = ["våra kunder"] ; n = pl ; g = en} ;
Senior = {s = table {n => table {x => ["äldre forskare"]}}} ; Senior = {s = table {n => table {x => ["äldre forskare"]}}} ;
ProjectManager = {s = ProjectManager = {s =
table { table {
sg => table {_ => "projektchef"} ; sg => table {_ => "projektchef"} ;
@@ -137,8 +137,8 @@ oper
kaer : kaer :
Num => Sex => Str = Num => Sex => Str =
table { table {
sg => table {masc => "Käre" ; fem => "Kära"} ; sg => table {masc => "Käre" ; fem => "Kära"} ;
pl => table {_ => "Kära"} pl => table {_ => "Kära"}
} ; } ;
kollega : kollega :