diff --git a/lib/src/mini/Compile.hs b/lib/src/mini/Compile.hs new file mode 100644 index 000000000..84d7f6514 --- /dev/null +++ b/lib/src/mini/Compile.hs @@ -0,0 +1,45 @@ +import List +import System + +-- (c) Aarne Ranta 2010 under GNU LGPL + +-- Compile files into pgf, in chosen combinations. + +-- Usage: runghc Compile (-make | -link)? Eng Fre Fin ... +-- The -make option links all pgf files to one in the end +-- The -link option only links, without first compiling +-- Arguments whose length are 3 characters are prefixed with mainmodu. +-- Other arguments are passed literally. + +-- Thus, for instance, to produce an English-Swedish-Romanian phrasebook with English +-- disambiguation, the command is +-- +-- runghc Compile -link Eng Swe Ron DisambPhrasebookEng + + +-- change this to apply to another project; alternatively, just use full file names +mainmodu = "MiniGrammar" + +main = do + (opts,langs) <- getArgs >>= return . partition ((=='-') . head) + let modus = [mkFile la | la <- langs] + putStrLn $ unwords modus + if notElem "-link" opts + then mapM_ compileOne modus >> return () + else return () + case opts of + _ | elem "-make" opts || elem "-link" opts -> do + let comm = "gf -make -s " ++ unwords (map (++ ".pgf") modus) + putStrLn comm + system comm + return () + _ -> return () + +compileOne modu = do + let comm = "gf -make -s -optimize-pgf -name=" ++ + modu ++ " " ++ modu ++ ".gf" ++ + " +RTS -K32M" + putStrLn comm + system comm + +mkFile la = if length la == 3 then mainmodu ++ la else la diff --git a/lib/src/mini/Makefile b/lib/src/mini/Makefile index accbc4c5c..368e21abb 100644 --- a/lib/src/mini/Makefile +++ b/lib/src/mini/Makefile @@ -1,3 +1,5 @@ +compile = runghc Compile + all: src pgf src: @@ -8,3 +10,9 @@ pgf: src gf: src gf -batch MiniGrammar???.gf + +compdemo: + $(compile) Afr Bul Cat Dan Dut Eng Fin Fre Ger Ita Nep Nor Pnb Pes Pol Rus Spa Swe Tha Urd + +linkdemo: + $(compile) -link Afr Bul Cat Dan Dut Eng Fin Fre Ger Ita Nep Nor Pnb Pes Pol Rus Spa Swe Tha Urd diff --git a/lib/src/mini/MiniGrammar.gf b/lib/src/mini/MiniGrammar.gf index 6d7710358..5cedeed3c 100644 --- a/lib/src/mini/MiniGrammar.gf +++ b/lib/src/mini/MiniGrammar.gf @@ -108,7 +108,7 @@ abstract MiniGrammar = Lexicon, Grammar [ here_Adv, -- Adv, by_Prep, in_Prep, of_Prep, with_Prep, -- Prep, can_VV, must_VV, want_VV, -- VV, - although_Subj, because_Subj, when_Subj, -- Subj, + although_Subj, because_Subj, when_Subj, if_Subj, -- Subj, when_IAdv, where_IAdv, why_IAdv-- IAdv, ] ** { @@ -128,7 +128,7 @@ fun this_Det, these_Det : Det ; that_Det, those_Det : Det ; i_NP, youSg_NP, he_NP, she_NP, we_NP, youPl_NP, they_NP : NP ; --- SubjS : S -> Subj -> S -> S ; -- she walks because we run + SubjS : Subj -> S -> S -> Utt ; -- if she walks we run CompAdv : Adv -> VP ; -- be here -- SlashV2 : NP -> V2 -> ClSlash ; -- she loves SlashPrep : Cl -> Prep -> ClSlash ; -- she walks with diff --git a/lib/src/mini/MiniGrammarEng.gf b/lib/src/mini/MiniGrammarEng.gf index 73e22346e..355e39ba8 100644 --- a/lib/src/mini/MiniGrammarEng.gf +++ b/lib/src/mini/MiniGrammarEng.gf @@ -112,7 +112,7 @@ concrete MiniGrammarEng of MiniGrammar = LexiconEng, GrammarEng [ here_Adv, -- Adv, by_Prep, in_Prep, of_Prep, with_Prep, -- Prep, can_VV, must_VV, want_VV, -- VV, - although_Subj, because_Subj, when_Subj, -- Subj, + although_Subj, because_Subj, when_Subj, if_Subj, -- Subj, when_IAdv, where_IAdv, why_IAdv-- IAdv, ] ** open SyntaxEng, (S = SyntaxEng) in { @@ -139,7 +139,7 @@ lin we_NP = S.we_NP ; youPl_NP = S.youPl_NP ; they_NP = S.they_NP ; --- SubjS s subj s = mkS s (mkAdv subj s) ; + SubjS subj a b = mkUtt (mkS (S.mkAdv ) b) ; CompAdv adv = mkVP (lin Adv adv) ; -- SlashV2 np v2 = mkClSlash np v2 ; SlashPrep cl p = mkClSlash (lin Cl cl)

; diff --git a/lib/src/thai/LexiconTha.gf b/lib/src/thai/LexiconTha.gf index 489a61b43..a99c29e39 100644 --- a/lib/src/thai/LexiconTha.gf +++ b/lib/src/thai/LexiconTha.gf @@ -180,7 +180,7 @@ lin leaf_N = mkN (thword "ใบ") ; -- learn_V2 = dirV2 (regV "learn") ; -- leather_N = regN "leather" ; --- leave_V2 = dirV2 (irregV "leave" "left" "left") ; + leave_V2 = mkV2 "ละ" ; -- left_Ord = ss "left" ; leg_N = mkN (thword "ขา") ; lie_V = mkV (thword "นอน") ;