Files
comp-syntax-gu-mlt/lab1/grammar/korean/MicroResKor.gf
2026-02-12 16:19:46 -07:00

35 lines
921 B
Plaintext

resource MicroResKor = open Prelude, HangulJamo in {
param
VForm = VLemma | VPresent | VPast | VAdnomial ;
oper
Noun : Type = {s : 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 ;
}