Files
comp-syntax-gu-mlt/lab1/grammar/korean/MicroResKor.gf

48 lines
1.4 KiB
Plaintext

resource MicroResKor = open Prelude, HangulJamo in {
param
VForm = VLemma | VPresent | VPast | VAdnomial ;
NForm = NBare | NTopic | NSubject | NObject | NPluralSubject | NPluralTopic ;
oper
Noun : Type = {s : NForm => Str} ;
Verb : Type = {s : VForm => Str} ;
Verb2 : Type = Verb ;
Adjective : Type = Verb ;
lemmaToStem : (lemma : Str) -> Str
= \lemma -> case lemma of {
stem + "다" => stem ;
_ => Predef.error ("lemmaToStem was applied to a non-lemma," ++ lemma)
} ;
reg : (descriptive : Bool) -> (lemma : Str) -> Verb
= \descriptive,lemma ->
let stem = lemmaToStem lemma ;
in {
s = table {
VLemma => lemma ;
VPresent => present_haeyo stem ;
VPast => past_haeyo stem ;
VAdnomial =>
if_then_else Str descriptive
(stem + vc_allomorph stem "ᆫ" "은")
(stem + "는")
}
} ;
regVerb : (lemma : Str) -> Verb = reg False ;
regAdjective : (lemma : Str) -> Adjective = reg True ;
noun : (bare : Str) -> Noun
= \bare -> {
s = table {
NBare => bare ;
NTopic => bare + vc_allomorph bare "는" "은" ;
NSubject => bare + vc_allomorph bare "이" "가" ;
NObject => bare + vc_allomorph bare "를" "을" ;
NPluralTopic => bare + "들은" ;
NPluralSubject => bare + "들이"
}
} ;
}