WIP: Malay grammar

Copied and pasted from previous RGs, very minimal at the moment.
This commit is contained in:
Inari Listenmaa
2020-08-18 20:13:35 +02:00
parent 4f821ca621
commit 6693a27d6c
25 changed files with 2117 additions and 0 deletions

62
src/malay/AdjectiveMay.gf Normal file
View File

@@ -0,0 +1,62 @@
concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in {
flags optimize=all_subs ;
lin
-- : A -> AP ;
PositA a = a ** {
compar = [] ;
} ;
-- : A -> NP -> AP ;
ComparA a np = a ** {
compar = np.s
} ;
-- : A2 -> NP -> AP ; -- married to her
-- ComplA2 a2 np = a2 ** { } ;
-- : A2 -> AP ; -- married to itself
-- ReflA2 a2 = a2 ** { } ;
-- : A2 -> AP ; -- married
UseA2 = PositA ;
-- : A -> AP ; -- warmer
-- UseComparA a = a ** {
-- s = \\af => "???" ++ a.s ! af ;
-- compar = []
-- } ;
-- : CAdv -> AP -> NP -> AP ; -- as cool as John
-- CAdvAP adv ap np = ap ** { } ;
-- The superlative use is covered in $Ord$.
-- : Ord -> AP ; -- warmest
-- AdjOrd ord = ord ** {
-- compar = []
-- } ;
-- Sentence and question complements defined for all adjectival
-- phrases, although the semantics is only clear for some adjectives.
-- : AP -> SC -> AP ; -- good that she is here
-- SentAP ap sc = ap ** {
-- s = \\af => ap.s ! af ++ sc.s
-- } ;
-- An adjectival phrase can be modified by an *adadjective*, such as "very".
-- : AdA -> AP -> AP ;
-- AdAP ada ap = ap ** { } ;
-- It can also be postmodified by an adverb, typically a prepositional phrase.
-- : AP -> Adv -> AP ; -- warm by nature
-- AdvAP ap adv = ap ** {} ;
}

33
src/malay/AdverbMay.gf Normal file
View File

@@ -0,0 +1,33 @@
concrete AdverbMay of Adverb = CatMay ** open ResMay, ParamMay, ParadigmsMay, Prelude in {
--lin
-- : A -> Adv ;
--PositAdvAdj adj = { } ;
-- : CAdv -> A -> NP -> Adv ; -- more warmly than John
-- ComparAdvAdj cadv a np = { } ;
-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
-- : Prep -> NP -> Adv ;
-- PrepNP =
-- Adverbs can be modified by 'adadjectives', just like adjectives.
--AdAdv : AdA -> Adv -> Adv ; -- very quickly
-- AdAdv ada adv = adv **
-- Like adverbs, adadjectives can be produced by adjectives.
-- : A -> AdA ; -- extremely
-- PositAdAAdj a = { } ;
-- Subordinate clauses can function as adverbs.
-- : Subj -> S -> Adv ;
-- SubjS subj s =
-- Comparison adverbs also work as numeral adverbs.
--AdnCAdv : CAdv -> AdN ; -- less (than five)
--AdnCAdv cadv = {s = } ;
} ;

6
src/malay/AllMay.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../common:../prelude
concrete AllMay of AllMayAbs =
LangMay,
ExtendMay
** {} ;

6
src/malay/AllMayAbs.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../common:prelude
abstract AllMayAbs =
Lang,
Extend
** {} ;

120
src/malay/CatMay.gf Normal file
View File

@@ -0,0 +1,120 @@
concrete CatMay of Cat = CommonX ** open ResMay, Prelude in {
flags optimize=all_subs ;
lincat
--2 Sentences and clauses
-- Constructed in SentenceMay, and also in IdiomMay
S = ResMay.Sentence ;
QS = SS ;
RS = SS ;
-- relative sentence. Tense and polarity fixed,
-- but agreement may depend on the CN/NP it modifies.
Cl = ResMay.Clause ;
ClSlash = ResMay.Clause ;
SSlash = ResMay.Sentence ; -- sentence missing NP; e.g. "she has looked at"
Imp = {s : Number => Polarity => Str} ; -- imperative e.g. "look at this"
--2 Questions and interrogatives
-- Constructed in QuestionMay.
QCl = ResMay.Clause ;
IComp = SS ; -- interrogative complement of copula e.g. "where"
IDet = ResMay.Determiner ; -- interrogative determiner e.g. "how many"
IQuant = ResMay.Quant ; -- interrogative quantifier e.g. "which"
IP = ResMay.NounPhrase ; -- interrogative pronoun e.g. "who"
--2 Subord clauses and pronouns
RCl = ResMay.Clause ;
RP = SS ;
--2 Verb phrases
-- Constructed in VerbMay.
VP = ResMay.VerbPhrase ;
VPSlash = ResMay.VPSlash ;
Comp = ResMay.VerbPhrase ;
--2 Adjectival phrases
-- Constructed in AdjectiveMay.
AP = ResMay.AdjPhrase ;
--2 Nouns and noun phrases
-- Constructed in NounMay.
-- Many atomic noun phrases e.g. "everybody"
-- are constructed in StructuralMay.
-- The determiner structure is
-- ``` Predet (QuantSg | QuantPl Num) Ord
-- as defined in NounMay.
CN = ResMay.CNoun ;
NP = ResMay.NounPhrase ;
Pron = ResMay.Pronoun ; --Pronouns need enough info to turn it into NP or Quant.
Det = ResMay.Determiner ;
Predet = SS ;
Quant = ResMay.Quant ;
Num = ResMay.Num ;
Ord = {
s : Str ; -- AForm => Str ; -- Ord can came from AP and become AP again
n : Number -- Ord can come from Num, which has inherent number
} ;
DAP = ResMay.Determiner ;
--2 Numerals
-- Constructed in NumeralMay.
Card = ResMay.Num ;
Numeral = ResMay.Numeral ;
Digits = {s : CardOrd => Str ; n : Number} ;
--2 Structural words
-- Constructed in StructuralMay.
Conj = {s2 : Bool => Str ; s1 : Str ; n : Number } ;
Subj = SS ;
Prep = ResMay.Preposition ;
--2 Words of open classes
-- These are constructed in LexiconMay and in
-- additional lexicon modules.
-- TODO: eventually different lincats
VS, -- sentence-complement verb e.g. "claim"
VQ, -- question-complement verb e.g. "wonder"
VA, -- adjective-complement verb e.g. "look"
V = ResMay.Verb ;
VV, -- verb-phrase-complement verb e.g. "want"
V2A, -- verb with NP and AP complement e.g. "paint"
V2V, -- verb with NP and V complement e.g. "cause"
V2S, -- verb with NP and S complement e.g. "tell"
V2Q, -- verb with NP and Q complement e.g. "ask"
V2 = ResMay.Verb2 ;
V3 = ResMay.Verb3 ;
A = ResMay.Adjective ;
A2 = ResMay.Adjective2 ;
N = ResMay.Noun ;
N2 = ResMay.Noun2 ;
N3 = ResMay.Noun3 ;
PN = ResMay.PNoun ;
}

View File

@@ -0,0 +1,97 @@
concrete ConjunctionMay of Conjunction =
CatMay ** open ResMay, Coordination, Prelude in {
flags optimize=all_subs ;
{- Conjunction for category X needs four things:
lincat [X]
lin BaseX
lin ConsX
lin ConjX
For example, if X is defined as
lincat X = {s : Number => Str ; g : Gender} ;
then [X] will split its s field into two, and retain its other fields as is:
lincat [X] = {s1,s2 : Number => Str ; g : Gender} ;
Let us look at a simple case: Adv is of type {s : Str}
Then [Adv] is {s1,s2 : Str}.
BaseAdv, ConsAdv and ConjAdv can all use functions defined in prelude/Coordination:
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
ConjAdv = conjunctSS ;
--}
-- Adverb and other simple {s : Str} types.
lincat
[Adv],[AdV],[IAdv] = {s1,s2 : Str} ;
lin
BaseAdv, BaseAdV, BaseIAdv = twoSS ;
ConsAdv, ConsAdV, ConsIAdv = consrSS comma ;
ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ;
{-
-- RS depends on X, Y and Z, otherwise exactly like previous.
-- RS can modify CNs, which are open for …, and have inherent …
lincat
[RS] = {s1,s2 : … => Str} ;
lin
BaseRS = twoTable3 … ;
ConsRS = consrTable3 … comma ;
ConjRS = conjunctRSTable ;
lincat
[S] = {} ;
lin
BaseS x y = y ** { } ;
ConsS x xs =
xs ** { } ;
ConjS co xs = {} ;
lincat
[AP] = {} ;
lin
BaseAP x y = twoTable … x y ** y ; --choose all the other fields from second argument
ConsAP as a = consrTable … comma as a ** as ;
ConjAP co as = conjunctDistrTable … co as ** as ;
lincat
[CN] = { } ;
lin
BaseCN = {} ;
ConsCN = {} ;
ConjCN co cs = conjunctDistrTable Agr co cs ** cs ;
lincat
[DAP] =
lin
BaseDAP x y = x **
ConsDAP xs x = xs **
ConjDet conj xs = xs **
-- Noun phrases
lincat
[NP] =
lin
BaseNP x y =
ConsNP x xs =
ConjNP conj xs =
-}
}

View File

@@ -0,0 +1,119 @@
concrete ConstructionMay of Construction = CatMay ** open ParadigmsMay in {
lincat
Timeunit = N ;
Weekday = N ;
Monthday = NP ;
Month = N ;
Year = NP ;
{-
lin
timeunitAdv n time =
let n_card : Card = n ;
n_hours_NP : NP = mkNP n_card time ;
in SyntaxMay.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ;
weekdayPunctualAdv w = ; -- on Sunday
weekdayHabitualAdv w = ; -- on Sundays
weekdayNextAdv w = -- next Sunday
weekdayLastAdv w = -- last Sunday
monthAdv m = mkAdv in_Prep (mkNP m) ;
yearAdv y = mkAdv in_Prep y ;
dayMonthAdv d m = ; -- on 17 May
monthYearAdv m y = ; -- in May 2012
dayMonthYearAdv d m y = ; -- on 17 May 2013
intYear = symb ;
intMonthday = symb ;
lincat Language = N ;
lin InLanguage l = mkAdv ???_Prep (mkNP l) ;
lin
weekdayN w = w ;
monthN m = m ;
weekdayPN w = mkPN w ;
monthPN m = mkPN m ;
languageCN l = mkCN l ;
languageNP l = mkNP l ;
oper mkLanguage : Str -> N = \s -> mkN s ;
----------------------------------------------
---- lexicon of special names
lin second_Timeunit = mkN "second" ;
lin minute_Timeunit = mkN "minute" ;
lin hour_Timeunit = mkN "hour" ;
lin day_Timeunit = mkN "day" ;
lin week_Timeunit = mkN "week" ;
lin month_Timeunit = mkN "month" ;
lin year_Timeunit = mkN "year" ;
lin monday_Weekday = mkN "Monday" ;
lin tuesday_Weekday = mkN "Tuesday" ;
lin wednesday_Weekday = mkN "Wednesday" ;
lin thursday_Weekday = mkN "Thursday" ;
lin friday_Weekday = mkN "Friday" ;
lin saturday_Weekday = mkN "Saturday" ;
lin sunday_Weekday = mkN "Sunday" ;
lin january_Month = mkN "January" ;
lin february_Month = mkN "February" ;
lin march_Month = mkN "March" ;
lin april_Month = mkN "April" ;
lin may_Month = mkN "May" ;
lin june_Month = mkN "June" ;
lin july_Month = mkN "July" ;
lin august_Month = mkN "August" ;
lin september_Month = mkN "September" ;
lin october_Month = mkN "October" ;
lin november_Month = mkN "November" ;
lin december_Month = mkN "December" ;
lin afrikaans_Language = mkLanguage "Afrikaans" ;
lin amharic_Language = mkLanguage "Amharic" ;
lin arabic_Language = mkLanguage "Arabic" ;
lin bulgarian_Language = mkLanguage "Bulgarian" ;
lin catalan_Language = mkLanguage "Catalan" ;
lin chinese_Language = mkLanguage "Chinese" ;
lin danish_Language = mkLanguage "Danish" ;
lin dutch_Language = mkLanguage "Dutch" ;
lin english_Language = mkLanguage "Euslish" ;
lin estonian_Language = mkLanguage "Estonian" ;
lin finnish_Language = mkLanguage "Finnish" ;
lin french_Language = mkLanguage "French" ;
lin german_Language = mkLanguage "German" ;
lin greek_Language = mkLanguage "Greek" ;
lin hebrew_Language = mkLanguage "Hebrew" ;
lin hindi_Language = mkLanguage "Hindi" ;
lin japanese_Language = mkLanguage "Japanese" ;
lin italian_Language = mkLanguage "Italian" ;
lin latin_Language = mkLanguage "Latin" ;
lin latvian_Language = mkLanguage "Latvian" ;
lin maltese_Language = mkLanguage "Maltese" ;
lin nepali_Language = mkLanguage "Nepali" ;
lin norwegian_Language = mkLanguage "Norwegian" ;
lin persian_Language = mkLanguage "Persian" ;
lin polish_Language = mkLanguage "Polish" ;
lin punjabi_Language = mkLanguage "Punjabi" ;
lin romanian_Language = mkLanguage "Romanian" ;
lin russian_Language = mkLanguage "Russian" ;
lin sindhi_Language = mkLanguage "Sindhi" ;
lin spanish_Language = mkLanguage "Spanish" ;
lin swahili_Language = mkLanguage "Swahili" ;
lin swedish_Language = mkLanguage "Swedish" ;
lin thai_Language = mkLanguage "Thai" ;
lin turkish_Language = mkLanguage "Turkish" ;
lin urdu_Language = mkLanguage "Urdu" ;
—}
}
-}
}

8
src/malay/ExtendMay.gf Normal file
View File

@@ -0,0 +1,8 @@
--# -path=.:../common:../abstract
concrete ExtendMay of Extend = CatMay
-- ** ExtendFunctor - []
-- with (Grammar=GrammarMay)
** open Prelude, ResMay, NounMay in {
} ;

24
src/malay/GrammarMay.gf Normal file
View File

@@ -0,0 +1,24 @@
concrete GrammarMay of Grammar =
NounMay,
VerbMay,
AdjectiveMay,
AdverbMay,
NumeralMay,
SentenceMay,
QuestionMay,
RelativeMay,
ConjunctionMay,
PhraseMay,
TextX,
StructuralMay,
IdiomMay,
TenseX - [AAnter, PNeg]
** open ParamX in {
flags startcat = Phr ;
lin
AAnter = {s = "sudah" ; a = ParamX.Anter} ;
PNeg = {s = "tidak" ; p = ParamX.Neg} ;
} ;

47
src/malay/IdiomMay.gf Normal file
View File

@@ -0,0 +1,47 @@
--1 Idiom: Idiomatic Expressions
concrete IdiomMay of Idiom = CatMay ** open Prelude, ResMay, VerbMay, NounMay, StructuralMay in {
-- This module defines constructions that are formed in fixed ways,
-- often different even in closely related languages.
{- lin
-- ImpersCl : VP -> Cl ; -- it is hot
-- GenericCl : VP -> Cl ; -- one sleeps
ImpersCl,
GenericCl = \vp -> predVP impersNP (passVP vp) ;
CleftNP : NP -> RS -> Cl ; -- it is I who did it
CleftAdv : Adv -> S -> Cl ; -- it is here she slept
-- : NP -> Cl ; -- there is a house
ExistNP np =
ExistIP : IP -> QCl ; -- which houses are there
-- 7/12/2012 generalizations of these
ExistNPAdv : NP -> Adv -> Cl ; -- there is a house in Paris
ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris
-- : VP -> VP ;
ProgrVP vp = vp ** {
} ;
-- : VP -> Utt ; -- let's go
ImpPl1 vp = { } ;
ImpP3 : NP -> VP -> Utt ; -- let John walk
-- 3/12/2013 non-reflexive uses of "self"
SelfAdvVP : VP -> VP ; -- is at home himself
SelfAdVVP : VP -> VP ; -- is himself at home
SelfNP : NP -> NP ; -- the president himself (is at home)
-}
}

4
src/malay/LangMay.gf Normal file
View File

@@ -0,0 +1,4 @@
concrete LangMay of Lang =
GrammarMay,
LexiconMay,
ConstructionMay ;

418
src/malay/LexiconMay.gf Normal file
View File

@@ -0,0 +1,418 @@
concrete LexiconMay of Lexicon = CatMay **
open ParadigmsMay, ResMay in {
----
-- A
-- lin add_V3 = mkV3 "" ;
-- lin airplane_N = mkN "" ;
-- lin alas_Interj = mkInterj "" ;
-- lin already_Adv = mkA "" ;
-- lin animal_N = mkN "동물" ;
-- lin answer_V2S = mkV2S "" ;
-- lin apartment_N = mkN "" ;
-- lin apple_N = mkN "" ;
-- lin art_N = mkN "" ;
-- lin ashes_N = mkN "" ;
-- lin ask_V2Q = mkV2 "" ;
----
-- B
-- lin baby_N = mkN "" ;
-- lin back_N = mkN "" ;
-- lin bad_A = mkA "" ;
-- lin bank_N = mkN "" ;
-- lin bark_N = mkN "" ;
-- lin beautiful_A = mkA "" ;
-- lin become_VA = mkVA "" ;
-- lin beer_N = mkN "" ;
-- lin beg_V2V = mkV2 "" ;
-- lin belly_N = mkN "" ;
-- lin big_A = mkA "" ;
-- lin bike_N = mkN "" ;
-- lin bird_N = mkN "" ;
-- lin bite_V2 = mkV2 "" ;
-- lin black_A = mkA "" ;
-- lin blood_N = mkN "" ;
-- lin blow_V = mkV "" ;
-- lin blue_A = mkA "" ;
-- lin boat_N = mkN "" ;
-- lin bone_N = mkN "" ;
-- lin boot_N = mkN "" ;
-- lin boss_N = mkN "" ;
lin book_N = mkN "buku" ;
-- lin boy_N = mkN "" ;
-- lin bread_N = mkN "" ;
-- lin break_V2 = mkV2 "" ;
-- lin breast_N = mkN "" ;
-- lin breathe_V = mkV "" ;
-- lin broad_A = mkA "" ;
-- lin brother_N2 = mkN "" ;
-- lin brown_A = mkA "" ;
-- lin burn_V = mkV "" ;
-- lin butter_N = mkN "" ;
-- lin buy_V2 = mkV2 "" ;
----
-- C
-- lin camera_N = mkN "" ;
-- lin cap_N = mkN "" ;
-- lin car_N = mkN "" ;
-- lin carpet_N = mkN "" ;
lin cat_N = mkN "kucing" ;
-- lin ceiling_N = mkN "" ;
-- lin chair_N = mkN "" ;
-- lin cheese_N = mkN "" ;
-- lin child_N = mkN "" ;
-- lin church_N = mkN "" ;
-- lin city_N = mkN "" ;
-- lin clean_A = mkA "" ;
-- lin clever_A = mkA "" ;
-- lin close_V2 = mkV2 "" ;
-- lin cloud_N = mkN "" ;
-- lin coat_N = mkN "" ;
-- lin cold_A = mkA "" ;
-- lin come_V = mkV "" ;
-- lin computer_N = mkN "" ;
-- lin correct_A = mkA "" ;
-- lin count_V2 = mkV2 "" ;
-- lin country_N = mkN "" ;
-- lin cousin_N = mkN "" ;
-- lin cow_N = mkN "" ;
-- lin cut_V2 = mkV2 "" ;
--
-- ----
-- -- D
--
-- lin day_N = mkN "" ;
-- lin die_V = mkV "" ;
-- lin dig_V = mkV "" ;
-- lin dirty_A = mkA "" ;
-- lin distance_N3 = mkN "" ;
-- lin do_V2 = lin V2 egin_V ;
-- lin doctor_N = mkN "" ;
lin dog_N = mkN "anjing" ;
-- lin door_N = mkN "" ;
-- lin drink_V2 = mkV2 "" ;
-- lin dry_A = mkA "" ;
-- lin dull_A = mkA "" ;
-- lin dust_N = mkN "" ;
----
-- E
-- lin ear_N = mkN "" ;
-- lin earth_N = mkN "" ;
-- lin eat_V2 = mkV2 "" ;
-- lin egg_N = mkN "" ;
-- lin empty_A = mkA "" ;
-- lin enemy_N = mkN "" ;
-- lin eye_N = mkN "" ;
----
-- F
-- lin factory_N = mkN "" ;
-- lin fall_V = mkV "" ;
-- lin far_Adv = mkA "" ;
-- lin fat_N = mkN "" ;
-- lin father_N2 = mkN2 "" ;
-- lin fear_V2 = mkV2 "" ;
-- lin fear_VS = mkVS "" ;
-- lin feather_N = mkN "" ;
-- lin fight_V2 = mkV2 "" ;
-- lin find_V2 = mkV2 "" ;
-- lin fingernail_N = mkN "" ;
-- lin fire_N = mkN "" ;
-- lin fish_N = mkN "" ;
-- lin float_V = mkV "" ;
-- lin floor_N = mkN "" ;
-- lin flow_V = mkV "" ;
-- lin flower_N = mkN "" ;
-- lin fly_V = mkV "" ;
-- lin fog_N = mkN "" ;
-- lin foot_N = mkN "" ;
-- lin forest_N = mkN "" ;
-- lin forget_V2 = mkV2 "" ;
-- lin freeze_V = mkV "" ;
-- lin fridge_N = mkN "" ;
-- lin friend_N = mkN "" ;
-- lin fruit_N = mkN "" ;
-- lin full_A = mkA "" ;
-- --lin fun_AV
----
-- G
-- lin garden_N = mkN "" ;
-- lin girl_N = mkN "" ;
-- lin give_V3 = mkV3 "" ;
-- lin glove_N = mkN "" ;
lin go_V = mkV "pergi" ;
-- lin gold_N = mkN "" ;
-- lin good_A = mkA "" ;
-- lin grammar_N = mkN "" ;
-- lin grass_N = mkN "" ;
lin green_A = mkA "hijau" ;
----
-- H
-- lin hair_N = mkN "" ;
-- lin hand_N = mkN "" ;
-- lin harbour_N = mkN "" ;
-- lin hat_N = mkN "" ;
-- lin hate_V2 = mkV2 "" ;
-- lin head_N = mkN "" ;
-- lin hear_V2 = mkV2 "" ;
-- lin heart_N = mkN "" ;
-- lin heavy_A = mkA "" ;
-- lin hill_N = mkN "" ;
-- lin hit_V2 = mkV2 "" ;
-- lin hold_V2 = mkV2 "" ;
-- lin hope_VS = mkV "" ;
-- lin horn_N = mkN "" ;
-- lin horse_N = mkN "" ;
-- lin hot_A = mkA "" ;
lin house_N = mkN "rumah" ;
-- lin hunt_V2 = mkV2 "" ;
-- lin husband_N = mkN "" ;
--------
-- I - K
-- lin ice_N = mkN "" ;
-- lin industry_N = mkN "" ;
-- lin iron_N = mkN "" ;
-- lin john_PN = mkPN "" ;
-- lin jump_V = mkV "" ;
-- lin kill_V2 = mkV2 "" ;
-- lin king_N = mkN "" ;
-- lin knee_N = mkN "" ;
-- lin know_V2 = mkV2 "" ;
-- lin know_VQ = mkVQ "" ;
-- lin know_VS = mkV "" ;
----
-- L
-- lin lake_N = mkN "" ;
-- lin lamp_N = mkN "" ;
-- lin language_N = mkN "" ;
-- lin laugh_V = mkV "" ;
-- lin leaf_N = mkN "" ;
lin learn_V2 = mkV2 "ajar" Ber ;
-- lin leather_N = mkN "" ;
-- lin leave_V2 = mkV2 "" ;
-- lin leg_N = mkN "" ;
-- lin lie_V = mkV "" ;
-- lin like_V2 = mkV2 "" ;
-- lin listen_V2 = mkV2 "" ;
-- lin live_V = mkV "";
-- lin liver_N = mkN "" ;
-- lin long_A = mkA "" ;
-- lin lose_V2 = mkV2 "" ;
-- lin louse_N = mkN "" ;
-- lin love_N = mkN "" ;
-- lin love_V2 = mkV2 "" ;
----
-- M
-- lin man_N = mkN "" ;
-- lin married_A2 = mkA "" ;
-- lin meat_N = mkN "" ;
-- lin milk_N = mkN "" ;
-- lin moon_N = mkN "" ;
-- lin mother_N2 = mkN2 "" ;
-- lin mountain_N = mkN "" ;
-- lin mouth_N = mkN "" ;
-- lin music_N = mkN "" ;
----
-- N
-- lin name_N = mkN "" ;
-- lin narrow_A = mkA "" ;
-- lin near_A = mkA "" ;
-- lin neck_N = mkN "" ;
-- lin new_A = mkA "" ;
-- lin newspaper_N = mkN "" ;
-- lin night_N = mkN "" ;
-- lin nose_N = mkN "" ;
lin now_Adv = mkAdv "sekarang" ;
-- lin number_N = mkN "" ;
--
-- --------
-- -- O - P
--
--
-- lin oil_N = mkN "" ;
-- lin old_A = mkA "" ;
-- lin open_V2 = mkV2 "" ;
-- lin paint_V2A = mkV2A "" ;
-- lin paper_N = mkN "" ;
-- lin paris_PN = mkPN "Paris" ;
-- lin peace_N = mkN "" ;
-- lin pen_N = mkN "" ;
lin person_N = mkN "orang" ;
-- lin planet_N = mkN "" ;
-- lin plastic_N = mkN "" ;
-- lin play_V = mkV "" ;
-- lin policeman_N = mkN "" ;
-- lin priest_N = mkN "" ;
-- lin pull_V2 = mkV2 "" ;
-- lin push_V2 = mkV2 "" ;
-- lin put_V2 = mkV2 "" ;
--
-- --------
-- -- Q - R
--
-- lin queen_N = mkN "" ;
-- lin question_N = mkN "" ;
-- lin radio_N = mkN "" ;
-- lin rain_N = mkN "" ;
-- lin rain_V0 = mkV "" ;
-- lin read_V2 = mkV2 "" ;
-- lin ready_A = mkA "" ;
-- lin reason_N = mkN "" ;
-- lin red_A = mkA "" ;
-- lin religion_N = mkN "" ;
-- lin restaurant_N = mkN "" ;
-- lin river_N = mkN "" ;
-- lin road_N = mkN "" ;
-- lin rock_N = mkN "" ;
-- lin roof_N = mkN "" ;
-- lin root_N = mkN "" ;
-- lin rope_N = mkN "" ;
-- lin rotten_A = mkA "" ;
-- lin round_A = mkA "" ;
-- lin rub_V2 = mkV2 "" ;
-- lin rubber_N = mkN "" ;
-- lin rule_N = mkN "" ;
-- lin run_V = mkV "" ;
----
-- S
-- lin salt_N = mkN "" ;
-- lin sand_N = mkN "" ;
-- lin say_VS = mkVS "" ;
-- lin school_N = mkN "" ;
-- lin science_N = mkN "" ;
-- lin scratch_V2 = mkV2 "" ;
-- lin sea_N = mkN "" ;
-- lin see_V2 = mkV2 "" ;
-- lin seed_N = mkN "" ;
-- lin seek_V2 = mkV2 "" ;
-- lin sell_V3 = mkV3 "" ;
-- lin send_V3 = mkV3 "" ;
-- lin sew_V = mkV "" ;
-- lin sharp_A = mkA "" ;
-- lin sheep_N = mkN "" fem ;
-- lin ship_N = mkN "" ;
-- lin shirt_N = mkN "" ;
-- lin shoe_N = mkN "" ;
-- lin shop_N = mkN "" ;
-- lin short_A = mkA "" ;
-- lin silver_N = mkN "" ;
-- lin sing_V = mkV "" ;
-- lin sister_N = mkN "" ;
-- lin sit_V = mkV "" ;
-- lin skin_N = mkN "" ;
-- lin sky_N = mkN "" ;
-- lin sleep_V = mkV "" ;
lin small_A = mkA "kecil" ;
-- lin smell_V = mkV "" ;
-- lin smoke_N = mkN "" ;
-- lin smooth_A = mkA "" ;
-- lin snake_N = mkN "" ;
-- lin snow_N = mkN "" ;
-- lin sock_N = mkN "" ;
-- lin song_N = mkN "" ;
-- lin speak_V2 = mkV2 "" ;
-- lin spit_V = mkV "" ;
-- lin split_V2 = mkV2 "" ;
-- lin squeeze_V2 = mkV2 "" ;
-- lin stab_V2 = mkV2 "" ;
-- lin stand_V = mkV "" ;
-- lin star_N = mkN "" ;
-- lin steel_N = mkN "" ;
-- lin stick_N = mkN "" ;
-- lin stone_N = mkN "" ;
-- lin stop_V = mkV "" ;
-- lin stove_N = mkN "" ;
-- lin straight_A = mkA "" ;
-- lin student_N = mkN "" ;
-- lin stupid_A = mkA "" ;
-- lin suck_V2 = mkV2 "" ;
-- lin sun_N = mkN "" ;
-- lin swell_V = mkV "" ;
-- lin swim_V = mkV "" ;
----
-- T
-- lin table_N = mkN "" ;
-- lin tail_N = mkN "" ;
-- lin talk_V3 = mkV3 "" ;
lin teach_V2 = mkV2 "ajar" ;
-- lin teacher_N = mkN "" ;
-- lin television_N = mkN "" ;
-- lin thick_A = mkA "" ;
-- lin thin_A = mkA "" ;
-- lin think_V = mkV "" ;
-- lin throw_V2 = mkV2 "" ;
-- lin tie_V2 = mkV2 "" ;
-- lin today_Adv = mkA "" ;
-- lin tongue_N = mkN "" ;
-- lin tooth_N = mkN "" ;
-- lin train_N = mkN "" ;
-- lin travel_V = mkV "" ;
-- lin tree_N = mkN "" ;
-- lin turn_V = mkV "" ;
--------
-- U - V
-- lin ugly_A = mkA "" ;
-- lin uncertain_A = mkA "" ;
-- lin understand_V2 = mkV2 "" ;
-- lin university_N = mkN "" ;
-- lin village_N = mkN "" ;
-- lin vomit_V = mkV2 "" ;
--------
-- W - Y
-- lin wait_V2 = mkV2 "" ;
lin walk_V = mkV "jalan" ;
-- lin war_N = mkN "" ;
-- lin warm_A = mkA "" ;
-- lin wash_V2 = mkV2 "" ;
-- lin watch_V2 = mkV2 "" ;
-- lin water_N = mkNoun "" ;
-- lin wet_A = mkA "" ;
-- lin white_A = mkA "" ;
-- lin wide_A = mkA "" ;
-- lin wife_N = mkN "" ;
-- lin win_V2 = mkV2 "" ;
-- lin wind_N = mkN "" ;
-- lin window_N = mkN "" ;
-- lin wine_N = mkN "" ;
-- lin wing_N = mkN "" ;
-- lin wipe_V2 = mkV2 "" ;
-- lin woman_N = mkN "" ;
-- lin wonder_VQ = mkVQ "" ;
-- lin wood_N = mkN "" ;
-- lin worm_N = mkN "" ;
-- lin write_V2 = mkV2 "" ;
-- lin year_N = mkN "" ;
-- lin yellow_A = mkA "" ;
-- lin young_A = mkA "" ;
}

2
src/malay/MissingMay.gf Normal file
View File

@@ -0,0 +1,2 @@
resource MissingMay = open GrammarMay, SymbolMay, Prelude in {
}

193
src/malay/NounMay.gf Normal file
View File

@@ -0,0 +1,193 @@
concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
flags optimize=all_subs ;
lin
--2 Noun phrases
-- : Det -> CN -> NP
DetCN det cn = {
s = det.s ++ cn.s ! NF det.n Bare ; -- TODO add possessive determiners
p = P3
} ;
-- : PN -> NP ;
-- UsePN pn = pn ** {
-- } ;
-- : Pron -> NP ;
-- UsePron pron = pron ;
-- : Predet -> NP -> NP ; -- only the man
-- PredetNP predet np =
-- A noun phrase can also be postmodified by the past participle of a
-- verb, by an adverb, or by a relative clause
-- : NP -> V2 -> NP ; -- the man seen
-- PPartNP np v2 = np ** {
-- s = \\c => v2.s ! ??? ++ np.s ! c } ; ----
-- : NP -> Adv -> NP ; -- Paris today ; boys, such as ..
--AdvNP,ExtAdvNP = \np,adv -> np ** {} ;
-- : NP -> RS -> NP ; -- Paris, which is here
-- RelNP np rs = np ** {
-- } ;
-- Determiners can form noun phrases directly.
-- : Det -> NP ;
-- DetNP det = emptyNP ** {
-- } ;
-- MassNP : CN -> NP ;
-- MassNP cn = useN cn ** {
-- } ;
--2 Determiners
-- The determiner has a fine-grained structure, in which a 'nucleus'
-- quantifier and an optional numeral can be discerned.
-- : Quant -> Num -> Det ;
DetQuant quant num = quant ** {
n = num.n
} ;
-- : Quant -> Num -> Ord -> Det ; -- these five best
-- DetQuantOrd quant num ord =
-- let theseFive = DetQuant quant num in theseFive ** {
-- } ;
-- Whether the resulting determiner is singular or plural depends on the
-- cardinal.
-- All parts of the determiner can be empty, except $Quant$, which is
-- the "kernel" of a determiner. It is, however, the $Num$ that determines
-- the inherent number.
NumSg = baseNum ;
NumPl = baseNum ** {n = Pl} ;
-- : Card -> Num ;
-- NumCard card =
-- : Digits -> Card ;
-- NumDigits dig =
-- : Numeral -> Card ;
-- NumNumeral num
{-
-- : AdN -> Card -> Card ;
AdNum adn card = card ** { s = adn.s ++ card.s } ;
-- : Digits -> Ord ;
OrdDigits digs = digs ** { s = digs.s ! NOrd } ;
-}
-- : Numeral -> Ord ;
-- OrdNumeral num = num ** {
-- s = \\_ => num.ord
-- } ;
-- : A -> Ord ;
-- OrdSuperl a = {
-- s = \\af => "제일" ++ a.s ! af ;
-- n = Sg -- ?? is this meaningful?
-- } ;
-- One can combine a numeral and a superlative.
-- : Numeral -> A -> Ord ; -- third largest
-- OrdNumeralSuperl num a = num ** { } ;
-- : Quant
DefArt = baseQuant ** {sp = \\_ => []} ;
-- : Quant
IndefArt = baseQuant ** {sp = \\_ => []} ;
-- : Pron -> Quant
-- PossPron pron =
-- let p = pron.poss ;
-- in DefArt ** {
-- } ;
--2 Common nouns
-- : N -> CN
-- : N2 -> CN ;
UseN,UseN2 = ResMay.useN ;
-- : N2 -> NP -> CN ;
-- ComplN2 n2 np =
-- : N3 -> NP -> N2 ; -- distance from this city (to Paris)
-- ComplN3 n3 np =
-- : N3 -> N2 ; -- distance (from this city)
-- Use2N3 n3 = lin N2 n3 ** { c2 = n3.c3 } ;
-- : N3 -> N2 ; -- distance (to Paris)
-- Use3N3 n3 = lin N2 n3 ;
-- : AP -> CN -> CN
-- AdjCN ap cn = cn ** {
-- } ;
-- : CN -> RS -> CN ;
-- RelCN cn rs = cn ** {
-- } ;
{-
-- : CN -> Adv -> CN ;
AdvCN cn adv = cn ** { } ;
-- Nouns can also be modified by embedded sentences and questions.
-- For some nouns this makes little sense, but we leave this for applications
-- to decide. Sentential complements are defined in VerbMay.
-- : CN -> SC -> CN ; -- question where she sleeps
SentCN cn sc = cn ** { } ;
--2 Apposition
-- This is certainly overgenerating.
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
ApposCN cn np = cn ** { s = } ;
-}
--2 Possessive and partitive constructs
-- : PossNP : CN -> NP -> CN ;
-- PossNP cn np = cn ** {
-- } ;
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
-- PartNP cn np = cn ** {
-- } ;
{-
-- This is different from the partitive, as shown by many languages.
-- : Det -> NP -> NP ;
CountNP det np = np **
{ } ; -- Nonsense for DefArt or IndefArt
--3 Conjoinable determiners and ones with adjectives
-- : DAP -> AP -> DAP ; -- the large (one)
AdjDAP dap ap = dap ** { } ;
-- : Det -> DAP ; -- this (or that)
DetDAP det = det ;
-}
}

4
src/malay/NumeralMay.gf Normal file
View File

@@ -0,0 +1,4 @@
concrete NumeralMay of Numeral = CatMay [Numeral,Digits] **
open Prelude, ResMay, ParamMay in {
}

123
src/malay/ParadigmsMay.gf Normal file
View File

@@ -0,0 +1,123 @@
resource ParadigmsMay = open CatMay, ResMay, ParamMay, NounMay, Prelude in {
oper
--2 Parameters
--
-- To abstract over number, valency and (some) case names,
-- we define the following identifiers. The application programmer
-- should always use these constants instead of the constructors
-- defined in $ResSom$.
--2 Nouns
mkN : overload {
mkN : (noun : Str) -> N ; -- Predictable nouns
} ;
--2 Adjectives
mkA : overload {
mkA : (adj : Str) -> A ;
} ;
-- mkA2 : Str -> Prep -> A2 ;
--2 Verbs
-- Verbs
mkV : overload {
mkV : (root : Str) -> V ; -- Verb that takes meng as a active prefix
mkV : (root : Str) -> Prefix -> V -- Root and prefix
} ;
mkV2 : overload {
mkV2 : (root : Str) -> V2 ;
mkV2 : (root : Str) -> Prefix -> V -- Root and prefix
-- TODO prepositions
} ;
-- mkV3 : overload {
-- } ;
-- mkVV : overload {
-- } ;
--
-- mkVA : Str -> VA
-- = \s -> lin VA (regV s) ;
-- mkVQ : Str -> VQ
-- = \s -> lin VQ (regV s) ;
-- mkVS : Str -> VS
-- = \s -> lin VS (regV s) ;
--
-- mkV2A : Str -> V2A
-- = \s -> lin V2A (regV s ** {c2 = noPrep}) ;
-- mkV2V : Str -> V2V
-- = \s -> lin V2V (regV s ** {c2 = noPrep}) ;
-- mkV2Q : Str -> V2Q
-- = \s -> lin V2Q (regV s ** {c2 = noPrep}) ;
-----
--2 Structural categories
-- mkPrep = overload {
-- } ;
-- mkConj : (_,_ : Str) -> Number -> Conj = \s1,s2,num ->
-- lin Conj { s = s1 ; s2 = s2 } ;
-- mkSubj : Str -> Bool -> Subj = \s,b ->
-- lin Subj { } ;
mkAdv : Str -> Adv = \s -> lin Adv {s = s} ;
mkAdV : Str -> AdV = \s -> lin AdV {s = s} ;
mkAdA : Str -> AdA = \s -> lin AdA {s = s} ;
--.
-------------------------------------------------------------------------------
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
mkN = overload {
mkN : Str -> N = \s -> lin N (mkNoun s) ;
} ;
mkN2 = overload {
mkN2 : Str -> N2 = \s -> lin N2 (mkNoun s) ;
mkN2 : N -> N2 = \n -> lin N2 n ;
} ;
-- mkPN = overload {
-- } ;
mkA = overload {
mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ;
} ;
mkV = overload {
mkV : Str -> V = \v -> lin V (mkVerb v Meng) ;
mkV : Str -> Prefix -> V = \v,p -> lin V (mkVerb v p)
} ;
mkV2 = overload {
mkV2 : Str -> V2 = \v2 -> lin V2 (mkVerb v2 Meng) ;
mkV2 : Str -> Prefix -> V2 = \v2,p -> lin V2 (mkVerb v2 p)
} ;
--
-- mkV3 = overload {
-- } ;
--
-- mkVV = overload {
-- } ;
--------------------------------------------------------------------------------
}

136
src/malay/ParamMay.gf Normal file
View File

@@ -0,0 +1,136 @@
resource ParamMay = ParamX ** open Prelude in {
--------------------------------------------------------------------------------
-- Phonology
oper
v : pattern Str = #("a"|"e"|"i"|"o"|"u") ;
diphthong : pattern Str = #("ai"|"au"|"oi") ;
c : pattern Str = #("m"|"n"|"ny"|"ng"
|"p"|"b"|"t"|"d"|"k"|"g"
|"s"|"z"|"c"|"j"|"sy"
|"f"|"v"|"kh"|"gh"|"h"
|"l"|"r"
|"w"|"y") ;
-- not sure if needed anywhere, this is just my standard helper function.
voiced : Str -> Str = \s -> case s of {
"k" => "g" ; "t" => "d" ; "p" => "b" ;
"s" => "z" ; "c" => "j" ; "kh" => "gh" ;
_ => s } ;
--------------------------------------------------------------------------------
-- Morphophonology
prefix : Prefix -> Str -> Str = \p -> case p of {
Meng => prefixMeng ;
Ber => prefixBer
} ;
prefixMeng : Str -> Str = \makan -> case makan of {
(#v|"g"|"h") + _
=> "meng" + makan ; -- prefix meng: e.g. meng+atur
"k" + enal
=> "meng" + enal ; -- replace k with meng
"b" + _
=> "mem" + makan ; -- prefix mem: e.g. mem+beli
("p"|"f") + ikir
=> "mem" + ikir ; -- replace p/f with mem
("j"|"c"|"z"|"d") + _
=> "men" + makan ; -- prefix men: e.g. men+jadi
"t" + ipu
=> "men" + ipu ; -- replace t with men
"s" + alak
=> "meny" + alak ; -- replace s with meny
("r"|"l"|"w"|"y"|"m"|"n"|"ny"|"ng") + _
=> "me" + makan ; -- prefix me
-- We can throw an error
-- _ => Predef.error "Not a valid verb root" ;
-- or we can let it pass with some default allomorph
_ => "meng" + makan
} ;
prefixBer : Str -> Str = \jalan -> case jalan of {
-- Exception
"ajar" => "belajar" ;
-- Drop the r
(#c + "er" + _ -- be+kerja
|"r" + _ ) -- be+rehat
=> "be" + jalan ;
-- Default allomorph: ber
_ => "ber" + jalan
} ;
--------------------------------------------------------------------------------
-- Nouns
param
Possession = Bare | Poss Person ;
NForm = NF Number Possession ;
oper
poss2str : Possession -> Str = \p -> case p of {
Bare => [] ;
Poss P1 => "ku" ;
Poss P2 => "mu" ;
Poss P3 => "nya"
} ;
duplicate : Str -> Str = \s -> s + "-" + s ;
--------------------------------------------------------------------------------
-- Numerals
param
DForm = Indep | Attrib ;
CardOrd = NOrd | NCard ;
-- TODO see if this is needed
NumType = NoNum | IsDigit | IsNumber ;
oper
isNum : NumType -> Bool = \nt -> case nt of {
NoNum => False ;
_ => True
} ;
--------------------------------------------------------------------------------
-- Adjectives
param
AForm = TODOAdj ;
--------------------------------------------------------------------------------
-- Prepositions
--------------------------------------------------------------------------------
-- Verbs
param
VForm =
Root -- infinitive, imperative, …
| Active ;
Prefix =
Meng
| Ber
; -- TODO more
--------------------------------------------------------------------------------
-- Clauses
param
ClType = Statement | PolarQuestion | WhQuestion | Subord ;
}

29
src/malay/PhraseMay.gf Normal file
View File

@@ -0,0 +1,29 @@
concrete PhraseMay of Phrase = CatMay ** open Prelude, ResMay in {
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
UttS s = s ;
UttQS qs = qs ;
UttIAdv iadv = iadv ;
{-
UttImpSg pol imp =
UttImpPl pol imp =
UttImpPol = UttImpSg ;
UttIP ip = {s = ip.s ! } ;
UttNP np = {s = np.s ! } ;
UttVP vp = {s = } ;
UttAdv adv = {s = } ;
UttCN n = {s = } ;
UttCard n = {s = } ;
UttAP ap = { s = ap.s ! } ;
UttInterj i = i ;
-}
NoPConj = {s = []} ;
-- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ;
NoVoc = {s = []} ;
-- VocNP np = { s = "," ++ np.s ! … } ; -}
}

78
src/malay/QuestionMay.gf Normal file
View File

@@ -0,0 +1,78 @@
concrete QuestionMay of Question = CatMay ** open
Prelude, ResMay, ParadigmsMay, (VS=VerbMay), (NS=NounMay), (SS=StructuralMay) in {
-- A question can be formed from a clause ('yes-no question') or
-- with an interrogative.
{-
lin
-- : Cl -> QCl ;
QuestCl =
-- : IP -> VP -> QCl ;
QuestVP ip vp =
-- : IP -> ClSlash -> QCl ; -- whom does John love
QuestSlash ip cls =
-- : IAdv -> Cl -> QCl ; -- why does John walk
QuestIAdv iadv cls =
-- : IComp -> NP -> QCl ; -- where is John?
QuestIComp icomp np =
-- Interrogative pronouns can be formed with interrogative
-- determiners, with or without a noun.
-- : IDet -> CN -> IP ; -- which five songs
IdetCN idet cn = {contractSTM = False} ** NS.DetCN idet cn ;
-- : IDet -> IP ; -- which five
IdetIP idet = {contractSTM = False} ** NS.DetNP idet ;
-- They can be modified with adverbs.
-- : IP -> Adv -> IP ; -- who in Paris
--AdvIP = NS.AdvNP ;
-- Interrogative quantifiers have number forms and can take number modifiers.
-- : IQuant -> Num -> IDet ; -- which (five)
IdetQuant = NS.DetQuant ;
-- Interrogative adverbs can be formed prepositionally.
-- : Prep -> IP -> IAdv ; -- with whom
PrepIP prep ip = SS.prepIP prep (ip.s ! Abs) False ;
-- They can be modified with other adverbs.
-- : IAdv -> Adv -> IAdv ; -- where in Paris
-- AdvIAdv iadv adv =
-- Interrogative complements to copulas can be both adverbs and
-- pronouns.
-- : IAdv -> IComp ;
CompIAdv iadv = iadv ; -- where (is it)
-- : IP -> IComp ;
CompIP ip = {s = ip.s ! Abs} ; -- who (is it)
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
-- Wh questions with two or more question words require a new, special category.
cat
QVP ; -- buy what where
fun
ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what
AdvQVP : VP -> IAdv -> QVP ; -- lives where
AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where
QuestQVP : IP -> QVP -> QCl ; -- who buys what where
-}
}

27
src/malay/RelativeMay.gf Normal file
View File

@@ -0,0 +1,27 @@
concrete RelativeMay of Relative = CatMay ** open
ResMay, Prelude, (NS=NounMay), (SS=StructuralMay) in {
lin
-- : Cl -> RCl ; -- such that John loves her
-- RelCl cl = ;
-- : RP -> VP -> RCl ;
RelVP rp vp = {
subj = rp.s ;
pred = vp.s ! Root ; -- TODO
} ;
-- : RP -> ClSlash -> RCl ; -- whom John loves
-- RelSlash rp cls =
-- : RP ;
IdRP = {s = "yang"} ;
-- Mintz page 49: Saya jumpa orang /yang kaki+nya/ patah.
-- 'I met a man /whose foot/ was broken.'
-- : Prep -> NP -> RP -> RP ; -- the mother of whom
-- FunRP prep np rp = {} ;
}

159
src/malay/ResMay.gf Normal file
View File

@@ -0,0 +1,159 @@
resource ResMay = ParamMay ** open Prelude, Predef, ParamMay in {
--------------------------------------------------------------------------------
-- Nouns
oper
Noun : Type = {
s : NForm => Str
} ;
Noun2 : Type = Noun ; -- TODO eventually more parameters?
Noun3 : Type = Noun ;
CNoun : Type = Noun ** {
} ;
PNoun : Type = Noun ;
mkNoun : Str -> Noun = \anjing -> {
s = table {
NF Sg p => anjing + ParamMay.poss2str p ;
NF Pl p => duplicate anjing + ParamMay.poss2str p
}
} ;
useN : Noun -> CNoun = \n -> n ;
---------------------------------------------
-- NP
NounPhrase = {
s : Str ;
p : Person -- for relative clauses
} ;
--------------------------------------------------------------------------------
-- Pronouns
Pronoun : Type = NounPhrase ** {
-- poss : { -- for PossPron : Pron -> Quant
-- } ;
sp : NForm => Str ;
} ;
--------------------------------------------------------------------------------
-- Det, Quant, Card, Ord
BaseQuant : Type = {
s : Str ;
isPoss : Bool
} ;
Determiner : Type = BaseQuant ** {
sp : NForm => Str ;
n : Number ;
-- numtype : NumType ; -- number as in "5" or "Sg/Pl", often makes a difference in lots of things
} ;
Quant : Type = BaseQuant ** {
sp : NForm => Str ;
} ;
Num : Type = {
s : DForm => Str ; -- independent or attribute
n : Number
} ;
baseNum : Num = {
s = \\_ => [] ;
n = Sg ;
numtype = NoNum
} ;
Numeral : Type = Num ** {
ord : Str
} ;
baseQuant : BaseQuant = {
s = [] ;
isPoss = False ;
} ;
--------------------------------------------------------------------------------
-- Prepositions
Preposition : Type = {
s : Str ; -- dengan
obj : Person => Str -- dengan+nya -- needed in relative clauses to refer to the object
} ;
mkPrep : Str -> Preposition = \dengan -> {
s = dengan ;
obj = \\p => dengan + poss2str (Poss p)
} ;
--------------------------------------------------------------------------------
-- Adjectives
Adjective : Type = Verb ; -- TODO check if meaningful
Adjective2 : Type = Adjective ;
mkAdj : Str -> Adjective = \str -> {s = \\_ => str} ;
AdjPhrase : Type = Adjective ; -- ** {compar : Str} ;
--------------------------------------------------------------------------------
-- Verbs
Verb : Type = {
s : VForm => Str
} ;
Verb2 : Type = Verb ; --** {c2 : Preposition} ;
Verb3 : Type = Verb2 ; -- ** {c3 : Preposition} ;
-- VV : Type = Verb ** {vvtype : VVForm} ;
mkVerb : Str -> Prefix -> Verb = \str,p -> {
s = table {
Root => str ;
Active => prefix p str
}
} ;
copula : Verb = {s = \\_ => "ada"} ; -- TODO
------------------
-- Adv
Adverb : Type = SS ;
------------------
-- VP
VerbPhrase : Type = Verb ** {
-- vComp : Str-- Maybe needed later?
-- {subjunc : Str ; -- inflected verb complement
-- inf : Str ; -- infinitive verb complement
-- subcl : Str} -- clause complement
} ;
VPSlash : Type = Verb2 ;
useV : Verb -> VerbPhrase = \v -> v ** {
vComp = [] ; -- maybe needed later?
} ;
--------------------------------------------------------------------------------
-- Cl, S
Clause : Type = {subj, pred : Str} ;
Sentence : Type = {s : Str} ;
predVP : NounPhrase -> VerbPhrase -> Clause = \np,vp -> {
subj = np.s ;
pred = vp.s ! Active ; -- TODO
} ;
--------------------------------------------------------------------------------
-- linrefs
}

83
src/malay/SentenceMay.gf Normal file
View File

@@ -0,0 +1,83 @@
concrete SentenceMay of Sentence = CatMay ** open
TenseX, ResMay, (AK=AdverbMay), Prelude in {
flags optimize=all_subs ;
lin
--2 Clauses
-- : NP -> VP -> Cl
PredVP = predVP ;
-- : SC -> VP -> Cl ; -- that she goes is good (Saeed p. 94)
--PredSCVP sc vp = ;
--2 Clauses missing object noun phrases
-- : NP -> VPSlash -> ClSlash ;
SlashVP = predVP ;
{-
-- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today
AdvSlash cls adv = cls ** insertAdv adv cls ;
-- SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks
-- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
-- SlashVS np vs ss = {} ;
-- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
UseSlash t p cls = {
} ;
--2 Imperatives
-- : VP -> Imp ;
ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ;
--2 Embedded sentences
-- : S -> SC ;
EmbedS s = {s = s.s ! True} ; -- choose subordinate
-- : QS -> SC ;
-- EmbedQS qs = { } ;
-- : VP -> SC ;
EmbedVP vp = {s = infVP vp} ;
-}
--2 Sentences
-- : Temp -> Pol -> Cl -> S ;
UseCl t p cl = {
s = cl.subj ++ t.s ++ p.s ++ cl.pred ;
} ;
-- : Temp -> Pol -> QCl -> QS ;
UseQCl t p cl = {
s = cl.subj ++ t.s ++ p.s ++ cl.pred ;
} ;
-- : Temp -> Pol -> RCl -> RS ;
UseRCl t p cl = {
s = cl.subj ++ t.s ++ p.s ++ cl.pred ;
} ;
-- AdvS : Adv -> S -> S ; -- then I will go home
AdvS = advS "" ;
-- ExtAdvS : Adv -> S -> S ; -- next week, I will go home
ExtAdvS = advS (SOFT_BIND ++ ",");
-- : S -> Subj -> S -> S ;
-- SSubjS s1 subj s2 = AdvS (AK.SubjS subj s2) s1 ;
-- : S -> RS -> S ; -- she sleeps, which is good
-- RelS sent rs = advS {s = rs.s ! Sg3 Masc ++ SOFT_BIND ++ ","} sent ;
oper
advS : (comma : Str) -> Adverb -> S -> S = \comma,a,sent -> sent ** {
s = a.s ++ comma ++ sent.s
} ;
}

170
src/malay/StructuralMay.gf Normal file
View File

@@ -0,0 +1,170 @@
concrete StructuralMay of Structural = CatMay **
open Prelude, ResMay, (N=NounMay), ParadigmsMay in {
-------
-- Ad*
{-
lin almost_AdA = mkAdA "" ;
lin almost_AdN = ss "" ;
lin at_least_AdN = ss "" ;
lin at_most_AdN = ss "" ;
lin so_AdA = ss "" ;
lin too_AdA = ss "" ;
lin very_AdA = mkAdA "" ;
lin as_CAdv = { s = "" ; p = [] } ;
lin less_CAdv = { s = "" ; p = [] } ;
lin more_CAdv = { s = "" ; p = [] } ;
lin how_IAdv = ss "" :
lin how8much_IAdv = ss "" ;
lin when_IAdv = ss "" ;
lin where_IAdv = ss "" :
lin why_IAdv = ss "" :
lin always_AdV = ss "" ;
lin everywhere_Adv = ss "" ;
lin here7from_Adv = ss "" ;
lin here7to_Adv = ss "" ;
lin here_Adv = ss "" ;
lin quite_Adv = ss "" ;
lin somewhere_Adv = ss "" ;
lin there7from_Adv = ss "" ;
lin there7to_Adv = ss "" ;
lin there_Adv = ss "" ;
-}
-------
-- Conj
-- lin and_Conj = {s2 = table {x => "" ; y => ""} ; s1 = [] ; n = Pl} ;
-- lin or_Conj = {s2 = \\_ => "" ; s1 = [] ; n = Sg} ;
-- lin if_then_Conj = mkConj
-- lin both7and_DConj = mkConj "" "" pl ;
-- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ;
--
-- lin but_PConj = ss "" ;
-- lin otherwise_PConj = ss "" ;
-- lin therefore_PConj = ss "" ;
-----------------
-- *Det and Quant
{-
lin how8many_IDet = ;
lin all_Predet = {s = ""} ;
lin not_Predet = { s = "" } ;
lin only_Predet = { s = "" } ;
lin most_Predet = {s = ""} ;
lin every_Det = {s = ""} ;
lin few_Det = R.indefDet "" pl ;
lin many_Det = R.indefDet "" pl ;
lin much_Det = R.indefDet "" sg ;
lin somePl_Det =
lin someSg_Det =
lin no_Quant =
lin that_Quant =
lin this_Quant =
lin which_IQuant =
-----
-- NP
lin everybody_NP = defNP "" N.NumPl ;
lin everything_NP = defNP "" N.NumSg ;
lin nobody_NP = mkVerb; ""
lin nothing_NP = defNP "" N.NumSg ;
lin somebody_NP = defNP "" N.NumSg ;
lin something_NP = defNP "" N.NumSg ;
oper
defNP : Str -> Num -> NP = {} ;
-}
-------
-- Prep
-- lin above_Prep = mkPrep ""
-- lin after_Prep = mkPrep ""
-- lin before_Prep = mkPrep "" ;
-- lin behind_Prep = mkPrep "" ;
-- lin between_Prep = = mkPrep "" ;
-- lin by8agent_Prep = mkPrep ;
-- lin by8means_Prep = mkPrep ;
-- lin during_Prep = mkPrep ;
-- lin except_Prep = mkPrep ;
-- lin for_Prep = mkPrep ;
-- lin from_Prep = mkPrep "" ;
-- lin in8front_Prep = mkPrep "" ;
-- lin in_Prep = mkPrep "" ;
-- lin on_Prep = mkPrep "" ;
-- lin part_Prep = mkPrep ;
-- lin possess_Prep = mkPrep ;
-- lin through_Prep = mkPrep ;
-- lin to_Prep = mkPrep ;
-- lin under_Prep = mkPrep "" ;
-- lin with_Prep = mkPrep "" ;
-- lin without_Prep = mkPrep "" ;
-------
-- Pron
-- Pronouns are closed class, no constructor in ParadigmsMay.
-- it_Pron =
-- i_Pron =
-- youPol_Pron,
-- youSg_Pron =
-- he_Pron =
-- she_Pron =
-- we_Pron =
-- youPl_Pron =
-- they_Pron =
--lin whatPl_IP = ;
--lin whatSg_IP = :
--lin whoPl_IP = ;
--lin whoSg_IP = ;
-------
-- Subj
-- lin although_Subj =
-- lin because_Subj =
-- lin if_Subj =
-- lin that_Subj =
-- lin when_Subj =
------
-- Utt
lin language_title_Utt = ss "bahasa Melayu" ;
-- lin no_Utt = ss "" ;
-- lin yes_Utt = ss "" ;
-------
-- Verb
--lin have_V2 = mkV2 have_V ;
-- lin can8know_VV = can_VV ; -- can (capacity)
-- lin can_VV = mkVV "" ; -- can (possibility)
-- lin must_VV = mkVV "" ;
-- lin want_VV = mkVV "" subjunctive ;
------
-- Voc
{-
lin please_Voc = ss "" ;
-}
}

50
src/malay/SymbolMay.gf Normal file
View File

@@ -0,0 +1,50 @@
--# -path=.:../abstract:../common:../prelude
concrete SymbolMay of Symbol = CatMay **
open Prelude, ParadigmsMay, ResMay, (NS=NounMay) in {
lin
-- : Symb -> PN ; -- x
SymbPN i = mkPN i.s ;
-- : Int -> PN ; -- 27
IntPN i = mkPN i.s ;
-- : Float -> PN ; -- 3.14159
FloatPN i = mkPN i.s ;
-- : Card -> PN ; -- twelve [as proper name]
NumPN i = mkPN i.s ;
{-
lin
-- CNIntNP cn i = {} ;
-- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y
CNSymbNP det cn xs =
let cnSymb = cn ** { comp = cn.comp ++ xs.s }
in NS.DetCN det cnSymb ;
-- : CN -> Card -> NP ; -- level five ; level 5
CNNumNP cn i = NS.MassNP (cn ** { comp = cn.comp ++ i.s }) ;
-- : Symb -> S ;
SymbS sy = {s = } ;
-- : Symb -> Card ;
SymbNum sy = { s = sy.s ; n = Pl } ;
-- : Symb -> Ord ;
SymbOrd sy = { s =} ;
-}
lincat
Symb, [Symb] = SS ;
lin
MkSymb s = s ;
BaseSymb = infixSS "과" ; -- 와 after vowel. TODO make it a table.
ConsSymb = infixSS "," ;
}

119
src/malay/VerbMay.gf Normal file
View File

@@ -0,0 +1,119 @@
concrete VerbMay of Verb = CatMay ** open ResMay, AdverbMay, Prelude in {
lin
-----
-- VP
-- : V -> VP
UseV = ResMay.useV ;
-- : V2 -> VP ; -- be loved
-- PassV2 = ResMay.passV2 ;
-- : VPSlash -> VP ;
-- ReflVP = ResMay.insertRefl ;
-- : VV -> VP -> VP ;
-- ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of {
--
-- } ;
-- : VS -> S -> VP ;
-- ComplVS vs s =
-- let vps = useV vs ;
-- subord = SubjS {s=""} s ;
-- in vps ** {} ;
{-
-- : VQ -> QS -> VP ;
ComplVQ vq qs = ;
-- : VA -> AP -> VP ; -- they become red
ComplVA va ap = ResMay.insertComp (CompAP ap).s (useV va) ;
-}
--------
-- Slash
{-
-- : V2 -> VPSlash
SlashV2a = useVc ;
-- : V3 -> NP -> VPSlash ; -- give it (to her)
-- : V3 -> NP -> VPSlash ; -- give (it) to her
Slash2V3,
Slash3V3 = \v3 -> insertComp (useVc3 v3) ;
-- : V2S -> S -> VPSlash ; -- answer (to him) that it is good
SlashV2S v2s s =
-- : V2V -> VP -> VPSlash ; -- beg (her) to go
SlashV2V v2v vp = ;
-- : V2Q -> QS -> VPSlash ; -- ask (him) who came
SlashV2Q v2q qs = ;
-- : V2A -> AP -> VPSlash ; -- paint (it) red
-- : VPSlash -> NP -> VP
ComplSlash = insertComp ;
-}
{-
-- : VV -> VPSlash -> VPSlash ;
-- Just like ComplVV except missing subject!
SlashVV vv vps = ComplVV vv vps ** { missing = vps.missing ;
post = vps.post } ;
-- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
SlashV2VNP v2v np vps =
-}
-- : Comp -> VP ;
UseComp comp = comp ;
{-
-- : VP -> Adv -> VP ; -- sleep here
AdvVP = insertAdv ;
-- : VPSlash -> Adv -> VPSlash ; -- use (it) here
AdvVPSlash = insertAdv ;
-- : VP -> Adv -> VP ; -- sleep , even though ...
ExtAdvVP vp adv = ;
-- : AdV -> VP -> VP ; -- always sleep
AdVVP adv vp = vp ** {adv = adv} ;
-- : AdV -> VPSlash -> VPSlash ; -- always use (it)
AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ;
-}
-- : VP -> Prep -> VPSlash ; -- live in (it)
-- VPSlashPrep vp prep =
-- let adv = prepNP prep emptyNP
-- in insertAdv vp adv ;
--2 Complements to copula
-- Adjectival phrases, noun phrases, and adverbs can be used.
-- : AP -> Comp ;
CompAP ap = ap ;
-- : CN -> Comp ;
CompCN cn = {
s = \\_ => cn.s ! NF Sg Bare ;
} ;
-- NP -> Comp ;
CompNP np = {
s = \\_ => np.s ;
} ;
-- : Adv -> Comp ;
-- CompAdv adv = adv ;
-- : VP -- Copula alone;
--UseCopula = useV copula ;
}