diff --git a/examples/animal/Animals.gf b/examples/animal/Animals.gf new file mode 100644 index 000000000..33b56e740 --- /dev/null +++ b/examples/animal/Animals.gf @@ -0,0 +1,12 @@ +-- The Question grammar specialized to animals. + +abstract Animals = Questions ** { + + flags startcat=Phrase ; + + fun + -- a lexicon of animals and actions among them + Dog, Cat, Mouse, Lion, Zebra : Entity ; + Chase, Eat, See : Action ; +} + diff --git a/examples/animal/AnimalsEng.gf b/examples/animal/AnimalsEng.gf new file mode 100644 index 000000000..22942b735 --- /dev/null +++ b/examples/animal/AnimalsEng.gf @@ -0,0 +1,16 @@ +--# -path=.:present:prelude +--resource/english:resource/abstract:resource/../prelude + +concrete AnimalsEng of Animals = QuestionsEng ** + open LangEng, ParadigmsEng, IrregEng in { + + lin + Dog = regN "dog" ; + Cat = regN "cat" ; + Mouse = mk2N "mouse" "mice" ; + Lion = regN "lion" ; + Zebra = regN "zebra" ; + Chase = dirV2 (regV "chase") ; + Eat = dirV2 eat_V ; + See = dirV2 see_V ; +} diff --git a/examples/animal/AnimalsFre.gf b/examples/animal/AnimalsFre.gf new file mode 100644 index 000000000..5c09490a1 --- /dev/null +++ b/examples/animal/AnimalsFre.gf @@ -0,0 +1,15 @@ +--# -path=.:present:prelude + +concrete AnimalsFre of Animals = QuestionsFre ** + open LangFre, ParadigmsFre, IrregFre in { + + lin + Dog = regN "chien" masculine ; + Cat = regN "chat" masculine ; + Mouse = regN "souris" feminine ; + Lion = regN "lion" masculine ; + Zebra = regN "zèbre" masculine ; + Chase = dirV2 (regV "chasser") ; + Eat = dirV2 (regV "manger") ; + See = voir_V2 ; +} diff --git a/examples/animal/AnimalsSwe.gf b/examples/animal/AnimalsSwe.gf new file mode 100644 index 000000000..34275ae16 --- /dev/null +++ b/examples/animal/AnimalsSwe.gf @@ -0,0 +1,15 @@ +--# -path=.:present:prelude + +concrete AnimalsSwe of Animals = QuestionsSwe ** + open LangSwe, ParadigmsSwe, IrregSwe in { + + lin + Dog = regN "hund" utrum ; + Cat = mk2N "katt" "katter" ; + Mouse = mkN "mus" "musen" "möss" "mössen" ; + Lion = mk2N "lejon" "lejon" ; + Zebra = regN "zebra" utrum ; + Chase = dirV2 (regV "jaga") ; + Eat = dirV2 äta_V ; + See = dirV2 se_V ; +} diff --git a/examples/animal/Questions.gf b/examples/animal/Questions.gf new file mode 100644 index 000000000..bb25e785d --- /dev/null +++ b/examples/animal/Questions.gf @@ -0,0 +1,10 @@ +-- Simple questions and answers, in present tense. + +abstract Questions = { + cat + Phrase ; Entity ; Action ; + fun + Who : Action -> Entity -> Phrase ; -- who chases X + Whom : Entity -> Action -> Phrase ; -- whom does X chase + Answer : Entity -> Action -> Entity -> Phrase ; -- X chases Y +} diff --git a/examples/animal/QuestionsEng.gf b/examples/animal/QuestionsEng.gf new file mode 100644 index 000000000..8a4c5c406 --- /dev/null +++ b/examples/animal/QuestionsEng.gf @@ -0,0 +1,2 @@ +concrete QuestionsEng of Questions = QuestionsI with + (Lang = LangEng) ; diff --git a/examples/animal/QuestionsFre.gf b/examples/animal/QuestionsFre.gf new file mode 100644 index 000000000..dab23b2ba --- /dev/null +++ b/examples/animal/QuestionsFre.gf @@ -0,0 +1,2 @@ +concrete QuestionsFre of Questions = QuestionsI with + (Lang = LangFre) ; diff --git a/examples/animal/QuestionsI.gf b/examples/animal/QuestionsI.gf new file mode 100644 index 000000000..f1f549283 --- /dev/null +++ b/examples/animal/QuestionsI.gf @@ -0,0 +1,22 @@ +-- File generated by GF from QuestionsI.gfe +--# -resource=../../lib/resource-1.0/english/LangEng.gf + +-- to compile: gf -examples QuestionsI.gfe +-- or use directly gf putStrLn s >> error "resource file rejected") return egr - let parser cat = errVal ([],"No parse") . - optParseArgErrMsg (options [newMParser, firstCat cat, beVerbose]) gr + egr <- appIOE $ shellStateFromFiles (options [beSilent]) emptyShellState res + gr <- err (\s -> putStrLn s >> error "resource grammar rejected") + (return . firstStateGrammar) egr + let parser cat = + errVal ([],"No parse") . + optParseArgErrMsg (options [newMParser, firstCat cat, beVerbose]) gr let morpho = isKnownWord gr putStrLn "Building parser" mapM_ (mkConcrete parser morpho) files