mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
options for no-pmcfg compilation in lib/src/Make.hs (for library developers, rather than users); adding Thai to some demo and documentation
This commit is contained in:
@@ -4,5 +4,8 @@ all:: Foods.pgf
|
|||||||
Foods.pgf: Foods???.gf
|
Foods.pgf: Foods???.gf
|
||||||
gf -make -s -optimize-pgf Foods???.gf
|
gf -make -s -optimize-pgf Foods???.gf
|
||||||
|
|
||||||
|
exper: Foods???.gf
|
||||||
|
gf -make -s -optimize-pgf Foods???.gf FoodsThai.gf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.gfo Foods.pgf
|
rm -rf *.gfo Foods.pgf
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ revealedLang = "Eng"
|
|||||||
|
|
||||||
-- all languages shown
|
-- all languages shown
|
||||||
apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words
|
apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words
|
||||||
"Afr Bul Cat Dan Dut Eng Fin Fre Ger Ita Nep Nor Pes Pnb Pol Ron Rus Spa Swe Urd"]
|
"Afr Bul Cat Dan Dut Eng Fin Fre Ger Ita Nep Nor Pes Pnb Pol Ron Rus Spa Swe Tha Urd"]
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
xx <- getArgs
|
xx <- getArgs
|
||||||
@@ -255,6 +255,7 @@ paradigmFiles = [
|
|||||||
("Russian", srcPath "/russian/ParadigmsRus.gf"),
|
("Russian", srcPath "/russian/ParadigmsRus.gf"),
|
||||||
("Spanish", srcPath "/spanish/ParadigmsSpa.gf"),
|
("Spanish", srcPath "/spanish/ParadigmsSpa.gf"),
|
||||||
("Swedish", srcPath "/swedish/ParadigmsSwe.gf"),
|
("Swedish", srcPath "/swedish/ParadigmsSwe.gf"),
|
||||||
|
("Thai", srcPath "/urdu/ParadigmsTha.gf")
|
||||||
("Urdu", srcPath "/urdu/ParadigmsUrd.gf")
|
("Urdu", srcPath "/urdu/ParadigmsUrd.gf")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import System.Environment
|
|||||||
import System.Exit
|
import System.Exit
|
||||||
|
|
||||||
-- Make commands for compiling and testing resource grammars.
|
-- Make commands for compiling and testing resource grammars.
|
||||||
-- usage: runghc Make ((present? OPT?) | (clone FILE))? LANGS?
|
-- usage: runghc Make (((present|alltenses)? OPT?) | (clone FILE))? LANGS?
|
||||||
-- where
|
-- where
|
||||||
-- - OPT = (lang | api | pgf | test | parse | clean | clone)
|
-- - OPT = (lang | api | pgf | test | parse | clean | clone)
|
||||||
-- - LANGS has the form e.g. langs=Eng,Fin,Rus
|
-- - LANGS has the form e.g. langs=Eng,Fin,Rus
|
||||||
@@ -72,13 +72,13 @@ langsLang = langs `except` langsIncomplete ---- []
|
|||||||
langsPresent = langsLang `except` ["Lav","Nep","Pes","Tha"]
|
langsPresent = langsLang `except` ["Lav","Nep","Pes","Tha"]
|
||||||
|
|
||||||
-- languages for which Lang can be compiled but which are incomplete
|
-- languages for which Lang can be compiled but which are incomplete
|
||||||
langsIncomplete = ["Amh","Ara","Hin","Lat","Tha","Tur"]
|
langsIncomplete = ["Amh","Ara","Hin","Lat","Tur"]
|
||||||
|
|
||||||
-- languages for which to compile Try
|
-- languages for which to compile Try
|
||||||
langsAPI = langsLang `except` langsIncomplete
|
langsAPI = langsLang `except` langsIncomplete
|
||||||
|
|
||||||
-- languages for which to compile Symbolic
|
-- languages for which to compile Symbolic
|
||||||
langsSymbolic = langsLang `except` (langsIncomplete ++ ["Afr","Ina","Lav","Nep","Pes","Pnb","Rus","Tha"])
|
langsSymbolic = langsLang `except` (langsIncomplete ++ ["Afr","Ina","Lav","Nep","Pes","Pnb","Rus"])
|
||||||
|
|
||||||
-- languages for which to compile minimal Syntax
|
-- languages for which to compile minimal Syntax
|
||||||
langsMinimal = langs `only` ["Ara","Eng","Bul","Rus"]
|
langsMinimal = langs `only` ["Ara","Eng","Bul","Rus"]
|
||||||
@@ -109,13 +109,19 @@ make :: [String] -> IO ()
|
|||||||
make xx = do
|
make xx = do
|
||||||
let ifx opt act = if null xx || elem opt xx then act >> return () else return ()
|
let ifx opt act = if null xx || elem opt xx then act >> return () else return ()
|
||||||
let ifxx opt act = if elem opt xx then act >> return () else return ()
|
let ifxx opt act = if elem opt xx then act >> return () else return ()
|
||||||
let pres = elem "present" xx
|
let pres
|
||||||
let dir = if pres then "../present" else "../alltenses"
|
| elem "present" xx = 1
|
||||||
|
| elem "alltenses" xx = 2
|
||||||
|
| otherwise = 0
|
||||||
|
let dir = case pres of
|
||||||
|
1 -> "../present"
|
||||||
|
2 -> "../alltenses"
|
||||||
|
_ -> "../full"
|
||||||
|
|
||||||
let optl ls = maybe ls id $ getOptLangs xx
|
let optl ls = maybe ls id $ getOptLangs xx
|
||||||
|
|
||||||
ifx "lang" $ do
|
ifx "lang" $ do
|
||||||
let lans = optl $ if pres then langsPresent else langsLang
|
let lans = optl $ if (pres == 1) then langsPresent else langsLang
|
||||||
mapM_ (gfc pres [] . lang) lans
|
mapM_ (gfc pres [] . lang) lans
|
||||||
mapM_ (gfc pres presSymbolPath . symbol) lans ---- (optl langsAPI)
|
mapM_ (gfc pres presSymbolPath . symbol) lans ---- (optl langsAPI)
|
||||||
copyl lans "*.gfo" dir
|
copyl lans "*.gfo" dir
|
||||||
@@ -148,7 +154,7 @@ make xx = do
|
|||||||
mapM_ (gfc pres [] . parse) (optl langsParse)
|
mapM_ (gfc pres [] . parse) (optl langsParse)
|
||||||
copy "parse/*.gfo parse/oald/*.gfo" dir
|
copy "parse/*.gfo parse/oald/*.gfo" dir
|
||||||
ifxx "clean" $ do
|
ifxx "clean" $ do
|
||||||
system "rm -f */*.gfo ../alltenses/*.gfo ../present/*.gfo"
|
system "rm -f */*.gfo ../alltenses/*.gfo ../present/*.gfo ../prelude/*.gfo ../full/*.gfo"
|
||||||
ifxx "clone" $ do
|
ifxx "clone" $ do
|
||||||
let (pref,lang) = case getLangName xx of
|
let (pref,lang) = case getLangName xx of
|
||||||
Just pl -> pl
|
Just pl -> pl
|
||||||
@@ -157,12 +163,15 @@ make xx = do
|
|||||||
mapM_ (\la -> writeFile (pref ++ la ++ ".gf") (replaceLang lang la s)) (map snd (optl langs))
|
mapM_ (\la -> writeFile (pref ++ la ++ ".gf") (replaceLang lang la s)) (map snd (optl langs))
|
||||||
return ()
|
return ()
|
||||||
|
|
||||||
|
-- pres = 0 (full), 1 (present), 2 (alltenses)
|
||||||
gfc pres ppath file = do
|
gfc pres ppath file = do
|
||||||
let preproc = if pres then "-preproc=mkPresent" else ""
|
let preproc = if (pres==1) then "-preproc=mkPresent" else ""
|
||||||
let path = if pres then ppath else ""
|
let path = if (pres==1) then ppath else ""
|
||||||
putStrLn $ "Compiling " ++ file
|
putStrLn $ "Compiling " ++ file
|
||||||
---- run_gfc ["-s","-src","-no-pmcfg",preproc, path, file]
|
if pres == 0
|
||||||
run_gfc ["-s","-src",preproc, path, file]
|
then run_gfc ["-s","-src",preproc, path, file]
|
||||||
|
else run_gfc ["-s","-src","-no-pmcfg",preproc, path, file]
|
||||||
|
|
||||||
|
|
||||||
gfcmin path file = do
|
gfcmin path file = do
|
||||||
let preproc = "-preproc=mkMinimal"
|
let preproc = "-preproc=mkMinimal"
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ RUNMAKE=$(RUNGHC) Make.hs
|
|||||||
|
|
||||||
GF_LIB_PATH=..
|
GF_LIB_PATH=..
|
||||||
|
|
||||||
.PHONY: all present alltenses lang api math prelude test demo parse synopsis link compiled constructX clean
|
.PHONY: all present alltenses full lang api math prelude test demo parse synopsis link compiled constructX clean
|
||||||
|
|
||||||
all: link prelude constructX present alltenses
|
all: link prelude constructX present alltenses full
|
||||||
|
|
||||||
present:
|
present:
|
||||||
$(RUNMAKE) present lang
|
$(RUNMAKE) present lang
|
||||||
@@ -13,15 +13,18 @@ present:
|
|||||||
$(RUNMAKE) present symbolic
|
$(RUNMAKE) present symbolic
|
||||||
|
|
||||||
alltenses:
|
alltenses:
|
||||||
|
$(RUNMAKE) alltenses lang
|
||||||
|
$(RUNMAKE) alltenses api
|
||||||
|
$(RUNMAKE) alltenses symbolic
|
||||||
|
|
||||||
|
full:
|
||||||
$(RUNMAKE) lang
|
$(RUNMAKE) lang
|
||||||
$(RUNMAKE) api
|
|
||||||
$(RUNMAKE) symbolic
|
|
||||||
|
|
||||||
lang:
|
lang:
|
||||||
$(RUNMAKE) lang
|
$(RUNMAKE) alltenses lang
|
||||||
|
|
||||||
api:
|
api:
|
||||||
$(RUNMAKE) api
|
$(RUNMAKE) alltenses api
|
||||||
|
|
||||||
compatibility:
|
compatibility:
|
||||||
$(RUNMAKE) present compat
|
$(RUNMAKE) present compat
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
--# -path=.:alltenses
|
|
||||||
|
|
||||||
abstract MiniGrammar = Lexicon, Grammar [
|
abstract MiniGrammar = Lexicon, Grammar [
|
||||||
|
|
||||||
-- the "mini" resource of GF book, chapter 9
|
-- the "mini" resource of GF book, chapter 9
|
||||||
@@ -130,9 +128,9 @@ fun
|
|||||||
this_Det, these_Det : Det ;
|
this_Det, these_Det : Det ;
|
||||||
that_Det, those_Det : Det ;
|
that_Det, those_Det : Det ;
|
||||||
i_NP, youSg_NP, he_NP, she_NP, we_NP, youPl_NP, they_NP : NP ;
|
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 : S -> Subj -> S -> S ; -- she walks because we run
|
||||||
CompAdv : Adv -> VP ; -- be here
|
CompAdv : Adv -> VP ; -- be here
|
||||||
SlashV2 : NP -> V2 -> ClSlash ; -- she loves
|
-- SlashV2 : NP -> V2 -> ClSlash ; -- she loves
|
||||||
SlashPrep : Cl -> Prep -> ClSlash ; -- she walks with
|
SlashPrep : Cl -> Prep -> ClSlash ; -- she walks with
|
||||||
AdvCN : CN -> Prep -> NP -> CN ; -- man in the city
|
AdvCN : CN -> Prep -> NP -> CN ; -- man in the city
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--# -path=.:alltenses
|
--# -path=.:full:alltenses
|
||||||
|
|
||||||
concrete MiniGrammarEng of MiniGrammar = LexiconEng, GrammarEng [
|
concrete MiniGrammarEng of MiniGrammar = LexiconEng, GrammarEng [
|
||||||
|
|
||||||
@@ -49,6 +49,7 @@ concrete MiniGrammarEng of MiniGrammar = LexiconEng, GrammarEng [
|
|||||||
TTAnt, -- Tense -> Ant -> Temp ;
|
TTAnt, -- Tense -> Ant -> Temp ;
|
||||||
PPos, PNeg, -- Pol,
|
PPos, PNeg, -- Pol,
|
||||||
TPres, TPast, TFut, TCond, -- Tense,
|
TPres, TPast, TFut, TCond, -- Tense,
|
||||||
|
STense, SCond, SFut, SPast, SPres, -- scand tense
|
||||||
ASimul, AAnter,
|
ASimul, AAnter,
|
||||||
|
|
||||||
and_Conj, or_Conj, -- Conj,
|
and_Conj, or_Conj, -- Conj,
|
||||||
@@ -122,7 +123,7 @@ lin
|
|||||||
ComplV2 v np = mkVP v np ;
|
ComplV2 v np = mkVP v np ;
|
||||||
ModCN ap cn = lin CN (mkCN <lin AP ap : AP> <lin CN cn : CN>) ;
|
ModCN ap cn = lin CN (mkCN <lin AP ap : AP> <lin CN cn : CN>) ;
|
||||||
CompAP ap = mkVP (lin AP ap) ;
|
CompAP ap = mkVP (lin AP ap) ;
|
||||||
ConjS co x y = mkS co x y ;
|
ConjS co x y = mkS (lin Conj co) (lin S x) (lin S y) ;
|
||||||
ConjAP co x y = mkAP co x y ;
|
ConjAP co x y = mkAP co x y ;
|
||||||
ConjNP co x y = mkNP co x y ;
|
ConjNP co x y = mkNP co x y ;
|
||||||
a_Det = mkDet a_Quant ;
|
a_Det = mkDet a_Quant ;
|
||||||
@@ -139,9 +140,8 @@ lin
|
|||||||
youPl_NP = S.youPl_NP ;
|
youPl_NP = S.youPl_NP ;
|
||||||
they_NP = S.they_NP ;
|
they_NP = S.they_NP ;
|
||||||
-- SubjS s subj s = mkS s (mkAdv subj s) ;
|
-- SubjS s subj s = mkS s (mkAdv subj s) ;
|
||||||
CompAdv adv = mkVP adv ;
|
CompAdv adv = mkVP (lin Adv adv) ;
|
||||||
-- SlashV2 np v2 = mkClSlash np v2 ;
|
-- SlashV2 np v2 = mkClSlash np v2 ;
|
||||||
SlashPrep cl p = mkClSlash cl p ;
|
SlashPrep cl p = mkClSlash (lin Cl cl) <p : Prep> ;
|
||||||
AdvCN cn p pp = mkCN <lin CN cn : CN> (mkAdv p pp) ;
|
AdvCN cn p pp = mkCN <lin CN cn : CN> (mkAdv <p : Prep> <pp : NP>) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
src = "Eng"
|
src = "Eng"
|
||||||
langs = ["Afr","Bul","Cat","Dan","Dut","Fin","Fre","Ger","Ita",
|
langs = [
|
||||||
"Nep","Nor","Pes","Pol","Pnb","Ron","Rus","Spa","Swe","Urd"]
|
"Afr", "Bul", "Cat","Dan","Dut",
|
||||||
|
"Fin","Fre","Ger","Ita", -- "Lav",
|
||||||
|
"Nep","Nor","Pes","Pol","Pnb",
|
||||||
|
--- "Ron",
|
||||||
|
"Rus","Spa","Swe","Tha",
|
||||||
|
"Urd"
|
||||||
|
]
|
||||||
|
|
||||||
file lng = "MiniGrammar" ++ lng ++ ".gf"
|
file lng = "MiniGrammar" ++ lng ++ ".gf"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user