From e7439d65b0e153434d3acc07df6e2a0972ee79ca Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 11 Jan 2011 15:46:43 +0000 Subject: gf-book web page index and toc --- book/examples/chapter2/Copy.gf | 7 - book/examples/chapter2/CopyAbs.gf | 6 - book/examples/chapter2/Food.gf | 13 -- book/examples/chapter2/Food.probs | 4 - book/examples/chapter2/FoodEng.gf | 19 -- book/examples/chapter2/FoodHin.gf | 24 --- book/examples/chapter2/FoodIta.gf | 19 -- book/examples/chapter2/Letters.gf | 8 - book/examples/chapter2/LettersCnc.gf | 31 --- book/examples/chapter2/Strings.gf | 7 - book/examples/chapter2/StringsBW.gf | 5 - book/examples/chapter2/StringsFW.gf | 5 - book/examples/chapter2/Ticket.gf | 10 - book/examples/chapter2/TicketEng.gf | 19 -- book/examples/chapter2/foodEng.cf | 14 -- book/examples/chapter2/foodIta.cf | 14 -- book/examples/chapter3/Arabic.gf | 118 ------------ book/examples/chapter3/Discont.gf | 11 -- book/examples/chapter3/DiscontEng.gf | 21 -- book/examples/chapter3/Foods.gf | 13 -- book/examples/chapter3/FoodsEng.gf | 40 ---- book/examples/chapter3/FoodsIta.gf | 32 ---- book/examples/chapter3/ResIta.gf | 36 ---- book/examples/chapter4/Clothes.gf | 5 - book/examples/chapter4/ClothesEng.gf | 10 - book/examples/chapter4/ClothesIta.gf | 8 - book/examples/chapter4/Comment.gf | 13 -- book/examples/chapter4/Comments.gf | 10 - book/examples/chapter4/CommentsEng.gf | 4 - book/examples/chapter4/CommentsI.gf | 15 -- book/examples/chapter4/CommentsIta.gf | 4 - book/examples/chapter4/Computers.gf | 5 - book/examples/chapter4/ComputersEng.gf | 10 - book/examples/chapter4/ComputersIta.gf | 9 - book/examples/chapter4/DefArtGer.gf | 16 -- book/examples/chapter4/Foods.gf | 6 - book/examples/chapter4/FoodsEng.gf | 16 -- book/examples/chapter4/FoodsIta.gf | 16 -- book/examples/chapter4/Shopping.gf | 2 - book/examples/chapter4/ShoppingEng.gf | 4 - book/examples/chapter4/ShoppingIta.gf | 4 - book/examples/chapter4/SmallShopping.gf | 3 - book/examples/chapter5/Foods.gf | 15 -- book/examples/chapter5/FoodsCat.gf | 7 - book/examples/chapter5/FoodsEng.gf | 28 --- book/examples/chapter5/FoodsFin.gf | 7 - book/examples/chapter5/FoodsGer.gf | 7 - book/examples/chapter5/FoodsI.gf | 29 --- book/examples/chapter5/FoodsIta.gf | 8 - book/examples/chapter5/FoodsSwe.gf | 7 - book/examples/chapter5/LexFoods.gf | 15 -- book/examples/chapter5/LexFoodsCat.gf | 18 -- book/examples/chapter5/LexFoodsEng.gf | 20 -- book/examples/chapter5/LexFoodsFin.gf | 20 -- book/examples/chapter5/LexFoodsGer.gf | 16 -- book/examples/chapter5/LexFoodsIta.gf | 16 -- book/examples/chapter5/LexFoodsSwe.gf | 16 -- book/examples/chapter6/Aggregation.gf | 33 ---- book/examples/chapter6/AggregationEng.gf | 17 -- book/examples/chapter6/Arithm.gf | 30 --- book/examples/chapter6/Bin.gf | 50 ----- book/examples/chapter6/Classes.gf | 28 --- book/examples/chapter6/ClassesEng.gf | 29 --- book/examples/chapter6/DShopping.gf | 24 --- book/examples/chapter6/DShoppingEng.gf | 33 ---- book/examples/chapter6/Nat.gf | 22 --- book/examples/chapter6/Smart.gf | 16 -- book/examples/chapter6/Verbs.gf | 22 --- book/examples/chapter6/VerbsEng.gf | 22 --- book/examples/chapter7/Map.gf | 10 - book/examples/chapter7/MapEng.gf | 17 -- book/examples/chapter7/Query.gf | 12 -- book/examples/chapter7/QueryEng.gf | 13 -- book/examples/chapter7/QueryFin.gf | 13 -- book/examples/chapter8/Calculator.gf | 7 - book/examples/chapter8/CalculatorC.gf | 10 - book/examples/chapter8/CalculatorJ.gf | 13 -- book/examples/chapter8/CalculatorP.gf | 14 -- book/examples/chapter8/CalculatorS.gf | 11 -- book/examples/chapter8/Geometry.gf | 7 - book/examples/chapter8/GeometryEng.gf | 13 -- book/examples/chapter8/GeometryEngb.gf | 11 -- book/examples/chapter8/Geometryb.gf | 7 - book/examples/chapter8/Graftal.gf | 7 - book/examples/chapter8/Logic.gf | 21 -- book/examples/chapter8/LogicBEng.gf | 38 ---- book/examples/chapter8/LogicEng.gf | 39 ---- book/examples/chapter8/Logicb.gf | 11 -- book/examples/chapter8/Sierpinski.gf | 16 -- book/examples/chapter9/Anaphora.gf | 17 -- book/examples/chapter9/AnaphoraIta.gf | 17 -- book/examples/chapter9/Grammar.gf | 39 ---- book/examples/chapter9/GrammarIta.gf | 141 -------------- book/examples/chapter9/Logic.gf | 9 - book/examples/chapter9/LogicIta.gf | 54 ------ book/examples/chapter9/LogicSymb.gf | 13 -- book/examples/chapter9/ParadigmsIta.gf | 47 ----- book/examples/chapter9/ResIta.gf | 178 ----------------- book/examples/chapter9/Semantics.gf | 39 ---- book/examples/chapter9/SemanticsIta.gf | 42 ---- book/examples/chapter9/Syntax.gf | 47 ----- book/examples/chapter9/SyntaxIta.gf | 3 - book/examples/chapter9/Test.gf | 9 - book/examples/chapter9/TestIta.gf | 17 -- book/examples/chapter9/TestSemantics.gf | 1 - book/examples/chapter9/TestSemanticsIta.gf | 1 - gf-book/examples/chapter2/Copy.gf | 7 + gf-book/examples/chapter2/CopyAbs.gf | 6 + gf-book/examples/chapter2/Food.gf | 13 ++ gf-book/examples/chapter2/Food.probs | 4 + gf-book/examples/chapter2/FoodEng.gf | 19 ++ gf-book/examples/chapter2/FoodHin.gf | 24 +++ gf-book/examples/chapter2/FoodIta.gf | 19 ++ gf-book/examples/chapter2/Letters.gf | 8 + gf-book/examples/chapter2/LettersCnc.gf | 31 +++ gf-book/examples/chapter2/Strings.gf | 7 + gf-book/examples/chapter2/StringsBW.gf | 5 + gf-book/examples/chapter2/StringsFW.gf | 5 + gf-book/examples/chapter2/Ticket.gf | 10 + gf-book/examples/chapter2/TicketEng.gf | 19 ++ gf-book/examples/chapter2/foodEng.cf | 14 ++ gf-book/examples/chapter2/foodIta.cf | 14 ++ gf-book/examples/chapter3/Arabic.gf | 118 ++++++++++++ gf-book/examples/chapter3/Discont.gf | 11 ++ gf-book/examples/chapter3/DiscontEng.gf | 21 ++ gf-book/examples/chapter3/Foods.gf | 13 ++ gf-book/examples/chapter3/FoodsEng.gf | 40 ++++ gf-book/examples/chapter3/FoodsIta.gf | 32 ++++ gf-book/examples/chapter3/ResIta.gf | 36 ++++ gf-book/examples/chapter4/Clothes.gf | 5 + gf-book/examples/chapter4/ClothesEng.gf | 10 + gf-book/examples/chapter4/ClothesIta.gf | 8 + gf-book/examples/chapter4/Comment.gf | 13 ++ gf-book/examples/chapter4/Comments.gf | 10 + gf-book/examples/chapter4/CommentsEng.gf | 4 + gf-book/examples/chapter4/CommentsI.gf | 15 ++ gf-book/examples/chapter4/CommentsIta.gf | 4 + gf-book/examples/chapter4/Computers.gf | 5 + gf-book/examples/chapter4/ComputersEng.gf | 10 + gf-book/examples/chapter4/ComputersIta.gf | 9 + gf-book/examples/chapter4/DefArtGer.gf | 16 ++ gf-book/examples/chapter4/Foods.gf | 6 + gf-book/examples/chapter4/FoodsEng.gf | 16 ++ gf-book/examples/chapter4/FoodsIta.gf | 16 ++ gf-book/examples/chapter4/Shopping.gf | 2 + gf-book/examples/chapter4/ShoppingEng.gf | 4 + gf-book/examples/chapter4/ShoppingIta.gf | 4 + gf-book/examples/chapter4/SmallShopping.gf | 3 + gf-book/examples/chapter5/Foods.gf | 15 ++ gf-book/examples/chapter5/FoodsCat.gf | 7 + gf-book/examples/chapter5/FoodsEng.gf | 28 +++ gf-book/examples/chapter5/FoodsFin.gf | 7 + gf-book/examples/chapter5/FoodsGer.gf | 7 + gf-book/examples/chapter5/FoodsI.gf | 29 +++ gf-book/examples/chapter5/FoodsIta.gf | 8 + gf-book/examples/chapter5/FoodsSwe.gf | 7 + gf-book/examples/chapter5/LexFoods.gf | 15 ++ gf-book/examples/chapter5/LexFoodsCat.gf | 18 ++ gf-book/examples/chapter5/LexFoodsEng.gf | 20 ++ gf-book/examples/chapter5/LexFoodsFin.gf | 20 ++ gf-book/examples/chapter5/LexFoodsGer.gf | 16 ++ gf-book/examples/chapter5/LexFoodsIta.gf | 16 ++ gf-book/examples/chapter5/LexFoodsSwe.gf | 16 ++ gf-book/examples/chapter6/Aggregation.gf | 33 ++++ gf-book/examples/chapter6/AggregationEng.gf | 17 ++ gf-book/examples/chapter6/Arithm.gf | 30 +++ gf-book/examples/chapter6/Bin.gf | 50 +++++ gf-book/examples/chapter6/Classes.gf | 28 +++ gf-book/examples/chapter6/ClassesEng.gf | 29 +++ gf-book/examples/chapter6/DShopping.gf | 24 +++ gf-book/examples/chapter6/DShoppingEng.gf | 33 ++++ gf-book/examples/chapter6/Nat.gf | 22 +++ gf-book/examples/chapter6/Smart.gf | 16 ++ gf-book/examples/chapter6/Verbs.gf | 22 +++ gf-book/examples/chapter6/VerbsEng.gf | 22 +++ gf-book/examples/chapter7/Map.gf | 10 + gf-book/examples/chapter7/MapEng.gf | 17 ++ gf-book/examples/chapter7/Query.gf | 12 ++ gf-book/examples/chapter7/QueryEng.gf | 13 ++ gf-book/examples/chapter7/QueryFin.gf | 13 ++ gf-book/examples/chapter8/Calculator.gf | 7 + gf-book/examples/chapter8/CalculatorC.gf | 10 + gf-book/examples/chapter8/CalculatorJ.gf | 13 ++ gf-book/examples/chapter8/CalculatorP.gf | 14 ++ gf-book/examples/chapter8/CalculatorS.gf | 11 ++ gf-book/examples/chapter8/Geometry.gf | 7 + gf-book/examples/chapter8/GeometryEng.gf | 13 ++ gf-book/examples/chapter8/GeometryEngb.gf | 11 ++ gf-book/examples/chapter8/Geometryb.gf | 7 + gf-book/examples/chapter8/Graftal.gf | 7 + gf-book/examples/chapter8/Logic.gf | 21 ++ gf-book/examples/chapter8/LogicBEng.gf | 38 ++++ gf-book/examples/chapter8/LogicEng.gf | 39 ++++ gf-book/examples/chapter8/Logicb.gf | 11 ++ gf-book/examples/chapter8/Sierpinski.gf | 16 ++ gf-book/examples/chapter9/Anaphora.gf | 17 ++ gf-book/examples/chapter9/AnaphoraIta.gf | 17 ++ gf-book/examples/chapter9/Grammar.gf | 39 ++++ gf-book/examples/chapter9/GrammarIta.gf | 141 ++++++++++++++ gf-book/examples/chapter9/Logic.gf | 9 + gf-book/examples/chapter9/LogicIta.gf | 54 ++++++ gf-book/examples/chapter9/LogicSymb.gf | 13 ++ gf-book/examples/chapter9/ParadigmsIta.gf | 47 +++++ gf-book/examples/chapter9/ResIta.gf | 178 +++++++++++++++++ gf-book/examples/chapter9/Semantics.gf | 39 ++++ gf-book/examples/chapter9/SemanticsIta.gf | 42 ++++ gf-book/examples/chapter9/Syntax.gf | 47 +++++ gf-book/examples/chapter9/SyntaxIta.gf | 3 + gf-book/examples/chapter9/Test.gf | 9 + gf-book/examples/chapter9/TestIta.gf | 17 ++ gf-book/examples/chapter9/TestSemantics.gf | 1 + gf-book/examples/chapter9/TestSemanticsIta.gf | 1 + gf-book/index.html | 127 +++++++++++++ gf-book/index.txt | 101 ++++++++++ gf-book/toc-gf-book.txt | 263 ++++++++++++++++++++++++++ 215 files changed, 2646 insertions(+), 2155 deletions(-) delete mode 100644 book/examples/chapter2/Copy.gf delete mode 100644 book/examples/chapter2/CopyAbs.gf delete mode 100644 book/examples/chapter2/Food.gf delete mode 100644 book/examples/chapter2/Food.probs delete mode 100644 book/examples/chapter2/FoodEng.gf delete mode 100644 book/examples/chapter2/FoodHin.gf delete mode 100644 book/examples/chapter2/FoodIta.gf delete mode 100644 book/examples/chapter2/Letters.gf delete mode 100644 book/examples/chapter2/LettersCnc.gf delete mode 100644 book/examples/chapter2/Strings.gf delete mode 100644 book/examples/chapter2/StringsBW.gf delete mode 100644 book/examples/chapter2/StringsFW.gf delete mode 100644 book/examples/chapter2/Ticket.gf delete mode 100644 book/examples/chapter2/TicketEng.gf delete mode 100644 book/examples/chapter2/foodEng.cf delete mode 100644 book/examples/chapter2/foodIta.cf delete mode 100644 book/examples/chapter3/Arabic.gf delete mode 100644 book/examples/chapter3/Discont.gf delete mode 100644 book/examples/chapter3/DiscontEng.gf delete mode 100644 book/examples/chapter3/Foods.gf delete mode 100644 book/examples/chapter3/FoodsEng.gf delete mode 100644 book/examples/chapter3/FoodsIta.gf delete mode 100644 book/examples/chapter3/ResIta.gf delete mode 100644 book/examples/chapter4/Clothes.gf delete mode 100644 book/examples/chapter4/ClothesEng.gf delete mode 100644 book/examples/chapter4/ClothesIta.gf delete mode 100644 book/examples/chapter4/Comment.gf delete mode 100644 book/examples/chapter4/Comments.gf delete mode 100644 book/examples/chapter4/CommentsEng.gf delete mode 100644 book/examples/chapter4/CommentsI.gf delete mode 100644 book/examples/chapter4/CommentsIta.gf delete mode 100644 book/examples/chapter4/Computers.gf delete mode 100644 book/examples/chapter4/ComputersEng.gf delete mode 100644 book/examples/chapter4/ComputersIta.gf delete mode 100644 book/examples/chapter4/DefArtGer.gf delete mode 100644 book/examples/chapter4/Foods.gf delete mode 100644 book/examples/chapter4/FoodsEng.gf delete mode 100644 book/examples/chapter4/FoodsIta.gf delete mode 100644 book/examples/chapter4/Shopping.gf delete mode 100644 book/examples/chapter4/ShoppingEng.gf delete mode 100644 book/examples/chapter4/ShoppingIta.gf delete mode 100644 book/examples/chapter4/SmallShopping.gf delete mode 100644 book/examples/chapter5/Foods.gf delete mode 100644 book/examples/chapter5/FoodsCat.gf delete mode 100644 book/examples/chapter5/FoodsEng.gf delete mode 100644 book/examples/chapter5/FoodsFin.gf delete mode 100644 book/examples/chapter5/FoodsGer.gf delete mode 100644 book/examples/chapter5/FoodsI.gf delete mode 100644 book/examples/chapter5/FoodsIta.gf delete mode 100644 book/examples/chapter5/FoodsSwe.gf delete mode 100644 book/examples/chapter5/LexFoods.gf delete mode 100644 book/examples/chapter5/LexFoodsCat.gf delete mode 100644 book/examples/chapter5/LexFoodsEng.gf delete mode 100644 book/examples/chapter5/LexFoodsFin.gf delete mode 100644 book/examples/chapter5/LexFoodsGer.gf delete mode 100644 book/examples/chapter5/LexFoodsIta.gf delete mode 100644 book/examples/chapter5/LexFoodsSwe.gf delete mode 100644 book/examples/chapter6/Aggregation.gf delete mode 100644 book/examples/chapter6/AggregationEng.gf delete mode 100644 book/examples/chapter6/Arithm.gf delete mode 100644 book/examples/chapter6/Bin.gf delete mode 100644 book/examples/chapter6/Classes.gf delete mode 100644 book/examples/chapter6/ClassesEng.gf delete mode 100644 book/examples/chapter6/DShopping.gf delete mode 100644 book/examples/chapter6/DShoppingEng.gf delete mode 100644 book/examples/chapter6/Nat.gf delete mode 100644 book/examples/chapter6/Smart.gf delete mode 100644 book/examples/chapter6/Verbs.gf delete mode 100644 book/examples/chapter6/VerbsEng.gf delete mode 100644 book/examples/chapter7/Map.gf delete mode 100644 book/examples/chapter7/MapEng.gf delete mode 100644 book/examples/chapter7/Query.gf delete mode 100644 book/examples/chapter7/QueryEng.gf delete mode 100644 book/examples/chapter7/QueryFin.gf delete mode 100644 book/examples/chapter8/Calculator.gf delete mode 100644 book/examples/chapter8/CalculatorC.gf delete mode 100644 book/examples/chapter8/CalculatorJ.gf delete mode 100644 book/examples/chapter8/CalculatorP.gf delete mode 100644 book/examples/chapter8/CalculatorS.gf delete mode 100644 book/examples/chapter8/Geometry.gf delete mode 100644 book/examples/chapter8/GeometryEng.gf delete mode 100644 book/examples/chapter8/GeometryEngb.gf delete mode 100644 book/examples/chapter8/Geometryb.gf delete mode 100644 book/examples/chapter8/Graftal.gf delete mode 100644 book/examples/chapter8/Logic.gf delete mode 100644 book/examples/chapter8/LogicBEng.gf delete mode 100644 book/examples/chapter8/LogicEng.gf delete mode 100644 book/examples/chapter8/Logicb.gf delete mode 100644 book/examples/chapter8/Sierpinski.gf delete mode 100644 book/examples/chapter9/Anaphora.gf delete mode 100644 book/examples/chapter9/AnaphoraIta.gf delete mode 100644 book/examples/chapter9/Grammar.gf delete mode 100644 book/examples/chapter9/GrammarIta.gf delete mode 100644 book/examples/chapter9/Logic.gf delete mode 100644 book/examples/chapter9/LogicIta.gf delete mode 100644 book/examples/chapter9/LogicSymb.gf delete mode 100644 book/examples/chapter9/ParadigmsIta.gf delete mode 100644 book/examples/chapter9/ResIta.gf delete mode 100644 book/examples/chapter9/Semantics.gf delete mode 100644 book/examples/chapter9/SemanticsIta.gf delete mode 100644 book/examples/chapter9/Syntax.gf delete mode 100644 book/examples/chapter9/SyntaxIta.gf delete mode 100644 book/examples/chapter9/Test.gf delete mode 100644 book/examples/chapter9/TestIta.gf delete mode 100644 book/examples/chapter9/TestSemantics.gf delete mode 100644 book/examples/chapter9/TestSemanticsIta.gf create mode 100644 gf-book/examples/chapter2/Copy.gf create mode 100644 gf-book/examples/chapter2/CopyAbs.gf create mode 100644 gf-book/examples/chapter2/Food.gf create mode 100644 gf-book/examples/chapter2/Food.probs create mode 100644 gf-book/examples/chapter2/FoodEng.gf create mode 100644 gf-book/examples/chapter2/FoodHin.gf create mode 100644 gf-book/examples/chapter2/FoodIta.gf create mode 100644 gf-book/examples/chapter2/Letters.gf create mode 100644 gf-book/examples/chapter2/LettersCnc.gf create mode 100644 gf-book/examples/chapter2/Strings.gf create mode 100644 gf-book/examples/chapter2/StringsBW.gf create mode 100644 gf-book/examples/chapter2/StringsFW.gf create mode 100644 gf-book/examples/chapter2/Ticket.gf create mode 100644 gf-book/examples/chapter2/TicketEng.gf create mode 100644 gf-book/examples/chapter2/foodEng.cf create mode 100644 gf-book/examples/chapter2/foodIta.cf create mode 100644 gf-book/examples/chapter3/Arabic.gf create mode 100644 gf-book/examples/chapter3/Discont.gf create mode 100644 gf-book/examples/chapter3/DiscontEng.gf create mode 100644 gf-book/examples/chapter3/Foods.gf create mode 100644 gf-book/examples/chapter3/FoodsEng.gf create mode 100644 gf-book/examples/chapter3/FoodsIta.gf create mode 100644 gf-book/examples/chapter3/ResIta.gf create mode 100644 gf-book/examples/chapter4/Clothes.gf create mode 100644 gf-book/examples/chapter4/ClothesEng.gf create mode 100644 gf-book/examples/chapter4/ClothesIta.gf create mode 100644 gf-book/examples/chapter4/Comment.gf create mode 100644 gf-book/examples/chapter4/Comments.gf create mode 100644 gf-book/examples/chapter4/CommentsEng.gf create mode 100644 gf-book/examples/chapter4/CommentsI.gf create mode 100644 gf-book/examples/chapter4/CommentsIta.gf create mode 100644 gf-book/examples/chapter4/Computers.gf create mode 100644 gf-book/examples/chapter4/ComputersEng.gf create mode 100644 gf-book/examples/chapter4/ComputersIta.gf create mode 100644 gf-book/examples/chapter4/DefArtGer.gf create mode 100644 gf-book/examples/chapter4/Foods.gf create mode 100644 gf-book/examples/chapter4/FoodsEng.gf create mode 100644 gf-book/examples/chapter4/FoodsIta.gf create mode 100644 gf-book/examples/chapter4/Shopping.gf create mode 100644 gf-book/examples/chapter4/ShoppingEng.gf create mode 100644 gf-book/examples/chapter4/ShoppingIta.gf create mode 100644 gf-book/examples/chapter4/SmallShopping.gf create mode 100644 gf-book/examples/chapter5/Foods.gf create mode 100644 gf-book/examples/chapter5/FoodsCat.gf create mode 100644 gf-book/examples/chapter5/FoodsEng.gf create mode 100644 gf-book/examples/chapter5/FoodsFin.gf create mode 100644 gf-book/examples/chapter5/FoodsGer.gf create mode 100644 gf-book/examples/chapter5/FoodsI.gf create mode 100644 gf-book/examples/chapter5/FoodsIta.gf create mode 100644 gf-book/examples/chapter5/FoodsSwe.gf create mode 100644 gf-book/examples/chapter5/LexFoods.gf create mode 100644 gf-book/examples/chapter5/LexFoodsCat.gf create mode 100644 gf-book/examples/chapter5/LexFoodsEng.gf create mode 100644 gf-book/examples/chapter5/LexFoodsFin.gf create mode 100644 gf-book/examples/chapter5/LexFoodsGer.gf create mode 100644 gf-book/examples/chapter5/LexFoodsIta.gf create mode 100644 gf-book/examples/chapter5/LexFoodsSwe.gf create mode 100644 gf-book/examples/chapter6/Aggregation.gf create mode 100644 gf-book/examples/chapter6/AggregationEng.gf create mode 100644 gf-book/examples/chapter6/Arithm.gf create mode 100644 gf-book/examples/chapter6/Bin.gf create mode 100644 gf-book/examples/chapter6/Classes.gf create mode 100644 gf-book/examples/chapter6/ClassesEng.gf create mode 100644 gf-book/examples/chapter6/DShopping.gf create mode 100644 gf-book/examples/chapter6/DShoppingEng.gf create mode 100644 gf-book/examples/chapter6/Nat.gf create mode 100644 gf-book/examples/chapter6/Smart.gf create mode 100644 gf-book/examples/chapter6/Verbs.gf create mode 100644 gf-book/examples/chapter6/VerbsEng.gf create mode 100644 gf-book/examples/chapter7/Map.gf create mode 100644 gf-book/examples/chapter7/MapEng.gf create mode 100644 gf-book/examples/chapter7/Query.gf create mode 100644 gf-book/examples/chapter7/QueryEng.gf create mode 100644 gf-book/examples/chapter7/QueryFin.gf create mode 100644 gf-book/examples/chapter8/Calculator.gf create mode 100644 gf-book/examples/chapter8/CalculatorC.gf create mode 100644 gf-book/examples/chapter8/CalculatorJ.gf create mode 100644 gf-book/examples/chapter8/CalculatorP.gf create mode 100644 gf-book/examples/chapter8/CalculatorS.gf create mode 100644 gf-book/examples/chapter8/Geometry.gf create mode 100644 gf-book/examples/chapter8/GeometryEng.gf create mode 100644 gf-book/examples/chapter8/GeometryEngb.gf create mode 100644 gf-book/examples/chapter8/Geometryb.gf create mode 100644 gf-book/examples/chapter8/Graftal.gf create mode 100644 gf-book/examples/chapter8/Logic.gf create mode 100644 gf-book/examples/chapter8/LogicBEng.gf create mode 100644 gf-book/examples/chapter8/LogicEng.gf create mode 100644 gf-book/examples/chapter8/Logicb.gf create mode 100644 gf-book/examples/chapter8/Sierpinski.gf create mode 100644 gf-book/examples/chapter9/Anaphora.gf create mode 100644 gf-book/examples/chapter9/AnaphoraIta.gf create mode 100644 gf-book/examples/chapter9/Grammar.gf create mode 100644 gf-book/examples/chapter9/GrammarIta.gf create mode 100644 gf-book/examples/chapter9/Logic.gf create mode 100644 gf-book/examples/chapter9/LogicIta.gf create mode 100644 gf-book/examples/chapter9/LogicSymb.gf create mode 100644 gf-book/examples/chapter9/ParadigmsIta.gf create mode 100644 gf-book/examples/chapter9/ResIta.gf create mode 100644 gf-book/examples/chapter9/Semantics.gf create mode 100644 gf-book/examples/chapter9/SemanticsIta.gf create mode 100644 gf-book/examples/chapter9/Syntax.gf create mode 100644 gf-book/examples/chapter9/SyntaxIta.gf create mode 100644 gf-book/examples/chapter9/Test.gf create mode 100644 gf-book/examples/chapter9/TestIta.gf create mode 100644 gf-book/examples/chapter9/TestSemantics.gf create mode 100644 gf-book/examples/chapter9/TestSemanticsIta.gf create mode 100644 gf-book/index.html create mode 100644 gf-book/index.txt create mode 100644 gf-book/toc-gf-book.txt diff --git a/book/examples/chapter2/Copy.gf b/book/examples/chapter2/Copy.gf deleted file mode 100644 index 58d74861c..000000000 --- a/book/examples/chapter2/Copy.gf +++ /dev/null @@ -1,7 +0,0 @@ -concrete Copy of CopyAbs = { - lincat S, AB = Str ; - lin s x = x ++ x ; - end = [] ; - a x = "a" ++ x ; - b x = "b" ++ x ; -} diff --git a/book/examples/chapter2/CopyAbs.gf b/book/examples/chapter2/CopyAbs.gf deleted file mode 100644 index 9a915568b..000000000 --- a/book/examples/chapter2/CopyAbs.gf +++ /dev/null @@ -1,6 +0,0 @@ -abstract CopyAbs = { - cat S ; AB ; - fun s : AB -> S ; - end : AB ; - a,b : AB -> AB ; -} diff --git a/book/examples/chapter2/Food.gf b/book/examples/chapter2/Food.gf deleted file mode 100644 index 7cf779b4c..000000000 --- a/book/examples/chapter2/Food.gf +++ /dev/null @@ -1,13 +0,0 @@ -abstract Food = { - flags startcat = Comment ; - cat - Comment ; Item ; Kind ; Quality ; - fun - Pred : Item -> Quality -> Comment ; - This, That : Kind -> Item ; - Mod : Quality -> Kind -> Kind ; - Wine, Cheese, Fish : Kind ; - Very : Quality -> Quality ; - Fresh, Warm, Italian, - Expensive, Delicious, Boring : Quality ; -} diff --git a/book/examples/chapter2/Food.probs b/book/examples/chapter2/Food.probs deleted file mode 100644 index 2d75774a1..000000000 --- a/book/examples/chapter2/Food.probs +++ /dev/null @@ -1,4 +0,0 @@ - This 0.8 - Mod 0.2 - Wine 0.0 - Fresh 0.4 diff --git a/book/examples/chapter2/FoodEng.gf b/book/examples/chapter2/FoodEng.gf deleted file mode 100644 index f2ed510fe..000000000 --- a/book/examples/chapter2/FoodEng.gf +++ /dev/null @@ -1,19 +0,0 @@ -concrete FoodEng of Food = { - lincat - Comment, Item, Kind, Quality = Str ; - lin - Pred item quality = item ++ "is" ++ quality ; - This kind = "this" ++ kind ; - That kind = "that" ++ kind ; - Mod quality kind = quality ++ kind ; - Wine = "wine" ; - Cheese = "cheese" ; - Fish = "fish" ; - Very quality = "very" ++ quality ; - Fresh = "fresh" ; - Warm = "warm" ; - Italian = "Italian" ; - Expensive = "expensive" ; - Delicious = "delicious" ; - Boring = "boring" ; -} diff --git a/book/examples/chapter2/FoodHin.gf b/book/examples/chapter2/FoodHin.gf deleted file mode 100644 index 0f6f25c5e..000000000 --- a/book/examples/chapter2/FoodHin.gf +++ /dev/null @@ -1,24 +0,0 @@ - - concrete FoodHin of Food = { - flags coding = utf8 ; - lincat Comment, Item, Kind, Quality = Str ; - lin - Pred item quality = item ++ quality ++ "है" ; - This kind = "यह" ++ kind ; - That kind = "वह" ++ kind ; - Mod quality kind = quality ++ kind ; - Wine = "मदिरा" ; - Cheese = "पनीर" ; - Fish = "मछली" ; - Very quality = "अति" ++ quality ; - Fresh = "ताज़ा" ; - Warm = "गरम" ; - Italian = "इटली" ; - Expensive = "बहुमूल्य" ; - Delicious = "स्वादिष्ट" ; - Boring = "अरुचिकर" ; - } - - - - diff --git a/book/examples/chapter2/FoodIta.gf b/book/examples/chapter2/FoodIta.gf deleted file mode 100644 index 466104432..000000000 --- a/book/examples/chapter2/FoodIta.gf +++ /dev/null @@ -1,19 +0,0 @@ -concrete FoodIta of Food = { - lincat - Comment, Item, Kind, Quality = Str ; - lin - Pred item quality = item ++ "" ++ quality ; - This kind = "questo" ++ kind ; - That kind = "quel" ++ kind ; - Mod quality kind = kind ++ quality ; - Wine = "vino" ; - Cheese = "formaggio" ; - Fish = "pesce" ; - Very quality = "molto" ++ quality ; - Fresh = "fresco" ; - Warm = "caldo" ; - Italian = "italiano" ; - Expensive = "caro" ; - Delicious = "delizioso" ; - Boring = "noioso" ; -} diff --git a/book/examples/chapter2/Letters.gf b/book/examples/chapter2/Letters.gf deleted file mode 100644 index 2b5a62d2d..000000000 --- a/book/examples/chapter2/Letters.gf +++ /dev/null @@ -1,8 +0,0 @@ -abstract Letters = { - -cat L ; -fun - a, b, c, d, e, f, g, h, i, j, k, l, m, - n, o, p, q, r, s, t, u, v, w, x, y, z : L ; - -} diff --git a/book/examples/chapter2/LettersCnc.gf b/book/examples/chapter2/LettersCnc.gf deleted file mode 100644 index 3301f5465..000000000 --- a/book/examples/chapter2/LettersCnc.gf +++ /dev/null @@ -1,31 +0,0 @@ -concrete LettersCnc of Letters = { - - lincat L = Str ; - lin - a = "a" ; - b = "b" ; - c = "c" ; - d = "d" ; - e = "e" ; - f = "f" ; - g = "g" ; - h = "h" ; - i = "i" ; - j = "j" ; - k = "k" ; - l = "l" ; - m = "m" ; - n = "n" ; - o = "o" ; - p = "p" ; - q = "q" ; - r = "r" ; - s = "s" ; - t = "t" ; - u = "u" ; - v = "v" ; - w = "w" ; - x = "x" ; - y = "y" ; - z = "z" ; -} diff --git a/book/examples/chapter2/Strings.gf b/book/examples/chapter2/Strings.gf deleted file mode 100644 index 411ceed53..000000000 --- a/book/examples/chapter2/Strings.gf +++ /dev/null @@ -1,7 +0,0 @@ -abstract Strings = Letters ** { - -cat S ; -fun - E : S ; - C : L -> S -> S ; -} diff --git a/book/examples/chapter2/StringsBW.gf b/book/examples/chapter2/StringsBW.gf deleted file mode 100644 index 8e558d953..000000000 --- a/book/examples/chapter2/StringsBW.gf +++ /dev/null @@ -1,5 +0,0 @@ -concrete StringsBW of Strings = LettersCnc ** { - lincat S = Str ; - lin E = [] ; - lin C head tail = tail ++ head ; -} diff --git a/book/examples/chapter2/StringsFW.gf b/book/examples/chapter2/StringsFW.gf deleted file mode 100644 index c0f80c313..000000000 --- a/book/examples/chapter2/StringsFW.gf +++ /dev/null @@ -1,5 +0,0 @@ -concrete StringsFW of Strings = LettersCnc ** { - lincat S = Str ; - lin E = [] ; - lin C head tail = head ++ tail ; -} diff --git a/book/examples/chapter2/Ticket.gf b/book/examples/chapter2/Ticket.gf deleted file mode 100644 index f3f2dd851..000000000 --- a/book/examples/chapter2/Ticket.gf +++ /dev/null @@ -1,10 +0,0 @@ -abstract Ticket = { - -flags startcat = Request ; -cat - Request ; Station ; -fun - Ticket : Station -> Station -> Request ; - Hamburg, Paris : Station ; - -} diff --git a/book/examples/chapter2/TicketEng.gf b/book/examples/chapter2/TicketEng.gf deleted file mode 100644 index 54e44741d..000000000 --- a/book/examples/chapter2/TicketEng.gf +++ /dev/null @@ -1,19 +0,0 @@ -concrete TicketEng of Ticket = { - -lincat - Request, Station = Str ; -lin - Ticket X Y = - ((("I" ++ ("would like" | "want") ++ "to get" | - ("may" | "can") ++ "I get" | - "can you give me" | - []) ++ - "a ticket") | - []) ++ - "from" ++ X ++ "to" ++ Y ++ - ("please" | []) ; - - Hamburg = "Hamburg" ; - Paris = "Paris" ; - -} diff --git a/book/examples/chapter2/foodEng.cf b/book/examples/chapter2/foodEng.cf deleted file mode 100644 index 3216f2e30..000000000 --- a/book/examples/chapter2/foodEng.cf +++ /dev/null @@ -1,14 +0,0 @@ -Pred. Comment ::= Item "is" Quality -This. Item ::= "this" Kind -That. Item ::= "that" Kind -Mod. Kind ::= Quality Kind -Wine. Kind ::= "wine" -Cheese. Kind ::= "cheese" -Fish. Kind ::= "fish" -Very. Quality ::= "very" Quality -Fresh. Quality ::= "fresh" -Warm. Quality ::= "warm" -Italian. Quality ::= "Italian" -Expensive. Quality ::= "expensive" -Delicious. Quality ::= "delicious" -Boring. Quality ::= "boring" diff --git a/book/examples/chapter2/foodIta.cf b/book/examples/chapter2/foodIta.cf deleted file mode 100644 index 02b825ed0..000000000 --- a/book/examples/chapter2/foodIta.cf +++ /dev/null @@ -1,14 +0,0 @@ -Pred. Comment ::= Item "è" Quality -This. Item ::= "questo" Kind -That. Item ::= "quel" Kind -Mod. Kind ::= Kind Quality -Wine. Kind ::= "vino" -Cheese. Kind ::= "formaggio" -Fish. Kind ::= "pesce" -Very. Quality ::= "molto" Quality -Fresh. Quality ::= "fresco" -Warm. Quality ::= "caldo" -Italian. Quality ::= "italiano" -Expensive. Quality ::= "caro" -Delicious. Quality ::= "delizioso" -Boring. Quality ::= "noioso" diff --git a/book/examples/chapter3/Arabic.gf b/book/examples/chapter3/Arabic.gf deleted file mode 100644 index e00d02c23..000000000 --- a/book/examples/chapter3/Arabic.gf +++ /dev/null @@ -1,118 +0,0 @@ -resource Arabic = { -oper - Root : Type = {F,C,L : Str} ; - Pattern : Type = Root -> Str ; - - Filling : Type = {F,FC,CL,L : Str} ; - - fill : Filling -> Root -> Str = \p,r -> - p.F + r.F + p.FC + r.C + p.CL + r.L + p.L ; - - dfill : Filling -> Root -> Str = \p,r -> - p.F + r.F + p.FC + r.C + r.C + p.CL + r.L + p.L ; - - getRoot : Str -> Root = \s -> case s of { - F@? + C@? + L@? => {F = F ; C = C ; L = L} ; - _ => Predef.error ("cannot get root from" ++ s) - } ; - - getPattern : Str -> Pattern = \s -> case s of { - F + "F" + FC + "CC" + CL + "L" + L => - dfill {F = F ; FC = FC ; CL = CL ; L = L} ; - F + "F" + FC + "C" + CL + "L" + L => - fill {F = F ; FC = FC ; CL = CL ; L = L} ; - _ => Predef.error ("cannot get pattern from" ++ s) - } ; - - word : Str -> Str -> Str = \p,r -> - getPattern p (getRoot r) ; - -param - Number = Sg | Dl | Pl ; - Gender = Masc | Fem ; - Tense = Perf | Impf ; - - VPer = Vp3 Number Gender | Vp2Sg Gender | Vp2Dl | Vp2Pl Gender | Vp1Sg | Vp1Pl ; - -oper - Verb : Type = {s : Tense => VPer => Str} ; - - pattV_u : Tense -> VPer -> Pattern = \t,v -> getPattern (case t of { - Perf => case v of { - Vp3 Sg Masc => "FaCaLa" ; - Vp3 Sg Fem => "FaCaLat" ; - Vp3 Dl Masc => "FaCaLaA" ; - Vp3 Dl Fem => "FaCaLataA" ; - Vp3 Pl Masc => "FaCaLuwA" ; - Vp3 Pl Fem => "FaCaLona" ; - - Vp2Sg Masc => "FaCaLota" ; - Vp2Sg Fem => "FaCaLoti" ; - Vp2Dl => "FaCaLotumaA" ; - Vp2Pl Masc => "FaCaLotum" ; - Vp2Pl Fem => "FaCaLotunv2a" ; - - Vp1Sg => "FaCaLotu" ; - Vp1Pl => "FaCaLonaA" - } ; - Impf => case v of { - Vp3 Sg Masc => "yaFoCuLu" ; - Vp3 Sg Fem => "taFoCuLu" ; - Vp3 Dl Masc => "yaFoCuLaAni" ; - Vp3 Dl Fem => "taFoCuLaAni" ; - Vp3 Pl Masc => "yaFoCuLuwna" ; - Vp3 Pl Fem => "yaFoCuLna" ; - - Vp2Sg Masc => "taFoCuLu" ; - Vp2Sg Fem => "taFoCuLiyna" ; - Vp2Dl => "taFoCuLaAni" ; - Vp2Pl Masc => "taFoCuLuwna" ; - Vp2Pl Fem => "taFoCuLona" ; - - Vp1Sg => "A?aFoCuLu" ; - Vp1Pl => "naFoCuLu" - } - }) ; - - u_Verb : Str -> Verb = \s -> { - s = \\t,p => pattV_u t p (getRoot s) ; - } ; - --- for html - - tag : Str -> Str = \t -> "<" + t + ">" ; - etag : Str -> Str = \t -> "" ; - atag : Str -> Str -> Str = \t,a -> "<" + t ++ a + ">" ; - - intag : Str -> Str -> Str = \t,s -> tag t ++ s ++ etag t ; - intagAttr : Str -> Str -> Str -> Str = \t,a,s -> atag t a ++ s ++ etag t ; - - verbTable : Verb -> Str = \v -> - let - vsp = v.s ! Perf ; - vsi = v.s ! Impf ; - tr : Str -> Str = intag "tr" ; - td : Str -> Str = intag "td" ; - ts : Str -> Str = \s -> td ("\"" ++ s ++ "\"") ; - trs : Str -> Str -> VPer -> Str = \s,n,v -> - tr (td s ++ td n ++ ts (vsp ! v) ++ ts (vsi ! v)) - in - intagAttr "table" "border=1" ( - tr ((td "Persona") ++ (td "Numerus") ++ (td "Perfectum") ++ (td "Imperfectum")) ++ - trs "3. masc." "sing." (Vp3 Sg Masc) ++ - trs "3. fem." "sing." (Vp3 Sg Fem) ++ - trs "2. masc." "sing." (Vp2Sg Masc) ++ - trs "2. fem." "sing." (Vp2Sg Fem) ++ - trs "1." "sing." (Vp1Sg) ++ - trs "3. masc." "dual." (Vp3 Dl Masc) ++ - trs "3. fem." "dual." (Vp3 Dl Fem) ++ - trs "2." "dual." (Vp2Dl) ++ - trs "3. masc." "plur." (Vp3 Pl Masc) ++ - trs "3. fem." "plur." (Vp3 Pl Fem) ++ - trs "2. masc." "plur." (Vp2Pl Masc) ++ - trs "2. fem." "plur." (Vp2Pl Fem) ++ - trs "1." "plur." (Vp1Pl) - ) ; - - -} diff --git a/book/examples/chapter3/Discont.gf b/book/examples/chapter3/Discont.gf deleted file mode 100644 index 879bedc4c..000000000 --- a/book/examples/chapter3/Discont.gf +++ /dev/null @@ -1,11 +0,0 @@ -abstract Discont = { - cat - S ; Cl ; NP ; VP ; AP ; - fun - DeclCl : Cl -> S ; - QuestCl : Cl -> S ; - PredVP : NP -> VP -> Cl ; - CompAP : AP -> VP ; - John : NP ; - Old : AP ; -} diff --git a/book/examples/chapter3/DiscontEng.gf b/book/examples/chapter3/DiscontEng.gf deleted file mode 100644 index 93d70a02c..000000000 --- a/book/examples/chapter3/DiscontEng.gf +++ /dev/null @@ -1,21 +0,0 @@ -concrete DiscontEng of Discont = { - param - SForm = SDecl | SQuest ; - lincat - S, NP, AP = Str ; - Cl = SForm => Str ; - VP = {verb,comp : Str} ; - lin - DeclCl cl = cl ! SDecl ; - QuestCl cl = cl ! SQuest ; - PredVP np vp = table { - SDecl => np ++ vp.verb ++ vp.comp ; - SQuest => vp.verb ++ np ++ vp.comp - } ; - CompAP ap = { - verb = "is" ; - comp = ap - } ; - John = "John" ; - Old = "old" ; -} diff --git a/book/examples/chapter3/Foods.gf b/book/examples/chapter3/Foods.gf deleted file mode 100644 index e60f0ea09..000000000 --- a/book/examples/chapter3/Foods.gf +++ /dev/null @@ -1,13 +0,0 @@ -abstract Foods = { - flags startcat = Comment ; - cat - Comment ; Item ; Kind ; Quality ; - fun - Pred : Item -> Quality -> Comment ; - This, That, These, Those : Kind -> Item ; - Mod : Quality -> Kind -> Kind ; - Wine, Cheese, Fish, Pizza : Kind ; - Very : Quality -> Quality ; - Fresh, Warm, Italian, - Expensive, Delicious, Boring : Quality ; -} diff --git a/book/examples/chapter3/FoodsEng.gf b/book/examples/chapter3/FoodsEng.gf deleted file mode 100644 index 82bae2148..000000000 --- a/book/examples/chapter3/FoodsEng.gf +++ /dev/null @@ -1,40 +0,0 @@ -concrete FoodsEng of Foods = { - lincat - Comment, Quality = {s : Str} ; - Kind = {s : Number => Str} ; - Item = {s : Str ; n : Number} ; - lin - Pred item quality = - {s = item.s ++ copula ! item.n ++ quality.s} ; - This = det Sg "this" ; - That = det Sg "that" ; - These = det Pl "these" ; - Those = det Pl "those" ; - Mod quality kind = - {s = \\n => quality.s ++ kind.s ! n} ; - Wine = regNoun "wine" ; - Cheese = regNoun "cheese" ; - Fish = noun "fish" "fish" ; - Pizza = regNoun "pizza" ; - Very a = {s = "very" ++ a.s} ; - Fresh = adj "fresh" ; - Warm = adj "warm" ; - Italian = adj "Italian" ; - Expensive = adj "expensive" ; - Delicious = adj "delicious" ; - Boring = adj "boring" ; - param - Number = Sg | Pl ; - oper - det : Number -> Str -> - {s : Number => Str} -> {s : Str ; n : Number} = - \n,det,noun -> {s = det ++ noun.s ! n ; n = n} ; - noun : Str -> Str -> {s : Number => Str} = - \man,men -> {s = table {Sg => man ; Pl => men}} ; - regNoun : Str -> {s : Number => Str} = - \car -> noun car (car + "s") ; - adj : Str -> {s : Str} = - \cold -> {s = cold} ; - copula : Number => Str = - table {Sg => "is" ; Pl => "are"} ; -} diff --git a/book/examples/chapter3/FoodsIta.gf b/book/examples/chapter3/FoodsIta.gf deleted file mode 100644 index 6f7015694..000000000 --- a/book/examples/chapter3/FoodsIta.gf +++ /dev/null @@ -1,32 +0,0 @@ -concrete FoodsIta of Foods = open ResIta in { - lincat - Comment = {s : Str} ; - Quality = Adjective ; - Kind = Noun ; - Item = NounPhrase ; - lin - Pred item quality = - {s = item.s ++ copula ! item.n ++ - quality.s ! item.g ! item.n} ; - This = det Sg "questo" "questa" ; - That = det Sg "quel" "quella" ; - These = det Pl "questi" "queste" ; - Those = det Pl "quei" "quelle" ; - Mod quality kind = { - s = \\n => kind.s ! n ++ quality.s ! kind.g ! n ; - g = kind.g - } ; - Wine = noun "vino" "vini" Masc ; - Cheese = noun "formaggio" "formaggi" Masc ; - Fish = noun "pesce" "pesci" Masc ; - Pizza = noun "pizza" "pizze" Fem ; - Very qual = {s = \\g,n => "molto" ++ qual.s ! g ! n} ; - Fresh = - adjective "fresco" "fresca" "freschi" "fresche" ; - Warm = regAdj "caldo" ; - Italian = regAdj "italiano" ; - Expensive = regAdj "caro" ; - Delicious = regAdj "delizioso" ; - Boring = regAdj "noioso" ; -} - diff --git a/book/examples/chapter3/ResIta.gf b/book/examples/chapter3/ResIta.gf deleted file mode 100644 index 17809c498..000000000 --- a/book/examples/chapter3/ResIta.gf +++ /dev/null @@ -1,36 +0,0 @@ -resource ResIta = open Prelude in { - param - Number = Sg | Pl ; - Gender = Masc | Fem ; - oper - NounPhrase : Type = - {s : Str ; g : Gender ; n : Number} ; - Noun : Type = {s : Number => Str ; g : Gender} ; - Adjective : Type = {s : Gender => Number => Str} ; - - det : Number -> Str -> Str -> Noun -> NounPhrase = - \n,m,f,cn -> { - s = table {Masc => m ; Fem => f} ! cn.g ++ - cn.s ! n ; - g = cn.g ; - n = n - } ; - noun : Str -> Str -> Gender -> Noun = - \vino,vini,g -> { - s = table {Sg => vino ; Pl => vini} ; - g = g - } ; - adjective : (nero,nera,neri,nere : Str) -> Adjective = - \nero,nera,neri,nere -> { - s = table { - Masc => table {Sg => nero ; Pl => neri} ; - Fem => table {Sg => nera ; Pl => nere} - } - } ; - regAdj : Str -> Adjective = \nero -> - let ner : Str = init nero - in - adjective nero (ner+"a") (ner+"i") (ner+"e") ; - copula : Number => Str = - table {Sg => "" ; Pl => "sono"} ; -} diff --git a/book/examples/chapter4/Clothes.gf b/book/examples/chapter4/Clothes.gf deleted file mode 100644 index e17400a27..000000000 --- a/book/examples/chapter4/Clothes.gf +++ /dev/null @@ -1,5 +0,0 @@ -abstract Clothes = Comments ** { - fun - Shirt, Jacket : Kind ; - Comfortable, Elegant : Quality ; -} diff --git a/book/examples/chapter4/ClothesEng.gf b/book/examples/chapter4/ClothesEng.gf deleted file mode 100644 index c6b9a2520..000000000 --- a/book/examples/chapter4/ClothesEng.gf +++ /dev/null @@ -1,10 +0,0 @@ ---# -path=.:present - -concrete ClothesEng of Clothes = CommentsEng ** - open SyntaxEng, ParadigmsEng in { - lin - Shirt = mkCN (mkN "shirt") ; - Jacket = mkCN (mkN "jacket") ; - Comfortable = mkAP (mkA "comfortable") ; - Elegant = mkAP (mkA "elegant") ; -} diff --git a/book/examples/chapter4/ClothesIta.gf b/book/examples/chapter4/ClothesIta.gf deleted file mode 100644 index fc4415b07..000000000 --- a/book/examples/chapter4/ClothesIta.gf +++ /dev/null @@ -1,8 +0,0 @@ -concrete ClothesIta of Clothes = CommentsIta ** - open SyntaxIta, ParadigmsIta in { - lin - Shirt = mkCN (mkN "camicia") ; - Jacket = mkCN (mkN "giacca") ; - Comfortable = mkAP (mkA "comodo") ; - Elegant = mkAP (mkA "elegante") ; -} diff --git a/book/examples/chapter4/Comment.gf b/book/examples/chapter4/Comment.gf deleted file mode 100644 index 0a812c6ef..000000000 --- a/book/examples/chapter4/Comment.gf +++ /dev/null @@ -1,13 +0,0 @@ -abstract Comment = { - flags startcat = Comment ; - cat - Comment ; Item ; Kind ; Quality ; - fun - Pred : Item -> Quality -> Comment ; - This, That, These, Those : Kind -> Item ; - Mod : Quality -> Kind -> Kind ; - Wine, Cheese, Fish, Pizza : Kind ; - Very : Quality -> Quality ; - Fresh, Warm, Italian, - Expensive, Delicious, Boring : Quality ; -} diff --git a/book/examples/chapter4/Comments.gf b/book/examples/chapter4/Comments.gf deleted file mode 100644 index ba36024f3..000000000 --- a/book/examples/chapter4/Comments.gf +++ /dev/null @@ -1,10 +0,0 @@ -abstract Comments = { - flags startcat = Comment ; - cat - Comment ; Item ; Kind ; Quality ; - fun - Pred : Item -> Quality -> Comment ; - This, That, These, Those : Kind -> Item ; - Mod : Quality -> Kind -> Kind ; - Very : Quality -> Quality ; -} diff --git a/book/examples/chapter4/CommentsEng.gf b/book/examples/chapter4/CommentsEng.gf deleted file mode 100644 index 8fe3ed965..000000000 --- a/book/examples/chapter4/CommentsEng.gf +++ /dev/null @@ -1,4 +0,0 @@ ---# -path=.:present - -concrete CommentsEng of Comments = CommentsI with - (Syntax = SyntaxEng) ; diff --git a/book/examples/chapter4/CommentsI.gf b/book/examples/chapter4/CommentsI.gf deleted file mode 100644 index b7cf0e8f7..000000000 --- a/book/examples/chapter4/CommentsI.gf +++ /dev/null @@ -1,15 +0,0 @@ -incomplete concrete CommentsI of Comments = open Syntax in { - lincat - Comment = Cl ; - Item = NP ; - Kind = CN ; - Quality = AP ; - lin - Pred item quality = mkCl item quality ; - This kind = mkNP this_QuantSg kind ; - That kind = mkNP that_QuantSg kind ; - These kind = mkNP these_QuantPl kind ; - Those kind = mkNP those_QuantPl kind ; - Mod quality kind = mkCN quality kind ; - Very quality = mkAP very_AdA quality ; -} diff --git a/book/examples/chapter4/CommentsIta.gf b/book/examples/chapter4/CommentsIta.gf deleted file mode 100644 index c9010c939..000000000 --- a/book/examples/chapter4/CommentsIta.gf +++ /dev/null @@ -1,4 +0,0 @@ ---# -path=.:present - -concrete CommentsIta of Comments = CommentsI with - (Syntax = SyntaxIta) ; diff --git a/book/examples/chapter4/Computers.gf b/book/examples/chapter4/Computers.gf deleted file mode 100644 index 6bbafd215..000000000 --- a/book/examples/chapter4/Computers.gf +++ /dev/null @@ -1,5 +0,0 @@ -abstract Computers = Comments ** { - fun - Computer, HardDisk : Kind ; - Efficient, Slow : Quality ; -} diff --git a/book/examples/chapter4/ComputersEng.gf b/book/examples/chapter4/ComputersEng.gf deleted file mode 100644 index c902be7a7..000000000 --- a/book/examples/chapter4/ComputersEng.gf +++ /dev/null @@ -1,10 +0,0 @@ ---# -path=.:present - -concrete ComputersEng of Computers = CommentsEng ** - open SyntaxEng, ParadigmsEng in { - lin - Computer = mkCN (mkN "computer") ; - HardDisk = mkCN (mkA "hard") (mkN "disk") ; - Efficient = mkAP (mkA "efficient") ; - Slow = mkAP (mkA "slow") ; -} diff --git a/book/examples/chapter4/ComputersIta.gf b/book/examples/chapter4/ComputersIta.gf deleted file mode 100644 index 274bf6089..000000000 --- a/book/examples/chapter4/ComputersIta.gf +++ /dev/null @@ -1,9 +0,0 @@ -concrete ComputersIta of Computers = - CommentsIta ** open ResIta in { - lin - Computer = noun "computer" "computer" Masc ; - HardDisk = noun "disco rigido" "dischi rigidi" Masc ; - Efficient = adjective "efficiente" "efficiente" - "efficienti" "efficienti" ; - Slow = regAdj "lento" ; -} diff --git a/book/examples/chapter4/DefArtGer.gf b/book/examples/chapter4/DefArtGer.gf deleted file mode 100644 index 1ef9394eb..000000000 --- a/book/examples/chapter4/DefArtGer.gf +++ /dev/null @@ -1,16 +0,0 @@ -resource DefArtGer = { - - param DetForm = DSg Gender Case | DPl Case ; - param Gender = Masc | Fem | Neutr ; - param Case = Nom | Acc | Dat | Gen ; - - oper artDef : DetForm => Str = table { - DSg Masc Acc | DPl Dat => "den" ; - DSg (Masc | Neutr) Dat => "dem" ; - DSg (Masc | Neutr) Gen => "des" ; - DSg Neutr _ => "das" ; - DSg Fem (Nom | Acc) | DPl (Nom | Acc) => "die" ; - _ => "der" - } ; - -} diff --git a/book/examples/chapter4/Foods.gf b/book/examples/chapter4/Foods.gf deleted file mode 100644 index d09135421..000000000 --- a/book/examples/chapter4/Foods.gf +++ /dev/null @@ -1,6 +0,0 @@ -abstract Foods = Comments ** { - fun - Wine, Cheese, Fish, Pizza : Kind ; - Fresh, Warm, Italian, - Expensive, Delicious, Boring : Quality ; -} diff --git a/book/examples/chapter4/FoodsEng.gf b/book/examples/chapter4/FoodsEng.gf deleted file mode 100644 index 39711d908..000000000 --- a/book/examples/chapter4/FoodsEng.gf +++ /dev/null @@ -1,16 +0,0 @@ ---# -path=.:present - -concrete FoodsEng of Foods = CommentsEng ** - open SyntaxEng, ParadigmsEng in { - lin - Wine = mkCN (mkN "wine") ; - Pizza = mkCN (mkN "pizza") ; - Cheese = mkCN (mkN "cheese") ; - Fish = mkCN (mkN "fish" "fish") ; - Fresh = mkAP (mkA "fresh") ; - Warm = mkAP (mkA "warm") ; - Italian = mkAP (mkA "Italian") ; - Expensive = mkAP (mkA "expensive") ; - Delicious = mkAP (mkA "delicious") ; - Boring = mkAP (mkA "boring") ; -} diff --git a/book/examples/chapter4/FoodsIta.gf b/book/examples/chapter4/FoodsIta.gf deleted file mode 100644 index 502a29cc2..000000000 --- a/book/examples/chapter4/FoodsIta.gf +++ /dev/null @@ -1,16 +0,0 @@ ---# -path=.:present - -concrete FoodsIta of Foods = CommentsIta ** - open SyntaxIta, ParadigmsIta in { - lin - Wine = mkCN (mkN "vino") ; - Pizza = mkCN (mkN "pizza") ; - Cheese = mkCN (mkN "formaggio") ; - Fish = mkCN (mkN "pesce") ; - Fresh = mkAP (mkA "fresco") ; - Warm = mkAP (mkA "caldo") ; - Italian = mkAP (mkA "italiano") ; - Expensive = mkAP (mkA "caro") ; - Delicious = mkAP (mkA "delizioso") ; - Boring = mkAP (mkA "noioso") ; -} diff --git a/book/examples/chapter4/Shopping.gf b/book/examples/chapter4/Shopping.gf deleted file mode 100644 index 99deb46d9..000000000 --- a/book/examples/chapter4/Shopping.gf +++ /dev/null @@ -1,2 +0,0 @@ -abstract Shopping = Foods, Clothes ; - diff --git a/book/examples/chapter4/ShoppingEng.gf b/book/examples/chapter4/ShoppingEng.gf deleted file mode 100644 index 9233a00af..000000000 --- a/book/examples/chapter4/ShoppingEng.gf +++ /dev/null @@ -1,4 +0,0 @@ ---# -path=.:present - -concrete ShoppingEng of Shopping = FoodsEng, ClothesEng ; - diff --git a/book/examples/chapter4/ShoppingIta.gf b/book/examples/chapter4/ShoppingIta.gf deleted file mode 100644 index 5abae2674..000000000 --- a/book/examples/chapter4/ShoppingIta.gf +++ /dev/null @@ -1,4 +0,0 @@ ---# -path=.:present - -concrete ShoppingIta of Shopping = FoodsIta, ClothesIta ; - diff --git a/book/examples/chapter4/SmallShopping.gf b/book/examples/chapter4/SmallShopping.gf deleted file mode 100644 index 10c7c1a17..000000000 --- a/book/examples/chapter4/SmallShopping.gf +++ /dev/null @@ -1,3 +0,0 @@ -abstract SmallShopping = - Foods - [Wine], - Clothes [Kind,Quality,Shirt,Elegant] ; diff --git a/book/examples/chapter5/Foods.gf b/book/examples/chapter5/Foods.gf deleted file mode 100644 index 8ea02f39d..000000000 --- a/book/examples/chapter5/Foods.gf +++ /dev/null @@ -1,15 +0,0 @@ --- (c) 2009 Aarne Ranta under LGPL - -abstract Foods = { - flags startcat = Comment ; - cat - Comment ; Item ; Kind ; Quality ; - fun - Pred : Item -> Quality -> Comment ; - This, That, These, Those : Kind -> Item ; - Mod : Quality -> Kind -> Kind ; - Wine, Cheese, Fish, Pizza : Kind ; - Very : Quality -> Quality ; - Fresh, Warm, Italian, - Expensive, Delicious, Boring : Quality ; -} diff --git a/book/examples/chapter5/FoodsCat.gf b/book/examples/chapter5/FoodsCat.gf deleted file mode 100644 index 5ad38d0dc..000000000 --- a/book/examples/chapter5/FoodsCat.gf +++ /dev/null @@ -1,7 +0,0 @@ ---# -path=.:present - --- (c) 2009 Jordi Saludes under LGPL - -concrete FoodsCat of Foods = FoodsI with - (Syntax = SyntaxCat), - (LexFoods = LexFoodsCat) ; diff --git a/book/examples/chapter5/FoodsEng.gf b/book/examples/chapter5/FoodsEng.gf deleted file mode 100644 index e1bc40c7a..000000000 --- a/book/examples/chapter5/FoodsEng.gf +++ /dev/null @@ -1,28 +0,0 @@ ---# -path=.:present - -concrete FoodsEng of Foods = - open SyntaxEng,ParadigmsEng in { - lincat - Comment = Utt ; - Item = NP ; - Kind = CN ; - Quality = AP ; - lin - Pred item quality = mkUtt (mkCl item quality) ; - This kind = mkNP this_Quant kind ; - That kind = mkNP that_Quant kind ; - These kind = mkNP this_Quant plNum kind ; - Those kind = mkNP that_Quant plNum kind ; - Mod quality kind = mkCN quality kind ; - Wine = mkCN (mkN "wine") ; - Pizza = mkCN (mkN "pizza") ; - Cheese = mkCN (mkN "cheese") ; - Fish = mkCN (mkN "fish" "fish") ; - Very quality = mkAP very_AdA quality ; - Fresh = mkAP (mkA "fresh") ; - Warm = mkAP (mkA "warm") ; - Italian = mkAP (mkA "Italian") ; - Expensive = mkAP (mkA "expensive") ; - Delicious = mkAP (mkA "delicious") ; - Boring = mkAP (mkA "boring") ; -} diff --git a/book/examples/chapter5/FoodsFin.gf b/book/examples/chapter5/FoodsFin.gf deleted file mode 100644 index 34da5764b..000000000 --- a/book/examples/chapter5/FoodsFin.gf +++ /dev/null @@ -1,7 +0,0 @@ ---# -path=.:present - --- (c) 2009 Aarne Ranta under LGPL - -concrete FoodsFin of Foods = FoodsI with - (Syntax = SyntaxFin), - (LexFoods = LexFoodsFin) ; diff --git a/book/examples/chapter5/FoodsGer.gf b/book/examples/chapter5/FoodsGer.gf deleted file mode 100644 index 934cefb9c..000000000 --- a/book/examples/chapter5/FoodsGer.gf +++ /dev/null @@ -1,7 +0,0 @@ ---# -path=.:present - --- (c) 2009 Aarne Ranta under LGPL - -concrete FoodsGer of Foods = FoodsI with - (Syntax = SyntaxGer), - (LexFoods = LexFoodsGer) ; diff --git a/book/examples/chapter5/FoodsI.gf b/book/examples/chapter5/FoodsI.gf deleted file mode 100644 index f4113b724..000000000 --- a/book/examples/chapter5/FoodsI.gf +++ /dev/null @@ -1,29 +0,0 @@ --- (c) 2009 Aarne Ranta under LGPL - -incomplete concrete FoodsI of Foods = - open Syntax, LexFoods in { - lincat - Comment = Utt ; - Item = NP ; - Kind = CN ; - Quality = AP ; - lin - Pred item quality = mkUtt (mkCl item quality) ; - This kind = mkNP this_Det kind ; - That kind = mkNP that_Det kind ; - These kind = mkNP these_Det kind ; - Those kind = mkNP those_Det kind ; - Mod quality kind = mkCN quality kind ; - Very quality = mkAP very_AdA quality ; - - Wine = mkCN wine_N ; - Pizza = mkCN pizza_N ; - Cheese = mkCN cheese_N ; - Fish = mkCN fish_N ; - Fresh = mkAP fresh_A ; - Warm = mkAP warm_A ; - Italian = mkAP italian_A ; - Expensive = mkAP expensive_A ; - Delicious = mkAP delicious_A ; - Boring = mkAP boring_A ; -} diff --git a/book/examples/chapter5/FoodsIta.gf b/book/examples/chapter5/FoodsIta.gf deleted file mode 100644 index 51baf9d70..000000000 --- a/book/examples/chapter5/FoodsIta.gf +++ /dev/null @@ -1,8 +0,0 @@ ---# -path=.:present - --- (c) 2009 Aarne Ranta under LGPL - -concrete FoodsIta of Foods = FoodsI with - (Syntax = SyntaxIta), - (LexFoods = LexFoodsIta) ; - diff --git a/book/examples/chapter5/FoodsSwe.gf b/book/examples/chapter5/FoodsSwe.gf deleted file mode 100644 index cbb35fb98..000000000 --- a/book/examples/chapter5/FoodsSwe.gf +++ /dev/null @@ -1,7 +0,0 @@ ---# -path=.:present - --- (c) 2009 Aarne Ranta under LGPL - -concrete FoodsSwe of Foods = FoodsI with - (Syntax = SyntaxSwe), - (LexFoods = LexFoodsSwe) ** {flags language = sv_SE;} ; diff --git a/book/examples/chapter5/LexFoods.gf b/book/examples/chapter5/LexFoods.gf deleted file mode 100644 index 12ace208c..000000000 --- a/book/examples/chapter5/LexFoods.gf +++ /dev/null @@ -1,15 +0,0 @@ --- (c) 2009 Aarne Ranta under LGPL - -interface LexFoods = open Syntax in { - oper - wine_N : N ; - pizza_N : N ; - cheese_N : N ; - fish_N : N ; - fresh_A : A ; - warm_A : A ; - italian_A : A ; - expensive_A : A ; - delicious_A : A ; - boring_A : A ; -} diff --git a/book/examples/chapter5/LexFoodsCat.gf b/book/examples/chapter5/LexFoodsCat.gf deleted file mode 100644 index 624fc98c8..000000000 --- a/book/examples/chapter5/LexFoodsCat.gf +++ /dev/null @@ -1,18 +0,0 @@ --- (c) 2009 Jordi Saludes under LGPL - -instance LexFoodsCat of LexFoods = - open SyntaxCat, ParadigmsCat, (M = MorphoCat) in { - flags - coding = utf8 ; - oper - wine_N = mkN "vi" "vins" M.Masc ; - pizza_N = mkN "pizza" ; - cheese_N = mkN "formatge" ; - fish_N = mkN "peix" "peixos" M.Masc; - fresh_A = mkA "fresc" "fresca" "frescos" "fresques" "frescament"; - warm_A = mkA "calent" ; - italian_A = mkA "italià" "italiana" "italians" "italianes" "italianament" ; - expensive_A = mkA "car" ; - delicious_A = mkA "deliciós" "deliciosa" "deliciosos" "delicioses" "deliciosament"; - boring_A = mkA "aburrit" "aburrida" "aburrits" "aburrides" "aburridament" ; -} diff --git a/book/examples/chapter5/LexFoodsEng.gf b/book/examples/chapter5/LexFoodsEng.gf deleted file mode 100644 index 01024b356..000000000 --- a/book/examples/chapter5/LexFoodsEng.gf +++ /dev/null @@ -1,20 +0,0 @@ -instance LexFoodsEng of LexFoods = open SyntaxEng, ParadigmsEng, IrregEng in { - oper - wine_N = mkN "wine" ; - pizza_N = mkN "pizza" ; - cheese_N = mkN "cheese" ; - fish_N = mkN "fish" "fish" ; - fresh_A = mkA "fresh" ; - warm_A = mkA "warm" ; - italian_A = mkA "Italian" ; - expensive_A = mkA "expensive" ; - delicious_A = mkA "delicious" ; - boring_A = mkA "boring" ; - - eat_V2 = mkV2 eat_V ; - drink_V2 = mkV2 drink_V ; - pay_V2 = mkV2 pay_V ; - lady_N = mkN "lady" ; - gentleman_N = mkN "gentleman" "gentlemen" ; - -} diff --git a/book/examples/chapter5/LexFoodsFin.gf b/book/examples/chapter5/LexFoodsFin.gf deleted file mode 100644 index 4cf26511a..000000000 --- a/book/examples/chapter5/LexFoodsFin.gf +++ /dev/null @@ -1,20 +0,0 @@ --- (c) 2009 Aarne Ranta under LGPL - -instance LexFoodsFin of LexFoods = - open SyntaxFin, ParadigmsFin in { - oper - wine_N = mkN "viini" ; - pizza_N = mkN "pizza" ; - cheese_N = mkN "juusto" ; - fish_N = mkN "kala" ; - fresh_A = mkA "tuore" ; - warm_A = mkA - (mkN "lmmin" "lmpimn" "lmmint" "lmpimn" "lmpimn" - "lmpimin" "lmpimi" "lmpimien" "lmpimiss" "lmpimiin" - ) - "lmpimmpi" "lmpimin" ; - italian_A = mkA "italialainen" ; - expensive_A = mkA "kallis" ; - delicious_A = mkA "herkullinen" ; - boring_A = mkA "tyls" ; -} diff --git a/book/examples/chapter5/LexFoodsGer.gf b/book/examples/chapter5/LexFoodsGer.gf deleted file mode 100644 index a420e22d3..000000000 --- a/book/examples/chapter5/LexFoodsGer.gf +++ /dev/null @@ -1,16 +0,0 @@ --- (c) 2009 Aarne Ranta under LGPL - -instance LexFoodsGer of LexFoods = - open SyntaxGer, ParadigmsGer in { - oper - wine_N = mkN "Wein" ; - pizza_N = mkN "Pizza" "Pizzen" feminine ; - cheese_N = mkN "Kse" "Kse" masculine ; - fish_N = mkN "Fisch" ; - fresh_A = mkA "frisch" ; - warm_A = mkA "warm" "wrmer" "wrmste" ; - italian_A = mkA "italienisch" ; - expensive_A = mkA "teuer" ; - delicious_A = mkA "kstlich" ; - boring_A = mkA "langweilig" ; -} diff --git a/book/examples/chapter5/LexFoodsIta.gf b/book/examples/chapter5/LexFoodsIta.gf deleted file mode 100644 index 11de5fcda..000000000 --- a/book/examples/chapter5/LexFoodsIta.gf +++ /dev/null @@ -1,16 +0,0 @@ --- (c) 2009 Aarne Ranta under LGPL - -instance LexFoodsIta of LexFoods = - open SyntaxIta, ParadigmsIta in { - oper - wine_N = mkN "vino" ; - pizza_N = mkN "pizza" ; - cheese_N = mkN "formaggio" ; - fish_N = mkN "pesce" ; - fresh_A = mkA "fresco" ; - warm_A = mkA "caldo" ; - italian_A = mkA "italiano" ; - expensive_A = mkA "caro" ; - delicious_A = mkA "delizioso" ; - boring_A = mkA "noioso" ; -} diff --git a/book/examples/chapter5/LexFoodsSwe.gf b/book/examples/chapter5/LexFoodsSwe.gf deleted file mode 100644 index 72e7e3e86..000000000 --- a/book/examples/chapter5/LexFoodsSwe.gf +++ /dev/null @@ -1,16 +0,0 @@ --- (c) 2009 Aarne Ranta under LGPL - -instance LexFoodsSwe of LexFoods = - open SyntaxSwe, ParadigmsSwe in { - oper - wine_N = mkN "vin" "vinet" "viner" "vinerna" ; - pizza_N = mkN "pizza" ; - cheese_N = mkN "ost" ; - fish_N = mkN "fisk" ; - fresh_A = mkA "frsk" ; - warm_A = mkA "varm" ; - italian_A = mkA "italiensk" ; - expensive_A = mkA "dyr" ; - delicious_A = mkA "lcker" ; - boring_A = mkA "trkig" ; -} diff --git a/book/examples/chapter6/Aggregation.gf b/book/examples/chapter6/Aggregation.gf deleted file mode 100644 index 28cbd39ef..000000000 --- a/book/examples/chapter6/Aggregation.gf +++ /dev/null @@ -1,33 +0,0 @@ -abstract Aggregation = { - cat S ; NP ; VP ; - data - PredVP : NP -> VP -> S ; - ConjS : S -> S -> S ; - ConjVP : VP -> VP -> VP ; - ConjNP : NP -> NP -> NP ; - Run, Walk : VP ; - John, Mary : NP ; - - fun aggr : S -> S ; -- main aggregation function - def aggr (ConjS (PredVP x X) (PredVP y Y)) = - ifS (eqNP x y) - (PredVP x (ConjVP X Y)) - (ifS (eqVP X Y) - (PredVP (ConjNP x y) X) - (ConjS (PredVP x X) (PredVP y Y))) ; - fun ifS : Bool -> S -> S -> S ; -- if b then x else y - def - ifS True x _ = x ; - ifS False _ y = y ; - fun eqNP : NP -> NP -> Bool ; -- x == y - def - eqNP John John = True ; - eqNP Mary Mary = True ; - eqNP _ _ = False ; - fun eqVP : VP -> VP -> Bool ; -- X == Y - def - eqVP Run Run = True ; - eqVP Walk Walk = True ; - eqVP _ _ = False ; - cat Bool ; data True, False : Bool ; -} diff --git a/book/examples/chapter6/AggregationEng.gf b/book/examples/chapter6/AggregationEng.gf deleted file mode 100644 index 9ed403c79..000000000 --- a/book/examples/chapter6/AggregationEng.gf +++ /dev/null @@ -1,17 +0,0 @@ -concrete AggregationEng of Aggregation = { - -lincat S, NP, VP = Str ; - -lin - PredVP x y = x ++ y ; - ConjS a b = a ++ "or" ++ b ; - ConjVP a b = a ++ "or" ++ b ; - ConjNP a b = a ++ "or" ++ b ; - - Run = "runs" ; - Walk = "walks" ; - John = "John" ; - Mary = "Mary" ; - -} - diff --git a/book/examples/chapter6/Arithm.gf b/book/examples/chapter6/Arithm.gf deleted file mode 100644 index 685627745..000000000 --- a/book/examples/chapter6/Arithm.gf +++ /dev/null @@ -1,30 +0,0 @@ -abstract Arithm = { - cat - Prop ; -- proposition - Nat ; -- natural number - data - Zero : Nat ; -- 0 - Succ : Nat -> Nat ; -- the successor of x - fun - Even : Nat -> Prop ; -- x is even - And : Prop -> Prop -> Prop ; -- A and B - - cat Less Nat Nat ; - data LessZ : (y : Nat) -> Less Zero (Succ y) ; - data LessS : (x,y : Nat) -> Less x y -> Less (Succ x) (Succ y) ; - - cat Span ; - data FromTo : (m,n : Nat) -> Less m n -> Span ; - - fun one : Nat ; - def one = Succ Zero ; - - fun twice : Nat -> Nat ; - def twice x = plus x x ; - - fun plus : Nat -> Nat -> Nat ; - def - plus x Zero = x ; - plus x (Succ y) = Succ (plus x y) ; - -} diff --git a/book/examples/chapter6/Bin.gf b/book/examples/chapter6/Bin.gf deleted file mode 100644 index c181656f8..000000000 --- a/book/examples/chapter6/Bin.gf +++ /dev/null @@ -1,50 +0,0 @@ -abstract Bin = { - -cat Nat ; Bin ; Pos ; - -data - Zero : Nat ; - Succ : Nat -> Nat ; - - BZero : Bin ; -- 0 - BPos : Pos -> Bin ; -- p - BOne : Pos ; -- 1 - AZero : Pos -> Pos ; -- p0 - AOne : Pos -> Pos ; -- p1 - -fun - bin2nat : Bin -> Nat ; -def - bin2nat BZero = Zero ; - bin2nat (BPos p) = pos2nat p ; -fun - pos2nat : Pos -> Nat ; -def - pos2nat BOne = one ; - pos2nat (AZero p) = twice (pos2nat p) ; - pos2nat (AOne p) = Succ (twice (pos2nat p)) ; -fun one : Nat ; -def one = Succ Zero ; -fun twice : Nat -> Nat ; -def - twice Zero = Zero ; - twice (Succ n) = Succ (Succ (twice n)) ; - -fun - nat2bin : Nat -> Bin ; -def - nat2bin Zero = BZero ; - nat2bin (Succ n) = bSucc (nat2bin n) ; -fun - bSucc : Bin -> Bin ; -def - bSucc BZero = BPos BOne ; - bSucc (BPos p) = BPos (pSucc p) ; -fun - pSucc : Pos -> Pos ; -def - pSucc BOne = AZero BOne ; - pSucc (AZero p) = AOne p ; - pSucc (AOne p) = AZero (pSucc p) ; - -} \ No newline at end of file diff --git a/book/examples/chapter6/Classes.gf b/book/examples/chapter6/Classes.gf deleted file mode 100644 index ac7430d25..000000000 --- a/book/examples/chapter6/Classes.gf +++ /dev/null @@ -1,28 +0,0 @@ -abstract Classes = { - -flags - startcat = Command ; - -cat - Command ; - Kind ; - Class ; - Instance Class Kind ; - Action Class ; - Device Kind ; - -fun - Act : (c : Class) -> (k : Kind) -> Instance c k -> Action c -> Device k -> Command ; - The : (k : Kind) -> Device k ; - - Light, Fan : Kind ; - Switchable, Dimmable : Class ; - - SwitchOn, SwitchOff : Action Switchable ; - Dim : Action Dimmable ; - - switchable_Light : Instance Switchable Light ; - switchable_Fan : Instance Switchable Fan ; - dimmable_Light : Instance Dimmable Light ; - -} diff --git a/book/examples/chapter6/ClassesEng.gf b/book/examples/chapter6/ClassesEng.gf deleted file mode 100644 index 5bdf80c35..000000000 --- a/book/examples/chapter6/ClassesEng.gf +++ /dev/null @@ -1,29 +0,0 @@ ---# -path=.:present - -concrete ClassesEng of Classes = open SyntaxEng, ParadigmsEng in { - -lincat - Command = Utt ; - Kind = CN ; - Class = {} ; - Instance = {} ; - Action = V2 ; - Device = NP ; - -lin - Act _ _ _ a d = mkUtt (mkImp a d) ; - The k = mkNP the_Det k ; - - Light = mkCN (mkN "light") ; - Fan = mkCN (mkN "fan") ; - Switchable, Dimmable = <> ; - - SwitchOn = mkV2 (partV (mkV "switch") "on") ; - SwitchOff = mkV2 (partV (mkV "switch") "off") ; - Dim = mkV2 (mkV "dim") ; - - switchable_Light = <> ; - switchable_Fan = <> ; - dimmable_Light = <> ; - -} diff --git a/book/examples/chapter6/DShopping.gf b/book/examples/chapter6/DShopping.gf deleted file mode 100644 index a5a06e070..000000000 --- a/book/examples/chapter6/DShopping.gf +++ /dev/null @@ -1,24 +0,0 @@ -abstract DShopping = { - flags startcat = Comment ; - cat - Comment ; - Dom ; - Item Dom ; - Kind Dom ; - Quality Dom ; - fun - DFood, DCloth : Dom ; - - Pred : (d : Dom) -> Item d -> Quality d -> Comment ; - This, That : (d : Dom) -> Kind d -> Item d ; - Mod : (d : Dom) -> Quality d -> Kind d -> Kind d ; - Wine, Cheese, Fish : Kind DFood ; - Very : (d : Dom) -> Quality d -> Quality d ; - Fresh, Warm, Delicious, Boring : Quality DFood ; - - Shirt, Jacket : Kind DCloth ; - Comfortable : Quality DCloth ; - - Italian, Expensive, Elegant : (d : Dom) -> Quality d ; - -} diff --git a/book/examples/chapter6/DShoppingEng.gf b/book/examples/chapter6/DShoppingEng.gf deleted file mode 100644 index 3dc3a2cc2..000000000 --- a/book/examples/chapter6/DShoppingEng.gf +++ /dev/null @@ -1,33 +0,0 @@ ---# -path=.:present - -concrete DShoppingEng of DShopping = open SyntaxEng, ParadigmsEng in { - - lincat - Comment = Cl ; - Item = NP ; - Kind = CN ; - Quality = AP ; - lin - Pred _ item quality = mkCl item quality ; - This _ kind = mkNP this_QuantSg kind ; - That _ kind = mkNP that_QuantSg kind ; - Mod _ quality kind = mkCN quality kind ; - Very _ quality = mkAP very_AdA quality ; - - Shirt = mkCN (mkN "shirt") ; - Jacket = mkCN (mkN "jacket") ; - Wine = mkCN (mkN "wine") ; - Cheese = mkCN (mkN "cheese") ; - Fish = mkCN (mkN "fish" "fish") ; - Fresh = mkAP (mkA "fresh") ; - Warm = mkAP (mkA "warm") ; - Italian _ = mkAP (mkA "Italian") ; - Expensive _ = mkAP (mkA "expensive") ; - Elegant _ = mkAP (mkA "elegant") ; - Delicious = mkAP (mkA "delicious") ; - Boring = mkAP (mkA "boring") ; - Comfortable = mkAP (mkA "comfortable") ; - - DFood, DCloth = {s = []} ; - -} diff --git a/book/examples/chapter6/Nat.gf b/book/examples/chapter6/Nat.gf deleted file mode 100644 index ba0dfe4a1..000000000 --- a/book/examples/chapter6/Nat.gf +++ /dev/null @@ -1,22 +0,0 @@ -abstract Nat = { - cat - Prop ; -- proposition - Nat ; -- natural number - data - Zero : Nat ; -- 0 - Succ : Nat -> Nat ; -- the successor of x - fun - Even : Nat -> Prop ; -- x is even - And : Prop -> Prop -> Prop ; -- A and B - - fun one : Nat ; - def one = Succ Zero ; - - fun twice : Nat -> Nat ; - def twice x = plus x x ; - - fun plus : Nat -> Nat -> Nat ; - def - plus x Zero = x ; - plus x (Succ y) = Succ (plus x y) ; -} diff --git a/book/examples/chapter6/Smart.gf b/book/examples/chapter6/Smart.gf deleted file mode 100644 index 6fc3e0bc5..000000000 --- a/book/examples/chapter6/Smart.gf +++ /dev/null @@ -1,16 +0,0 @@ -abstract Smart = { - - cat - Command ; - Kind ; - Device Kind ; - Action Kind ; - - fun - Act : (k : Kind) -> Action k -> Device k -> Command ; - The : (k : Kind) -> Device k ; -- the light - Light, Fan : Kind ; - Dim : Action Light ; - SwitchOn, SwitchOff : (k : Kind) -> Action k ; - -} diff --git a/book/examples/chapter6/Verbs.gf b/book/examples/chapter6/Verbs.gf deleted file mode 100644 index 371450aeb..000000000 --- a/book/examples/chapter6/Verbs.gf +++ /dev/null @@ -1,22 +0,0 @@ -abstract Verbs = { - -cat - S ; NP ; Subcat ; V Subcat ; Args Subcat ; - -fun - cIntr : Subcat ; - cTr : Subcat ; - cS : Subcat ; - - aIntr : NP -> Args cIntr ; - aTr : NP -> NP -> Args cTr ; - aS : NP -> S -> Args cS ; - - pred : (s : Subcat) -> V s -> Args s -> S ; - - john, mary : NP ; - walk : V cIntr ; - love : V cTr ; - know : V cS ; - -} \ No newline at end of file diff --git a/book/examples/chapter6/VerbsEng.gf b/book/examples/chapter6/VerbsEng.gf deleted file mode 100644 index b235178d9..000000000 --- a/book/examples/chapter6/VerbsEng.gf +++ /dev/null @@ -1,22 +0,0 @@ -concrete VerbsEng of Verbs = { - -lincat - S, NP, Subcat, V = Str ; Args = Str * Str ; - -lin - cIntr = [] ; - cTr = [] ; - cS = [] ; - - aIntr su = ; - aTr su ob = ; - aS su s = ; - - pred _ v xs = xs.p1 ++ v ++ xs.p2 ; - - john = "John" ; mary = "Mary" ; - walk = "walks" ; - love = "loves" ; - know = "knows" ; - -} diff --git a/book/examples/chapter7/Map.gf b/book/examples/chapter7/Map.gf deleted file mode 100644 index 52deebb87..000000000 --- a/book/examples/chapter7/Map.gf +++ /dev/null @@ -1,10 +0,0 @@ -abstract Map = { -flags startcat = Query ; -cat - Query ; Input ; Place ; Click ; -fun - GoFromTo : Place -> Place -> Input ; - ThisPlace : Click -> Place ; - QueryInput : Input -> Query ; - ClickCoord : Int -> Int -> Click ; -} diff --git a/book/examples/chapter7/MapEng.gf b/book/examples/chapter7/MapEng.gf deleted file mode 100644 index fee0b502c..000000000 --- a/book/examples/chapter7/MapEng.gf +++ /dev/null @@ -1,17 +0,0 @@ -concrete MapEng of Map = { -lincat - Query = {s : Str} ; - Input, Place = {s : Str ; p : Str} ; - Click = {p : Str} ; -lin - GoFromTo x y = { - s = "I want to go from" ++ x.s ++ "to" ++ y.s ; - p = x.p ++ y.p - } ; - ThisPlace c = { - s = "this place" ; - p = c.p - } ; - QueryInput i = {s = i.s ++ ";" ++ i.p} ; - ClickCoord x y = {p = "(" ++ x.s ++ "," ++ y.s ++ ")"} ; -} diff --git a/book/examples/chapter7/Query.gf b/book/examples/chapter7/Query.gf deleted file mode 100644 index b6f83e357..000000000 --- a/book/examples/chapter7/Query.gf +++ /dev/null @@ -1,12 +0,0 @@ -abstract Query = { - flags startcat=Question ; - cat - Answer ; Question ; Object ; - fun - Even : Object -> Question ; - Odd : Object -> Question ; - Prime : Object -> Question ; - Number : Int -> Object ; - Yes : Answer ; - No : Answer ; -} diff --git a/book/examples/chapter7/QueryEng.gf b/book/examples/chapter7/QueryEng.gf deleted file mode 100644 index cc14d5eb7..000000000 --- a/book/examples/chapter7/QueryEng.gf +++ /dev/null @@ -1,13 +0,0 @@ -concrete QueryEng of Query = { - lincat - Answer, Question, Object = Str ; - lin - Even = pred "even" ; - Odd = pred "odd" ; - Prime = pred "prime" ; - Number i = i.s ; - Yes = "yes" ; - No = "no" ; - oper - pred : Str -> Str -> Str = \f,x -> "is" ++ x ++ f ; -} diff --git a/book/examples/chapter7/QueryFin.gf b/book/examples/chapter7/QueryFin.gf deleted file mode 100644 index b3461e34a..000000000 --- a/book/examples/chapter7/QueryFin.gf +++ /dev/null @@ -1,13 +0,0 @@ -concrete QueryFin of Query = { - lincat - Answer, Question, Object = Str ; - lin - Even = pred "parillinen" ; - Odd = pred "pariton" ; - Prime = pred "alkuluku" ; - Number i = i.s ; - Yes = "kyll" ; - No = "ei" ; - oper - pred : Str -> Str -> Str = \f,x -> "onko" ++ x ++ f ; -} diff --git a/book/examples/chapter8/Calculator.gf b/book/examples/chapter8/Calculator.gf deleted file mode 100644 index 188c150e0..000000000 --- a/book/examples/chapter8/Calculator.gf +++ /dev/null @@ -1,7 +0,0 @@ -abstract Calculator = { -flags startcat = Exp ; -cat Exp ; -fun - EPlus, EMinus, ETimes, EDiv : Exp -> Exp -> Exp ; - EInt : Int -> Exp ; -} diff --git a/book/examples/chapter8/CalculatorC.gf b/book/examples/chapter8/CalculatorC.gf deleted file mode 100644 index 99db80530..000000000 --- a/book/examples/chapter8/CalculatorC.gf +++ /dev/null @@ -1,10 +0,0 @@ -concrete CalculatorC of Calculator = open Formal, Prelude in { -lincat - Exp = TermPrec ; -lin - EPlus = infixl 0 "+" ; - EMinus = infixl 0 "-" ; - ETimes = infixl 1 "*" ; - EDiv = infixl 1 "/" ; - EInt i = constant i.s ; -} diff --git a/book/examples/chapter8/CalculatorJ.gf b/book/examples/chapter8/CalculatorJ.gf deleted file mode 100644 index c5f40c8d3..000000000 --- a/book/examples/chapter8/CalculatorJ.gf +++ /dev/null @@ -1,13 +0,0 @@ -concrete CalculatorJ of Calculator = open Prelude in { -lincat - Exp = SS ; -lin - EPlus = postfix "iadd" ; - EMinus = postfix "isub" ; - ETimes = postfix "imul" ; - EDiv = postfix "idiv" ; - EInt i = ss ("ldc" ++ i.s) ; -oper - postfix : Str -> SS -> SS -> SS = \op,x,y -> - ss (x.s ++ ";" ++ y.s ++ ";" ++ op) ; -} diff --git a/book/examples/chapter8/CalculatorP.gf b/book/examples/chapter8/CalculatorP.gf deleted file mode 100644 index 4e6315827..000000000 --- a/book/examples/chapter8/CalculatorP.gf +++ /dev/null @@ -1,14 +0,0 @@ -concrete CalculatorP of Calculator = open Prelude in { - -lincat - Exp = SS ; -lin - EPlus = infix "+" ; - EMinus = infix "-" ; - ETimes = infix "*" ; - EDiv = infix "/" ; - EInt i = i ; -oper - infix : Str -> SS -> SS -> SS = \f,x,y -> - ss ("(" ++ x.s ++ f ++ y.s ++ ")") ; -} diff --git a/book/examples/chapter8/CalculatorS.gf b/book/examples/chapter8/CalculatorS.gf deleted file mode 100644 index d8c1df456..000000000 --- a/book/examples/chapter8/CalculatorS.gf +++ /dev/null @@ -1,11 +0,0 @@ -concrete CalculatorS of Calculator = open Prelude in { - lin - EPlus = infix "plus" ; - EMinus = infix "minus" ; - ETimes = infix "times" ; - EDiv = infix ["divided by"] ; - EInt i = i ; - oper - infix : Str -> SS -> SS -> SS = \op,x,y -> - ss (x.s ++ op ++ y.s ++ "PAUSE") ; -} diff --git a/book/examples/chapter8/Geometry.gf b/book/examples/chapter8/Geometry.gf deleted file mode 100644 index 0b27d8714..000000000 --- a/book/examples/chapter8/Geometry.gf +++ /dev/null @@ -1,7 +0,0 @@ -abstract Geometry = Logic ** { -fun - Line, Point, Circle : Dom ; - Intersect, Parallel : Ind -> Ind -> Atom ; - Vertical : Ind -> Atom ; - Centre : Ind -> Ind ; -} diff --git a/book/examples/chapter8/GeometryEng.gf b/book/examples/chapter8/GeometryEng.gf deleted file mode 100644 index e2e22776e..000000000 --- a/book/examples/chapter8/GeometryEng.gf +++ /dev/null @@ -1,13 +0,0 @@ ---# -path=.:present - -concrete GeometryEng of Geometry = LogicEng ** - open SyntaxEng, ParadigmsEng in { -lin - Line = mkCN (mkN "line") ; - Point = mkCN (mkN "point") ; - Circle = mkCN (mkN "circle") ; - Intersect = pred (mkV2 "intersect") ; - Parallel = pred (mkA2 (mkA "parallel") (mkPrep "to")) ; - Vertical = pred (mkA "vertical") ; - Centre = app (mkN2 (mkN "centre") (mkPrep "of")) ; -} diff --git a/book/examples/chapter8/GeometryEngb.gf b/book/examples/chapter8/GeometryEngb.gf deleted file mode 100644 index 265f3f71a..000000000 --- a/book/examples/chapter8/GeometryEngb.gf +++ /dev/null @@ -1,11 +0,0 @@ -concrete GeometryEng of Geometry = LogicEng ** - open SyntaxEng, ParadigmsEng in { -lin - Line = mkN "line" ; - Point = mkN "point" ; - Circle = mkN "circle" ; - Intersect = pred (mkV2 "intersect") ; - Parallel = pred (mkA2 (mkA "parallel") (mkPrep "to")) ; - Vertical = pred (mkA "vertical") ; - Centre = app (mkN2 (mkN "centre") (mkPrep "of")) ; -} diff --git a/book/examples/chapter8/Geometryb.gf b/book/examples/chapter8/Geometryb.gf deleted file mode 100644 index dc39c9ce4..000000000 --- a/book/examples/chapter8/Geometryb.gf +++ /dev/null @@ -1,7 +0,0 @@ -abstract Geometry = Logic ** { -fun - Line, Point, Circle : Dom ; - Intersect, Parallel : Ind -> Ind -> Prop ; - Vertical : Ind -> Prop ; - Centre : Ind -> Ind ; -} diff --git a/book/examples/chapter8/Graftal.gf b/book/examples/chapter8/Graftal.gf deleted file mode 100644 index e85b9b2f7..000000000 --- a/book/examples/chapter8/Graftal.gf +++ /dev/null @@ -1,7 +0,0 @@ --- (c) Krasimir Angelov 2009 -abstract Graftal = { - cat N; S; - fun z : N ; - s : N -> N ; - c : N -> S ; - } diff --git a/book/examples/chapter8/Logic.gf b/book/examples/chapter8/Logic.gf deleted file mode 100644 index f2b292428..000000000 --- a/book/examples/chapter8/Logic.gf +++ /dev/null @@ -1,21 +0,0 @@ -abstract Logic = { -flags startcat = Stm ; -cat - Stm ; -- top-level statement - Prop ; -- proposition - Atom ; -- atomic formula - Ind ; -- individual term - Dom ; -- domain expression - Var ; -- variable - [Prop] {2} ; -- list of propositions, 2 or more - [Var] {1} ; -- list of variables, 1 or more -fun - SProp : Prop -> Stm ; - And, Or : [Prop] -> Prop ; - If : Prop -> Prop -> Prop ; - Not : Prop -> Prop ; - PAtom : Atom -> Prop ; - All, Exist : [Var] -> Dom -> Prop -> Prop ; - IVar : Var -> Ind ; - VString : String -> Var ; -} diff --git a/book/examples/chapter8/LogicBEng.gf b/book/examples/chapter8/LogicBEng.gf deleted file mode 100644 index b950c6b39..000000000 --- a/book/examples/chapter8/LogicBEng.gf +++ /dev/null @@ -1,38 +0,0 @@ -concrete LogicEng of Logic = open - SyntaxEng, (P = ParadigmsEng), SymbolicEng, Prelude in { -lincat - Stm = Text ; - Prop = S ; - Atom = Cl ; - Ind = NP ; - Dom = CN ; - Var = NP ; - [Prop] = [S] ; - [Var] = NP ; -lin - SProp = mkText ; - And = mkS and_Conj ; -- A, B ... and C - Or = mkS or_Conj ; -- A, B ... or C - If A B = -- if A B - mkS (mkAdv if_Subj A) B ; - Not A = -- it is not the case that A - mkS negativePol (mkCl - (mkVP (mkNP the_Quant - (mkCN case_CN A)))) ; - All xs A B = -- for all A's xs, B - mkS (mkAdv for_Prep - (mkNP all_Predet (mkNP a_Quant - plNum (mkCN A xs)))) B ; - Exist xs A B = -- for some A's xs, B - mkS (mkAdv for_Prep - (mkNP somePl_Det (mkCN A xs))) B ; - PAtom = mkS ; - IVar x = x ; - VString s = symb s ; - BaseProp A B = mkListS A B ; - ConsProp A As = mkListS A As ; - BaseVar x = x ; - ConsVar x xs = mkNP and_Conj (mkListNP x xs) ; -oper - case_CN : CN = mkCN (P.mkN "case") ; -} diff --git a/book/examples/chapter8/LogicEng.gf b/book/examples/chapter8/LogicEng.gf deleted file mode 100644 index eae85d255..000000000 --- a/book/examples/chapter8/LogicEng.gf +++ /dev/null @@ -1,39 +0,0 @@ -concrete LogicEng of Logic = open - SyntaxEng, (P = ParadigmsEng), SymbolicEng, Prelude in { -lincat - Stm = Text ; - Prop = {pos,neg : S ; isAtom : Bool} ; - Atom = Cl ; - Ind = NP ; - Dom = CN ; - Var = NP ; - [Prop] = ListS ; - [Var] = NP ; -lin - SProp p = mkText p.pos ; - And ps = complexProp (mkS and_Conj ps) ; - Or ps = complexProp (mkS or_Conj ps) ; - If A B = complexProp (mkS if_then_Conj (mkListS A.pos B.pos)) ; - Not A = complexProp A.neg ; - All xs A B = complexProp (mkS (mkAdv for_Prep - (mkNP all_Predet (mkNP a_Quant plNum (mkCN A xs)))) B.pos) ; - Exist xs A B = complexProp (mkS (mkAdv for_Prep - (mkNP somePl_Det (mkCN A xs))) B.pos) ; - PAtom p = - {pos = mkS p ; neg = mkS negativePol p ; isAtom = True} ; - IVar x = x ; - VString s = symb s ; - BaseProp A B = mkListS A.pos B.pos ; - ConsProp A As = mkListS A.pos As ; - BaseVar x = x ; - ConsVar x xs = mkNP and_Conj (mkListNP x xs) ; -oper - complexProp : S -> {pos,neg : S ; isAtom : Bool} = \s -> { - pos = s ; - neg = negS s ; - isAtom = False - } ; - negS : S -> S = \s -> mkS negativePol (mkCl (mkNP it_Pron) - (mkNP the_Quant (mkCN (mkCN (P.mkN "case")) s))) ; - if_Then_Conj : Conj = P.mkConj "if" "then" ; -} diff --git a/book/examples/chapter8/Logicb.gf b/book/examples/chapter8/Logicb.gf deleted file mode 100644 index 5b5aa9ab9..000000000 --- a/book/examples/chapter8/Logicb.gf +++ /dev/null @@ -1,11 +0,0 @@ -abstract Logic = { -cat - Prop ; Ind ; Dom ; Var ; [Prop] {2} ; [Var] {1} ; -fun - And, Or : [Prop] -> Prop ; - If : Prop -> Prop -> Prop ; - Not : Prop -> Prop ; - All, Exist : [Var] -> Dom -> Prop -> Prop ; - IVar : Var -> Ind ; - VString : String -> Var ; -} diff --git a/book/examples/chapter8/Sierpinski.gf b/book/examples/chapter8/Sierpinski.gf deleted file mode 100644 index 722088ce5..000000000 --- a/book/examples/chapter8/Sierpinski.gf +++ /dev/null @@ -1,16 +0,0 @@ -concrete Sierpinski of Graftal = { - lincat N = {a : Str; b : Str} ; - lincat S = {s : Str} ; - - lin z = {a = A; b = B} ; - lin s x = { - a = x.b ++ R ++ x.a ++ R ++ x.b ; - b = x.a ++ L ++ x.b ++ L ++ x.a - } ; - lin c x = {s = "newpath 300 550 moveto" ++ x.a ++ "stroke showpage"} ; - - oper A : Str = "0 2 rlineto" ; - oper B : Str = "0 2 rlineto" ; - oper L : Str = "+60 rotate" ; - oper R : Str = "-60 rotate" ; -} diff --git a/book/examples/chapter9/Anaphora.gf b/book/examples/chapter9/Anaphora.gf deleted file mode 100644 index 5cbb92c94..000000000 --- a/book/examples/chapter9/Anaphora.gf +++ /dev/null @@ -1,17 +0,0 @@ -abstract Anaphora = TestSemantics - [she_NP] ** { - -cat - Proof Prop ; - -fun - IfS : (A : S) -> (Proof (iS A) -> S) -> S ; - - AnaNP : (A : CN) -> (a : Ind) -> Proof (iCN A a) -> NP ; - - pe : (B : Ind -> Prop) -> Proof (Exist B) -> Ind ; - qe : (B : Ind -> Prop) -> (c : Proof (Exist B)) -> Proof (B (pe B c)) ; - - pc : (A,B : Prop) -> Proof (And A B) -> Proof A ; - qc : (A,B : Prop) -> Proof (And A B) -> Proof B ; - -} diff --git a/book/examples/chapter9/AnaphoraIta.gf b/book/examples/chapter9/AnaphoraIta.gf deleted file mode 100644 index 288872160..000000000 --- a/book/examples/chapter9/AnaphoraIta.gf +++ /dev/null @@ -1,17 +0,0 @@ -concrete AnaphoraIta of Anaphora = TestSemanticsIta - [she_NP] ** - open ResIta, Prelude, Formal in { - -lincat - Proof = {} ; - -lin - IfS A B = {s = "se" ++ A.s ++ B.s} ; - - AnaNP cn _ _ = case cn.g of { - Masc => pronNP "lui" "lo" "gli" Masc Sg Per3 ; - Fem => pronNP "lei" "la" "le" Fem Sg Per3 - } ; - - pe _ _ = constant [] ; ---- - -} diff --git a/book/examples/chapter9/Grammar.gf b/book/examples/chapter9/Grammar.gf deleted file mode 100644 index 57e3f8dcc..000000000 --- a/book/examples/chapter9/Grammar.gf +++ /dev/null @@ -1,39 +0,0 @@ -abstract Grammar = { - - flags startcat = S ; - - cat - S ; Cl ; NP ; VP ; AP ; CN ; - Det ; N ; A ; V ; V2 ; AdA ; - Tense ; Pol ; - Conj ; - data - UseCl : Tense -> Pol -> Cl -> S ; - PredVP : NP -> VP -> Cl ; - ComplV2 : V2 -> NP -> VP ; - DetCN : Det -> CN -> NP ; - ModCN : AP -> CN -> CN ; - - CompAP : AP -> VP ; - AdAP : AdA -> AP -> AP ; - - ConjS : Conj -> S -> S -> S ; - ConjNP : Conj -> NP -> NP -> NP ; - - UseV : V -> VP ; - UseN : N -> CN ; - UseA : A -> AP ; - - a_Det, the_Det, every_Det : Det ; - this_Det, these_Det : Det ; - that_Det, those_Det : Det ; - i_NP, she_NP, we_NP : NP ; - very_AdA : AdA ; - - Pos, Neg : Pol ; - Pres, Perf : Tense ; - - and_Conj, or_Conj : Conj ; - - -} diff --git a/book/examples/chapter9/GrammarIta.gf b/book/examples/chapter9/GrammarIta.gf deleted file mode 100644 index 93b2b78fb..000000000 --- a/book/examples/chapter9/GrammarIta.gf +++ /dev/null @@ -1,141 +0,0 @@ -concrete GrammarIta of Grammar = open ResIta, Prelude in { - lincat - S = {s : Str} ; - Cl = {s : ResIta.Tense => Bool => Str} ; - NP = ResIta.NP ; - -- {s : Case => {clit,obj : Str ; isClit : Bool} ; a : Agr} ; - VP = ResIta.VP ; - -- {v : Verb ; clit : Str ; clitAgr : ClitAgr ; obj : Agr => Str} ; - AP = {s : Gender => Number => Str ; isPre : Bool} ; - CN = Noun ; -- {s : Number => Str ; g : Gender} ; - Det = {s : Gender => Case => Str ; n : Number} ; - N = Noun ; -- {s : Number => Str ; g : Gender} ; - A = Adj ; -- {s : Gender => Number => Str ; isPre : Bool} ; - V = Verb ; -- {s : VForm => Str ; aux : Aux} ; - V2 = Verb ** {c : Case} ; - AdA = {s : Str} ; - Pol = {s : Str ; b : Bool} ; - Tense = {s : Str ; t : ResIta.Tense} ; - Conj = {s : Str ; n : Number} ; - lin - UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! p.b} ; - PredVP np vp = - let - subj = (np.s ! Nom).obj ; - obj = vp.obj ! np.a ; - clit = vp.clit ; - verb = table { - Pres => agrV vp.v np.a ; - Perf => agrV (auxVerb vp.v.aux) np.a ++ agrPart vp.v np.a vp.clitAgr - } - in { - s = \\t,b => subj ++ neg b ++ clit ++ verb ! t ++ obj - } ; - - ComplV2 v2 np = - let - nps = np.s ! v2.c - in { - v = v2 ; - clit = nps.clit ; - clitAgr = case of { - => CAgr np.a ; - _ => CAgrNo - } ; - obj = \\_ => nps.obj - } ; - - UseV v = { - v = v ; - clit = [] ; - clitAgr = CAgrNo ; - obj = \\_ => [] - } ; - - DetCN det cn = { - s = \\c => { - obj = det.s ! cn.g ! c ++ cn.s ! det.n ; - clit = [] ; - isClit = False - } ; - a = Ag cn.g det.n Per3 - } ; - - ModCN ap cn = { - s = \\n => preOrPost ap.isPre (ap.s ! cn.g ! n) (cn.s ! n) ; - g = cn.g - } ; - - CompAP ap = { - v = essere_V ; - clit = [] ; - clitAgr = CAgrNo ; - obj = \\ag => case ag of { - Ag g n _ => ap.s ! g ! n - } - } ; - - AdAP ada ap = { - s = \\g,n => ada.s ++ ap.s ! g ! n ; - isPre = ap.isPre ; - } ; - - ConjNP co nx ny = { - s = \\c => { - obj = (nx.s ! c).obj ++ co.s ++ (ny.s ! c).obj ; - clit = [] ; - isClit = False - } ; - a = conjAgr co.n nx.a ny.a - } ; - - ConjS co x y = {s = x.s ++ co.s ++ y.s} ; - - UseN n = n ; - - UseA adj = adj ; - - a_Det = adjDet (mkAdj "un" "una" [] [] True) Sg ; - - every_Det = adjDet (regAdj "ogni") Sg ; - - the_Det = { - s = table { - Masc => table { - Nom | Acc => elisForms "lo" "l'" "il" ; - Dat => elisForms "allo" "all'" "al" - } ; - Fem => table { - Nom | Acc => elisForms "la" "'l" "la" ; - Dat => elisForms "alla" "all'" "alla" - } - } ; - n = Sg - } ; - - this_Det = adjDet (regAdj "questo") Sg ; - these_Det = adjDet (regAdj "questo") Pl ; - that_Det = adjDet quello_A Sg ; - those_Det = adjDet quello_A Pl ; - - i_NP = pronNP "io" "mi" "mi" Masc Sg Per1 ; - she_NP = pronNP "lei" "la" "le" Fem Sg Per3 ; - we_NP = pronNP "noi" "ci" "ci" Masc Pl Per1 ; - - very_AdA = ss "molto" ; - - Pos = {s = [] ; b = True} ; - Neg = {s = [] ; b = False} ; - Pres = {s = [] ; t = ResIta.Pres} ; - Perf = {s = [] ; t = ResIta.Perf} ; - - and_Conj = {s = "e" ; n = Pl} ; - or_Conj = {s = "o" ; n = Sg} ; - - oper - quello_A : Adj = mkAdj - (elisForms "quello" "quell'" "quel") "quella" - (elisForms "quegli" "quegli" "quei") "quelle" - True ; - -} diff --git a/book/examples/chapter9/Logic.gf b/book/examples/chapter9/Logic.gf deleted file mode 100644 index 0ce8df7e9..000000000 --- a/book/examples/chapter9/Logic.gf +++ /dev/null @@ -1,9 +0,0 @@ -abstract Logic = { - cat - Prop ; Ind ; - data - And, Or, If : Prop -> Prop -> Prop ; - Not : Prop -> Prop ; - All, Exist : (Ind -> Prop) -> Prop ; - Past : Prop -> Prop ; -} diff --git a/book/examples/chapter9/LogicIta.gf b/book/examples/chapter9/LogicIta.gf deleted file mode 100644 index f94edc11c..000000000 --- a/book/examples/chapter9/LogicIta.gf +++ /dev/null @@ -1,54 +0,0 @@ -concrete LogicIta of Logic = GrammarIta ** open ResIta, Formal, Prelude in { - - -lincat - T, I = SS ; -lin - And x y = infixSS "&" x y ; - Or x y = infixSS "v" x y ; - If x y = infixSS "->" x y ; - Not x = prefixSS "~" x ; - All P = prefixSS (parenth ("A" ++ P.$0)) P ; - Exist P = prefixSS (parenth ("E" ++ P.$0)) P ; - Past P = prefixSS "Past" P ; - -lin - iN f = star (f.s ! Sg) ; - iA f = star (f.s ! Masc ! Sg) ; - iV f = star (f.s ! VInf) ; - iV2 f x y = star (f.s ! VInf) (cc2 x y) ; - -oper star : Str -> SS -> SS = \f,x -> prefixSS f (ss (parenth x.s)) ; - -{- - -lincat - T, I = TermPrec ; -lin - And = infixl 2 "&" ; - Or = infixl 2 "v" ; - If = infixr 1 "->" ; --- Not = prefix 3 "~" ; --- All : (I -> T) -> T ; --- Exist : (I -> T) -> T ; --- Past : T -> T ; - -lin - iS : S -> T ; - iCl : Cl -> T ; - iNP : NP -> (I -> T) -> T ; - iVP : VP -> I -> T ; - iAP : AP -> I -> T ; - iCN : CN -> I -> T ; - iDet : Det -> (I -> T) -> (I -> T) -> T ; - iN : N -> I -> T ; - iA : A -> I -> T ; - iV : V -> I -> T ; - iV2 : V2 -> I -> I -> T ; - iAdA : AdA -> (I -> T) -> I -> T ; - iTense : Tense -> T -> T ; - iPol : Pol -> T -> T ; - iConj : Conj -> T -> T -> T ; --} - -} diff --git a/book/examples/chapter9/LogicSymb.gf b/book/examples/chapter9/LogicSymb.gf deleted file mode 100644 index 14932fe9b..000000000 --- a/book/examples/chapter9/LogicSymb.gf +++ /dev/null @@ -1,13 +0,0 @@ -concrete LogicSymb of Logic = open Formal, Prelude in { - -lincat - Prop, Ind = TermPrec ; -lin - And = infixl 2 "\\&" ; - Or = infixl 2 "\\vee" ; - If = infixr 1 "\\sup" ; - Not = prefix 3 "\\sim" ; - All P = prefix 3 (parenth ("\\forall" ++ P.$0)) P ; - Exist P = prefix 3 (parenth ("\\exists" ++ P.$0)) P ; - Past = prefix 3 "P" ; -} diff --git a/book/examples/chapter9/ParadigmsIta.gf b/book/examples/chapter9/ParadigmsIta.gf deleted file mode 100644 index 010140a62..000000000 --- a/book/examples/chapter9/ParadigmsIta.gf +++ /dev/null @@ -1,47 +0,0 @@ -resource ParadigmsIta = GrammarIta [N,A,V] ** - open ResIta, GrammarIta, Prelude in { - -oper - masculine : Gender = Masc ; - feminine : Gender = Fem ; - - accusative : Case = Acc ; - dative : Case = Dat ; - - mkN = overload { - mkN : (vino : Str) -> N - = \n -> lin N (regNoun n) ; - mkN : (uomo, uomini : Str) -> Gender -> N - = \s,p,g -> lin N (mkNoun s p g) ; - } ; - - mkA = overload { - mkA : (nero : Str) -> A - = \a -> lin A (regAdj a) ; - mkA : (buono,buona,buoni,buone : Str) -> Bool -> A - = \sm,sf,pm,pf,p -> lin A (mkAdj sm sf pm pf False) ; - } ; - - preA : A -> A - = \a -> lin A {s = a.s ; isPre = True} ; - - mkV = overload { - mkV : (finire : Str) -> V - = \v -> lin V (regVerb v) ; - mkV : (andare,vado,vadi,va,andiamo,andate,vanno,andato : Str) -> V - = \i,p1,p2,p3,p4,p5,p6,p -> lin V (mkVerb i p1 p2 p3 p4 p5 p6 p Avere) ; - } ; - - essereV : V -> V - = \v -> lin V {s = v.s ; aux = Essere} ; - - mkV2 = overload { - mkV2 : Str -> V2 - = \s -> lin V2 (regVerb s ** {c = accusative}) ; - mkV2 : V -> V2 - = \v -> lin V2 (v ** {c = accusative}) ; - mkV2 : V -> Case -> V2 - = \v,c -> lin V2 (v ** {c = c}) ; - } ; - -} diff --git a/book/examples/chapter9/ResIta.gf b/book/examples/chapter9/ResIta.gf deleted file mode 100644 index f39db69f9..000000000 --- a/book/examples/chapter9/ResIta.gf +++ /dev/null @@ -1,178 +0,0 @@ -resource ResIta = open Prelude in { - --- parameters - -param - Number = Sg | Pl ; - Gender = Masc | Fem ; - Case = Nom | Acc | Dat ; - Agr = Ag Gender Number Person ; - Aux = Avere | Essere ; - Tense = Pres | Perf ; - Person = Per1 | Per2 | Per3 ; - - VForm = VInf | VPres Number Person | VPart Gender Number ; - - ClitAgr = CAgrNo | CAgr Agr ; - --- parts of speech - -oper - VP = { - v : Verb ; - clit : Str ; - clitAgr : ClitAgr ; - obj : Agr => Str - } ; - NP = { - s : Case => {clit,obj : Str ; isClit : Bool} ; - a : Agr - } ; - --- the preposition word of an abstract case - - prepCase : Case -> Str = \c -> case c of { - Dat => "a" ; - _ => [] - } ; - --- for predication - - agrV : Verb -> Agr -> Str = \v,a -> case a of { - Ag _ n p => v.s ! VPres n p - } ; - - auxVerb : Aux -> Verb = \a -> case a of { - Avere => - mkVerb "avere" "ho" "hai" "ha" "abbiamo" "avete" "hanno" "avuto" Avere ; - Essere => - mkVerb "essere" "sono" "sei" "" "siamo" "siete" "sono" "stato" Essere - } ; - - agrPart : Verb -> Agr -> ClitAgr -> Str = \v,a,c -> case v.aux of { - Avere => case c of { - CAgr (Ag g n _) => v.s ! VPart g n ; - _ => v.s ! VPart Masc Sg - } ; - Essere => case a of { - Ag g n _ => v.s ! VPart g n - } - } ; - - neg : Bool -> Str = \b -> case b of {True => [] ; False => "non"} ; - - essere_V = auxVerb Essere ; - --- for coordination - - conjAgr : Number -> Agr -> Agr -> Agr = \n,xa,ya -> - let - x = agrFeatures xa ; y = agrFeatures ya - in Ag - (conjGender x.g y.g) - (conjNumber (conjNumber x.n y.n) n) - (conjPerson x.p y.p) ; - - agrFeatures : Agr -> {g : Gender ; n : Number ; p : Person} = \a -> - case a of {Ag g n p => {g = g ; n = n ; p = p}} ; - - conjGender : Gender -> Gender -> Gender = \g,h -> - case g of {Masc => Masc ; _ => h} ; - - conjNumber : Number -> Number -> Number = \m,n -> - case m of {Pl => Pl ; _ => n} ; - - conjPerson : Person -> Person -> Person = \p,q -> - case of { - | <_,Per1> => Per1 ; - | <_,Per2> => Per2 ; - _ => Per3 - } ; - - - --- for morphology - - Noun : Type = {s : Number => Str ; g : Gender} ; - Adj : Type = {s : Gender => Number => Str ; isPre : Bool} ; - Verb : Type = {s : VForm => Str ; aux : Aux} ; - - mkNoun : Str -> Str -> Gender -> Noun = \vino,vini,g -> { - s = table {Sg => vino ; Pl => vini} ; - g = g - } ; - - regNoun : Str -> Noun = \vino -> case vino of { - fuo + c@("c"|"g") + "o" => mkNoun vino (fuo + c + "hi") Masc ; - ol + "io" => mkNoun vino (ol + "i") Masc ; - vin + "o" => mkNoun vino (vin + "i") Masc ; - cas + "a" => mkNoun vino (cas + "e") Fem ; - pan + "e" => mkNoun vino (pan + "i") Masc ; - _ => mkNoun vino vino Masc - } ; - - mkAdj : (_,_,_,_ : Str) -> Bool -> Adj = \buono,buona,buoni,buone,p -> { - s = table { - Masc => table {Sg => buono ; Pl => buoni} ; - Fem => table {Sg => buona ; Pl => buone} - } ; - isPre = p - } ; - - regAdj : Str -> Adj = \nero -> case nero of { - ner + "o" => mkAdj nero (ner + "a") (ner + "i") (ner + "e") False ; - verd + "e" => mkAdj nero nero (verd + "i") (verd + "i") False ; - _ => mkAdj nero nero nero nero False - } ; - - mkVerb : (_,_,_,_,_,_,_,_ : Str) -> Aux -> Verb = - \amare,amo,ami,ama,amiamo,amate,amano,amato,aux -> { - s = table { - VInf => amare ; - VPres Sg Per1 => amo ; - VPres Sg Per2 => ami ; - VPres Sg Per3 => ama ; - VPres Pl Per1 => amiamo ; - VPres Pl Per2 => amate ; - VPres Pl Per3 => amano ; - VPart g n => (regAdj amato).s ! g ! n - } ; - aux = aux - } ; - - regVerb : Str -> Verb = \amare -> case amare of { - am + "are" => mkVerb amare (am+"o") (am+"i") (am+"a") - (am+"iamo") (am+"ate") (am+"ano") (am+"ato") Avere ; - tem + "ere" => mkVerb amare (tem+"o") (tem+"i") (tem+"e") - (tem+"iamo") (tem+"ete") (tem+"ono") (tem+"uto") Avere ; - fin + "ire" => mkVerb amare (fin+"isco") (fin+"isci") (fin+"isce") - (fin+"iamo") (fin+"ite") (fin+"iscono") (fin+"ito") Avere - } ; - --- for structural words - - adjDet : Adj -> Number -> {s : Gender => Case => Str ; n : Number} = - \adj,n -> { - s = \\g,c => prepCase c ++ adj.s ! g ! n ; - n = n - } ; - - pronNP : (s,a,d : Str) -> Gender -> Number -> Person -> NP = - \s,a,d,g,n,p -> { - s = table { - Nom => {clit = [] ; obj = s ; isClit = False} ; - Acc => {clit = a ; obj = [] ; isClit = True} ; - Dat => {clit = d ; obj = [] ; isClit = True} - } ; - a = Ag g n p - } ; - --- phonological auxiliaries - - vowel : pattern Str = #("a" | "e" | "i" | "o" | "u" | "h") ; - s_impuro : pattern Str = #("z" | "s" + ("b"|"c"|"d"|"f"|"m"|"p"|"q"|"t")) ; - - elisForms : (_,_,_ : Str) -> Str = \lo,l',il -> - pre {#s_impuro => lo ; #vowel => l' ; _ => il} ; - -} diff --git a/book/examples/chapter9/Semantics.gf b/book/examples/chapter9/Semantics.gf deleted file mode 100644 index 0976caa93..000000000 --- a/book/examples/chapter9/Semantics.gf +++ /dev/null @@ -1,39 +0,0 @@ -abstract Semantics = Grammar, Logic ** { -fun - iS : S -> Prop ; - iCl : Cl -> Prop ; - iNP : NP -> (Ind -> Prop) -> Prop ; - iVP : VP -> Ind -> Prop ; - iAP : AP -> Ind -> Prop ; - iCN : CN -> Ind -> Prop ; - iDet : Det -> (Ind -> Prop) -> (Ind -> Prop) -> Prop ; - iN : N -> Ind -> Prop ; - iA : A -> Ind -> Prop ; - iV : V -> Ind -> Prop ; - iV2 : V2 -> Ind -> Ind -> Prop ; - iAdA : AdA -> (Ind -> Prop) -> Ind -> Prop ; - iTense : Tense -> Prop -> Prop ; - iPol : Pol -> Prop -> Prop ; - iConj : Conj -> Prop -> Prop -> Prop ; -def - iS (UseCl t p cl) = iTense t (iPol p (iCl cl)) ; - iCl (PredVP np vp) = iNP np (iVP vp) ; - iVP (ComplV2 v2 np) i = iNP np (iV2 v2 i) ; - iNP (DetCN det cn) f = iDet det (iCN cn) f ; - iCN (ModCN ap cn) i = And (iAP ap i) (iCN cn i) ; - iVP (CompAP ap) i = iAP ap i ; - iAP (AdAP ada ap) i = iAdA ada (iAP ap) i ; - iS (ConjS conj x y) = iConj conj (iS x) (iS y) ; - iNP (ConjNP conj x y) f = iConj conj (iNP x f) (iNP y f) ; - iVP (UseV v) i = iV v i ; - iAP (UseA a) i = iA a i ; - iCN (UseN n) i = iN n i ; - iDet a_Det d f = Exist (\x -> And (d x) (f x)) ; - iDet every_Det d f = All (\x -> If (d x) (f x)) ; - iPol Pos t = t ; - iPol Neg t = Not t ; - iTense Pres t = t ; - iTense Perf t = Past t ; - iConj and_Conj a b = And a b ; - iConj or_Conj a b = Or a b ; -} diff --git a/book/examples/chapter9/SemanticsIta.gf b/book/examples/chapter9/SemanticsIta.gf deleted file mode 100644 index 70d4b79b9..000000000 --- a/book/examples/chapter9/SemanticsIta.gf +++ /dev/null @@ -1,42 +0,0 @@ -concrete SemanticsIta of Semantics = GrammarIta, LogicSymb ** open ResIta, Formal, Prelude in { - -lin - iN f = star (f.s ! Sg) ; - iA f = star (f.s ! Masc ! Sg) ; - iV f = star (f.s ! VInf) ; - iV2 f x y = star (f.s ! VInf) (cc2 x y) ; - -oper star : Str -> SS -> TermPrec = \f,x -> prefix 3 (f ++ "*") (constant (parenth x.s)) ; - -{- - -lincat - T, I = TermPrec ; -lin - And = infixl 2 "&" ; - Or = infixl 2 "v" ; - If = infixr 1 "->" ; --- Not = prefix 3 "~" ; --- All : (I -> T) -> T ; --- Exist : (I -> T) -> T ; --- Past : T -> T ; - -lin - iS : S -> T ; - iCl : Cl -> T ; - iNP : NP -> (I -> T) -> T ; - iVP : VP -> I -> T ; - iAP : AP -> I -> T ; - iCN : CN -> I -> T ; - iDet : Det -> (I -> T) -> (I -> T) -> T ; - iN : N -> I -> T ; - iA : A -> I -> T ; - iV : V -> I -> T ; - iV2 : V2 -> I -> I -> T ; - iAdA : AdA -> (I -> T) -> I -> T ; - iTense : Tense -> T -> T ; - iPol : Pol -> T -> T ; - iConj : Conj -> T -> T -> T ; --} - -} diff --git a/book/examples/chapter9/Syntax.gf b/book/examples/chapter9/Syntax.gf deleted file mode 100644 index 01a51d0ee..000000000 --- a/book/examples/chapter9/Syntax.gf +++ /dev/null @@ -1,47 +0,0 @@ -interface Syntax = Grammar - - [UseCl,PredVP,ComplV2,UseV,DetCN,ModCN,CompAP,AdAP, - ConjS,ConjNP,UseN,UseA,Pres,Perf,Pos,Neg] ** - open Grammar in { - -oper - mkS = overload { - mkS : Cl -> S = UseCl Pres Pos ; - mkS : Tense -> Cl -> S = \t -> UseCl t Pos ; - mkS : Pol -> Cl -> S = UseCl Pres ; - mkS : Tense -> Pol -> Cl -> S = UseCl ; - mkS : Conj -> S -> S -> S = ConjS ; - } ; - - mkCl = overload { - mkCl : NP -> V -> Cl = \np,v -> PredVP np (UseV v) ; - mkCl : NP -> V2 -> NP -> Cl = \np,v,o -> PredVP np (ComplV2 v o) ; - mkCl : NP -> A -> Cl = \np,a -> PredVP np (CompAP (UseA a)) ; - mkCl : NP -> AP -> Cl = \np,ap -> PredVP np (CompAP ap) ; - mkCl : NP -> VP -> Cl = PredVP ; - } ; - - mkAP = overload { - mkAP : A -> AP = UseA ; - mkAP : AdA -> AP -> AP = AdAP ; - } ; - - mkNP = overload { - mkNP : Det -> N -> NP = \d,n -> DetCN d (UseN n) ; - mkNP : Det -> CN -> NP = \d,n -> DetCN d n ; - mkNP : Conj -> NP -> NP -> NP = ConjNP ; - } ; - - mkCN = overload { - mkCN : N -> CN = UseN ; - mkCN : A -> N -> CN = \a,n -> ModCN (UseA a) (UseN n) ; - mkCN : A -> CN -> CN = \a,n -> ModCN (UseA a) n ; - mkCN : AP -> N -> CN = \a,n -> ModCN a (UseN n) ; - mkCN : AP -> CN -> CN = \a,n -> ModCN a n ; - } ; - - presTense : Tense = Pres ; - perfTense : Tense = Perf ; - posPol : Pol = Pos ; - negPol : Pol = Neg ; - -} diff --git a/book/examples/chapter9/SyntaxIta.gf b/book/examples/chapter9/SyntaxIta.gf deleted file mode 100644 index b4562b0de..000000000 --- a/book/examples/chapter9/SyntaxIta.gf +++ /dev/null @@ -1,3 +0,0 @@ -instance SyntaxIta of Syntax = GrammarIta - - [PredVP,ComplV2,UseV,DetCN,ModCN,CompAP,AdAP,UseN,UseA] ** - open GrammarIta in {} ; diff --git a/book/examples/chapter9/Test.gf b/book/examples/chapter9/Test.gf deleted file mode 100644 index ebe55e7e0..000000000 --- a/book/examples/chapter9/Test.gf +++ /dev/null @@ -1,9 +0,0 @@ -abstract Test = Grammar ** { - -fun - man_N, woman_N, house_N, tree_N : N ; - big_A, small_A, green_A : A ; - walk_V, arrive_V : V ; - love_V2, please_V2 : V2 ; - -} ; diff --git a/book/examples/chapter9/TestIta.gf b/book/examples/chapter9/TestIta.gf deleted file mode 100644 index 8ae524371..000000000 --- a/book/examples/chapter9/TestIta.gf +++ /dev/null @@ -1,17 +0,0 @@ -concrete TestIta of Test = GrammarIta ** open ParadigmsIta in { - -lin - man_N = mkN "uomo" "uomini" masculine ; - woman_N = mkN "donna" ; - house_N = mkN "casa" ; - tree_N = mkN "albero" ; - big_A = preA (mkA "grande") ; - small_A = preA (mkA "piccolo") ; - green_A = mkA "verde" ; - walk_V = mkV "camminare" ; - arrive_V = essereV (mkV "arrivare") ; - love_V2 = mkV2 "amare" ; - please_V2 = mkV2 (essereV (mkV "piacere" "piaccio" "piaci" "piace" - "piacciamo" "piacete" "piacciono" "piaciuto")) dative ; - -} ; diff --git a/book/examples/chapter9/TestSemantics.gf b/book/examples/chapter9/TestSemantics.gf deleted file mode 100644 index ce8fe4428..000000000 --- a/book/examples/chapter9/TestSemantics.gf +++ /dev/null @@ -1 +0,0 @@ -abstract TestSemantics = Test, Semantics ; diff --git a/book/examples/chapter9/TestSemanticsIta.gf b/book/examples/chapter9/TestSemanticsIta.gf deleted file mode 100644 index ce6abfc09..000000000 --- a/book/examples/chapter9/TestSemanticsIta.gf +++ /dev/null @@ -1 +0,0 @@ -concrete TestSemanticsIta of TestSemantics = TestIta, SemanticsIta ; diff --git a/gf-book/examples/chapter2/Copy.gf b/gf-book/examples/chapter2/Copy.gf new file mode 100644 index 000000000..58d74861c --- /dev/null +++ b/gf-book/examples/chapter2/Copy.gf @@ -0,0 +1,7 @@ +concrete Copy of CopyAbs = { + lincat S, AB = Str ; + lin s x = x ++ x ; + end = [] ; + a x = "a" ++ x ; + b x = "b" ++ x ; +} diff --git a/gf-book/examples/chapter2/CopyAbs.gf b/gf-book/examples/chapter2/CopyAbs.gf new file mode 100644 index 000000000..9a915568b --- /dev/null +++ b/gf-book/examples/chapter2/CopyAbs.gf @@ -0,0 +1,6 @@ +abstract CopyAbs = { + cat S ; AB ; + fun s : AB -> S ; + end : AB ; + a,b : AB -> AB ; +} diff --git a/gf-book/examples/chapter2/Food.gf b/gf-book/examples/chapter2/Food.gf new file mode 100644 index 000000000..7cf779b4c --- /dev/null +++ b/gf-book/examples/chapter2/Food.gf @@ -0,0 +1,13 @@ +abstract Food = { + flags startcat = Comment ; + cat + Comment ; Item ; Kind ; Quality ; + fun + Pred : Item -> Quality -> Comment ; + This, That : Kind -> Item ; + Mod : Quality -> Kind -> Kind ; + Wine, Cheese, Fish : Kind ; + Very : Quality -> Quality ; + Fresh, Warm, Italian, + Expensive, Delicious, Boring : Quality ; +} diff --git a/gf-book/examples/chapter2/Food.probs b/gf-book/examples/chapter2/Food.probs new file mode 100644 index 000000000..2d75774a1 --- /dev/null +++ b/gf-book/examples/chapter2/Food.probs @@ -0,0 +1,4 @@ + This 0.8 + Mod 0.2 + Wine 0.0 + Fresh 0.4 diff --git a/gf-book/examples/chapter2/FoodEng.gf b/gf-book/examples/chapter2/FoodEng.gf new file mode 100644 index 000000000..f2ed510fe --- /dev/null +++ b/gf-book/examples/chapter2/FoodEng.gf @@ -0,0 +1,19 @@ +concrete FoodEng of Food = { + lincat + Comment, Item, Kind, Quality = Str ; + lin + Pred item quality = item ++ "is" ++ quality ; + This kind = "this" ++ kind ; + That kind = "that" ++ kind ; + Mod quality kind = quality ++ kind ; + Wine = "wine" ; + Cheese = "cheese" ; + Fish = "fish" ; + Very quality = "very" ++ quality ; + Fresh = "fresh" ; + Warm = "warm" ; + Italian = "Italian" ; + Expensive = "expensive" ; + Delicious = "delicious" ; + Boring = "boring" ; +} diff --git a/gf-book/examples/chapter2/FoodHin.gf b/gf-book/examples/chapter2/FoodHin.gf new file mode 100644 index 000000000..0f6f25c5e --- /dev/null +++ b/gf-book/examples/chapter2/FoodHin.gf @@ -0,0 +1,24 @@ + + concrete FoodHin of Food = { + flags coding = utf8 ; + lincat Comment, Item, Kind, Quality = Str ; + lin + Pred item quality = item ++ quality ++ "है" ; + This kind = "यह" ++ kind ; + That kind = "वह" ++ kind ; + Mod quality kind = quality ++ kind ; + Wine = "मदिरा" ; + Cheese = "पनीर" ; + Fish = "मछली" ; + Very quality = "अति" ++ quality ; + Fresh = "ताज़ा" ; + Warm = "गरम" ; + Italian = "इटली" ; + Expensive = "बहुमूल्य" ; + Delicious = "स्वादिष्ट" ; + Boring = "अरुचिकर" ; + } + + + + diff --git a/gf-book/examples/chapter2/FoodIta.gf b/gf-book/examples/chapter2/FoodIta.gf new file mode 100644 index 000000000..466104432 --- /dev/null +++ b/gf-book/examples/chapter2/FoodIta.gf @@ -0,0 +1,19 @@ +concrete FoodIta of Food = { + lincat + Comment, Item, Kind, Quality = Str ; + lin + Pred item quality = item ++ "" ++ quality ; + This kind = "questo" ++ kind ; + That kind = "quel" ++ kind ; + Mod quality kind = kind ++ quality ; + Wine = "vino" ; + Cheese = "formaggio" ; + Fish = "pesce" ; + Very quality = "molto" ++ quality ; + Fresh = "fresco" ; + Warm = "caldo" ; + Italian = "italiano" ; + Expensive = "caro" ; + Delicious = "delizioso" ; + Boring = "noioso" ; +} diff --git a/gf-book/examples/chapter2/Letters.gf b/gf-book/examples/chapter2/Letters.gf new file mode 100644 index 000000000..2b5a62d2d --- /dev/null +++ b/gf-book/examples/chapter2/Letters.gf @@ -0,0 +1,8 @@ +abstract Letters = { + +cat L ; +fun + a, b, c, d, e, f, g, h, i, j, k, l, m, + n, o, p, q, r, s, t, u, v, w, x, y, z : L ; + +} diff --git a/gf-book/examples/chapter2/LettersCnc.gf b/gf-book/examples/chapter2/LettersCnc.gf new file mode 100644 index 000000000..3301f5465 --- /dev/null +++ b/gf-book/examples/chapter2/LettersCnc.gf @@ -0,0 +1,31 @@ +concrete LettersCnc of Letters = { + + lincat L = Str ; + lin + a = "a" ; + b = "b" ; + c = "c" ; + d = "d" ; + e = "e" ; + f = "f" ; + g = "g" ; + h = "h" ; + i = "i" ; + j = "j" ; + k = "k" ; + l = "l" ; + m = "m" ; + n = "n" ; + o = "o" ; + p = "p" ; + q = "q" ; + r = "r" ; + s = "s" ; + t = "t" ; + u = "u" ; + v = "v" ; + w = "w" ; + x = "x" ; + y = "y" ; + z = "z" ; +} diff --git a/gf-book/examples/chapter2/Strings.gf b/gf-book/examples/chapter2/Strings.gf new file mode 100644 index 000000000..411ceed53 --- /dev/null +++ b/gf-book/examples/chapter2/Strings.gf @@ -0,0 +1,7 @@ +abstract Strings = Letters ** { + +cat S ; +fun + E : S ; + C : L -> S -> S ; +} diff --git a/gf-book/examples/chapter2/StringsBW.gf b/gf-book/examples/chapter2/StringsBW.gf new file mode 100644 index 000000000..8e558d953 --- /dev/null +++ b/gf-book/examples/chapter2/StringsBW.gf @@ -0,0 +1,5 @@ +concrete StringsBW of Strings = LettersCnc ** { + lincat S = Str ; + lin E = [] ; + lin C head tail = tail ++ head ; +} diff --git a/gf-book/examples/chapter2/StringsFW.gf b/gf-book/examples/chapter2/StringsFW.gf new file mode 100644 index 000000000..c0f80c313 --- /dev/null +++ b/gf-book/examples/chapter2/StringsFW.gf @@ -0,0 +1,5 @@ +concrete StringsFW of Strings = LettersCnc ** { + lincat S = Str ; + lin E = [] ; + lin C head tail = head ++ tail ; +} diff --git a/gf-book/examples/chapter2/Ticket.gf b/gf-book/examples/chapter2/Ticket.gf new file mode 100644 index 000000000..f3f2dd851 --- /dev/null +++ b/gf-book/examples/chapter2/Ticket.gf @@ -0,0 +1,10 @@ +abstract Ticket = { + +flags startcat = Request ; +cat + Request ; Station ; +fun + Ticket : Station -> Station -> Request ; + Hamburg, Paris : Station ; + +} diff --git a/gf-book/examples/chapter2/TicketEng.gf b/gf-book/examples/chapter2/TicketEng.gf new file mode 100644 index 000000000..54e44741d --- /dev/null +++ b/gf-book/examples/chapter2/TicketEng.gf @@ -0,0 +1,19 @@ +concrete TicketEng of Ticket = { + +lincat + Request, Station = Str ; +lin + Ticket X Y = + ((("I" ++ ("would like" | "want") ++ "to get" | + ("may" | "can") ++ "I get" | + "can you give me" | + []) ++ + "a ticket") | + []) ++ + "from" ++ X ++ "to" ++ Y ++ + ("please" | []) ; + + Hamburg = "Hamburg" ; + Paris = "Paris" ; + +} diff --git a/gf-book/examples/chapter2/foodEng.cf b/gf-book/examples/chapter2/foodEng.cf new file mode 100644 index 000000000..3216f2e30 --- /dev/null +++ b/gf-book/examples/chapter2/foodEng.cf @@ -0,0 +1,14 @@ +Pred. Comment ::= Item "is" Quality +This. Item ::= "this" Kind +That. Item ::= "that" Kind +Mod. Kind ::= Quality Kind +Wine. Kind ::= "wine" +Cheese. Kind ::= "cheese" +Fish. Kind ::= "fish" +Very. Quality ::= "very" Quality +Fresh. Quality ::= "fresh" +Warm. Quality ::= "warm" +Italian. Quality ::= "Italian" +Expensive. Quality ::= "expensive" +Delicious. Quality ::= "delicious" +Boring. Quality ::= "boring" diff --git a/gf-book/examples/chapter2/foodIta.cf b/gf-book/examples/chapter2/foodIta.cf new file mode 100644 index 000000000..02b825ed0 --- /dev/null +++ b/gf-book/examples/chapter2/foodIta.cf @@ -0,0 +1,14 @@ +Pred. Comment ::= Item "è" Quality +This. Item ::= "questo" Kind +That. Item ::= "quel" Kind +Mod. Kind ::= Kind Quality +Wine. Kind ::= "vino" +Cheese. Kind ::= "formaggio" +Fish. Kind ::= "pesce" +Very. Quality ::= "molto" Quality +Fresh. Quality ::= "fresco" +Warm. Quality ::= "caldo" +Italian. Quality ::= "italiano" +Expensive. Quality ::= "caro" +Delicious. Quality ::= "delizioso" +Boring. Quality ::= "noioso" diff --git a/gf-book/examples/chapter3/Arabic.gf b/gf-book/examples/chapter3/Arabic.gf new file mode 100644 index 000000000..e00d02c23 --- /dev/null +++ b/gf-book/examples/chapter3/Arabic.gf @@ -0,0 +1,118 @@ +resource Arabic = { +oper + Root : Type = {F,C,L : Str} ; + Pattern : Type = Root -> Str ; + + Filling : Type = {F,FC,CL,L : Str} ; + + fill : Filling -> Root -> Str = \p,r -> + p.F + r.F + p.FC + r.C + p.CL + r.L + p.L ; + + dfill : Filling -> Root -> Str = \p,r -> + p.F + r.F + p.FC + r.C + r.C + p.CL + r.L + p.L ; + + getRoot : Str -> Root = \s -> case s of { + F@? + C@? + L@? => {F = F ; C = C ; L = L} ; + _ => Predef.error ("cannot get root from" ++ s) + } ; + + getPattern : Str -> Pattern = \s -> case s of { + F + "F" + FC + "CC" + CL + "L" + L => + dfill {F = F ; FC = FC ; CL = CL ; L = L} ; + F + "F" + FC + "C" + CL + "L" + L => + fill {F = F ; FC = FC ; CL = CL ; L = L} ; + _ => Predef.error ("cannot get pattern from" ++ s) + } ; + + word : Str -> Str -> Str = \p,r -> + getPattern p (getRoot r) ; + +param + Number = Sg | Dl | Pl ; + Gender = Masc | Fem ; + Tense = Perf | Impf ; + + VPer = Vp3 Number Gender | Vp2Sg Gender | Vp2Dl | Vp2Pl Gender | Vp1Sg | Vp1Pl ; + +oper + Verb : Type = {s : Tense => VPer => Str} ; + + pattV_u : Tense -> VPer -> Pattern = \t,v -> getPattern (case t of { + Perf => case v of { + Vp3 Sg Masc => "FaCaLa" ; + Vp3 Sg Fem => "FaCaLat" ; + Vp3 Dl Masc => "FaCaLaA" ; + Vp3 Dl Fem => "FaCaLataA" ; + Vp3 Pl Masc => "FaCaLuwA" ; + Vp3 Pl Fem => "FaCaLona" ; + + Vp2Sg Masc => "FaCaLota" ; + Vp2Sg Fem => "FaCaLoti" ; + Vp2Dl => "FaCaLotumaA" ; + Vp2Pl Masc => "FaCaLotum" ; + Vp2Pl Fem => "FaCaLotunv2a" ; + + Vp1Sg => "FaCaLotu" ; + Vp1Pl => "FaCaLonaA" + } ; + Impf => case v of { + Vp3 Sg Masc => "yaFoCuLu" ; + Vp3 Sg Fem => "taFoCuLu" ; + Vp3 Dl Masc => "yaFoCuLaAni" ; + Vp3 Dl Fem => "taFoCuLaAni" ; + Vp3 Pl Masc => "yaFoCuLuwna" ; + Vp3 Pl Fem => "yaFoCuLna" ; + + Vp2Sg Masc => "taFoCuLu" ; + Vp2Sg Fem => "taFoCuLiyna" ; + Vp2Dl => "taFoCuLaAni" ; + Vp2Pl Masc => "taFoCuLuwna" ; + Vp2Pl Fem => "taFoCuLona" ; + + Vp1Sg => "A?aFoCuLu" ; + Vp1Pl => "naFoCuLu" + } + }) ; + + u_Verb : Str -> Verb = \s -> { + s = \\t,p => pattV_u t p (getRoot s) ; + } ; + +-- for html + + tag : Str -> Str = \t -> "<" + t + ">" ; + etag : Str -> Str = \t -> "" ; + atag : Str -> Str -> Str = \t,a -> "<" + t ++ a + ">" ; + + intag : Str -> Str -> Str = \t,s -> tag t ++ s ++ etag t ; + intagAttr : Str -> Str -> Str -> Str = \t,a,s -> atag t a ++ s ++ etag t ; + + verbTable : Verb -> Str = \v -> + let + vsp = v.s ! Perf ; + vsi = v.s ! Impf ; + tr : Str -> Str = intag "tr" ; + td : Str -> Str = intag "td" ; + ts : Str -> Str = \s -> td ("\"" ++ s ++ "\"") ; + trs : Str -> Str -> VPer -> Str = \s,n,v -> + tr (td s ++ td n ++ ts (vsp ! v) ++ ts (vsi ! v)) + in + intagAttr "table" "border=1" ( + tr ((td "Persona") ++ (td "Numerus") ++ (td "Perfectum") ++ (td "Imperfectum")) ++ + trs "3. masc." "sing." (Vp3 Sg Masc) ++ + trs "3. fem." "sing." (Vp3 Sg Fem) ++ + trs "2. masc." "sing." (Vp2Sg Masc) ++ + trs "2. fem." "sing." (Vp2Sg Fem) ++ + trs "1." "sing." (Vp1Sg) ++ + trs "3. masc." "dual." (Vp3 Dl Masc) ++ + trs "3. fem." "dual." (Vp3 Dl Fem) ++ + trs "2." "dual." (Vp2Dl) ++ + trs "3. masc." "plur." (Vp3 Pl Masc) ++ + trs "3. fem." "plur." (Vp3 Pl Fem) ++ + trs "2. masc." "plur." (Vp2Pl Masc) ++ + trs "2. fem." "plur." (Vp2Pl Fem) ++ + trs "1." "plur." (Vp1Pl) + ) ; + + +} diff --git a/gf-book/examples/chapter3/Discont.gf b/gf-book/examples/chapter3/Discont.gf new file mode 100644 index 000000000..879bedc4c --- /dev/null +++ b/gf-book/examples/chapter3/Discont.gf @@ -0,0 +1,11 @@ +abstract Discont = { + cat + S ; Cl ; NP ; VP ; AP ; + fun + DeclCl : Cl -> S ; + QuestCl : Cl -> S ; + PredVP : NP -> VP -> Cl ; + CompAP : AP -> VP ; + John : NP ; + Old : AP ; +} diff --git a/gf-book/examples/chapter3/DiscontEng.gf b/gf-book/examples/chapter3/DiscontEng.gf new file mode 100644 index 000000000..93d70a02c --- /dev/null +++ b/gf-book/examples/chapter3/DiscontEng.gf @@ -0,0 +1,21 @@ +concrete DiscontEng of Discont = { + param + SForm = SDecl | SQuest ; + lincat + S, NP, AP = Str ; + Cl = SForm => Str ; + VP = {verb,comp : Str} ; + lin + DeclCl cl = cl ! SDecl ; + QuestCl cl = cl ! SQuest ; + PredVP np vp = table { + SDecl => np ++ vp.verb ++ vp.comp ; + SQuest => vp.verb ++ np ++ vp.comp + } ; + CompAP ap = { + verb = "is" ; + comp = ap + } ; + John = "John" ; + Old = "old" ; +} diff --git a/gf-book/examples/chapter3/Foods.gf b/gf-book/examples/chapter3/Foods.gf new file mode 100644 index 000000000..e60f0ea09 --- /dev/null +++ b/gf-book/examples/chapter3/Foods.gf @@ -0,0 +1,13 @@ +abstract Foods = { + flags startcat = Comment ; + cat + Comment ; Item ; Kind ; Quality ; + fun + Pred : Item -> Quality -> Comment ; + This, That, These, Those : Kind -> Item ; + Mod : Quality -> Kind -> Kind ; + Wine, Cheese, Fish, Pizza : Kind ; + Very : Quality -> Quality ; + Fresh, Warm, Italian, + Expensive, Delicious, Boring : Quality ; +} diff --git a/gf-book/examples/chapter3/FoodsEng.gf b/gf-book/examples/chapter3/FoodsEng.gf new file mode 100644 index 000000000..82bae2148 --- /dev/null +++ b/gf-book/examples/chapter3/FoodsEng.gf @@ -0,0 +1,40 @@ +concrete FoodsEng of Foods = { + lincat + Comment, Quality = {s : Str} ; + Kind = {s : Number => Str} ; + Item = {s : Str ; n : Number} ; + lin + Pred item quality = + {s = item.s ++ copula ! item.n ++ quality.s} ; + This = det Sg "this" ; + That = det Sg "that" ; + These = det Pl "these" ; + Those = det Pl "those" ; + Mod quality kind = + {s = \\n => quality.s ++ kind.s ! n} ; + Wine = regNoun "wine" ; + Cheese = regNoun "cheese" ; + Fish = noun "fish" "fish" ; + Pizza = regNoun "pizza" ; + Very a = {s = "very" ++ a.s} ; + Fresh = adj "fresh" ; + Warm = adj "warm" ; + Italian = adj "Italian" ; + Expensive = adj "expensive" ; + Delicious = adj "delicious" ; + Boring = adj "boring" ; + param + Number = Sg | Pl ; + oper + det : Number -> Str -> + {s : Number => Str} -> {s : Str ; n : Number} = + \n,det,noun -> {s = det ++ noun.s ! n ; n = n} ; + noun : Str -> Str -> {s : Number => Str} = + \man,men -> {s = table {Sg => man ; Pl => men}} ; + regNoun : Str -> {s : Number => Str} = + \car -> noun car (car + "s") ; + adj : Str -> {s : Str} = + \cold -> {s = cold} ; + copula : Number => Str = + table {Sg => "is" ; Pl => "are"} ; +} diff --git a/gf-book/examples/chapter3/FoodsIta.gf b/gf-book/examples/chapter3/FoodsIta.gf new file mode 100644 index 000000000..6f7015694 --- /dev/null +++ b/gf-book/examples/chapter3/FoodsIta.gf @@ -0,0 +1,32 @@ +concrete FoodsIta of Foods = open ResIta in { + lincat + Comment = {s : Str} ; + Quality = Adjective ; + Kind = Noun ; + Item = NounPhrase ; + lin + Pred item quality = + {s = item.s ++ copula ! item.n ++ + quality.s ! item.g ! item.n} ; + This = det Sg "questo" "questa" ; + That = det Sg "quel" "quella" ; + These = det Pl "questi" "queste" ; + Those = det Pl "quei" "quelle" ; + Mod quality kind = { + s = \\n => kind.s ! n ++ quality.s ! kind.g ! n ; + g = kind.g + } ; + Wine = noun "vino" "vini" Masc ; + Cheese = noun "formaggio" "formaggi" Masc ; + Fish = noun "pesce" "pesci" Masc ; + Pizza = noun "pizza" "pizze" Fem ; + Very qual = {s = \\g,n => "molto" ++ qual.s ! g ! n} ; + Fresh = + adjective "fresco" "fresca" "freschi" "fresche" ; + Warm = regAdj "caldo" ; + Italian = regAdj "italiano" ; + Expensive = regAdj "caro" ; + Delicious = regAdj "delizioso" ; + Boring = regAdj "noioso" ; +} + diff --git a/gf-book/examples/chapter3/ResIta.gf b/gf-book/examples/chapter3/ResIta.gf new file mode 100644 index 000000000..17809c498 --- /dev/null +++ b/gf-book/examples/chapter3/ResIta.gf @@ -0,0 +1,36 @@ +resource ResIta = open Prelude in { + param + Number = Sg | Pl ; + Gender = Masc | Fem ; + oper + NounPhrase : Type = + {s : Str ; g : Gender ; n : Number} ; + Noun : Type = {s : Number => Str ; g : Gender} ; + Adjective : Type = {s : Gender => Number => Str} ; + + det : Number -> Str -> Str -> Noun -> NounPhrase = + \n,m,f,cn -> { + s = table {Masc => m ; Fem => f} ! cn.g ++ + cn.s ! n ; + g = cn.g ; + n = n + } ; + noun : Str -> Str -> Gender -> Noun = + \vino,vini,g -> { + s = table {Sg => vino ; Pl => vini} ; + g = g + } ; + adjective : (nero,nera,neri,nere : Str) -> Adjective = + \nero,nera,neri,nere -> { + s = table { + Masc => table {Sg => nero ; Pl => neri} ; + Fem => table {Sg => nera ; Pl => nere} + } + } ; + regAdj : Str -> Adjective = \nero -> + let ner : Str = init nero + in + adjective nero (ner+"a") (ner+"i") (ner+"e") ; + copula : Number => Str = + table {Sg => "" ; Pl => "sono"} ; +} diff --git a/gf-book/examples/chapter4/Clothes.gf b/gf-book/examples/chapter4/Clothes.gf new file mode 100644 index 000000000..e17400a27 --- /dev/null +++ b/gf-book/examples/chapter4/Clothes.gf @@ -0,0 +1,5 @@ +abstract Clothes = Comments ** { + fun + Shirt, Jacket : Kind ; + Comfortable, Elegant : Quality ; +} diff --git a/gf-book/examples/chapter4/ClothesEng.gf b/gf-book/examples/chapter4/ClothesEng.gf new file mode 100644 index 000000000..c6b9a2520 --- /dev/null +++ b/gf-book/examples/chapter4/ClothesEng.gf @@ -0,0 +1,10 @@ +--# -path=.:present + +concrete ClothesEng of Clothes = CommentsEng ** + open SyntaxEng, ParadigmsEng in { + lin + Shirt = mkCN (mkN "shirt") ; + Jacket = mkCN (mkN "jacket") ; + Comfortable = mkAP (mkA "comfortable") ; + Elegant = mkAP (mkA "elegant") ; +} diff --git a/gf-book/examples/chapter4/ClothesIta.gf b/gf-book/examples/chapter4/ClothesIta.gf new file mode 100644 index 000000000..fc4415b07 --- /dev/null +++ b/gf-book/examples/chapter4/ClothesIta.gf @@ -0,0 +1,8 @@ +concrete ClothesIta of Clothes = CommentsIta ** + open SyntaxIta, ParadigmsIta in { + lin + Shirt = mkCN (mkN "camicia") ; + Jacket = mkCN (mkN "giacca") ; + Comfortable = mkAP (mkA "comodo") ; + Elegant = mkAP (mkA "elegante") ; +} diff --git a/gf-book/examples/chapter4/Comment.gf b/gf-book/examples/chapter4/Comment.gf new file mode 100644 index 000000000..0a812c6ef --- /dev/null +++ b/gf-book/examples/chapter4/Comment.gf @@ -0,0 +1,13 @@ +abstract Comment = { + flags startcat = Comment ; + cat + Comment ; Item ; Kind ; Quality ; + fun + Pred : Item -> Quality -> Comment ; + This, That, These, Those : Kind -> Item ; + Mod : Quality -> Kind -> Kind ; + Wine, Cheese, Fish, Pizza : Kind ; + Very : Quality -> Quality ; + Fresh, Warm, Italian, + Expensive, Delicious, Boring : Quality ; +} diff --git a/gf-book/examples/chapter4/Comments.gf b/gf-book/examples/chapter4/Comments.gf new file mode 100644 index 000000000..ba36024f3 --- /dev/null +++ b/gf-book/examples/chapter4/Comments.gf @@ -0,0 +1,10 @@ +abstract Comments = { + flags startcat = Comment ; + cat + Comment ; Item ; Kind ; Quality ; + fun + Pred : Item -> Quality -> Comment ; + This, That, These, Those : Kind -> Item ; + Mod : Quality -> Kind -> Kind ; + Very : Quality -> Quality ; +} diff --git a/gf-book/examples/chapter4/CommentsEng.gf b/gf-book/examples/chapter4/CommentsEng.gf new file mode 100644 index 000000000..8fe3ed965 --- /dev/null +++ b/gf-book/examples/chapter4/CommentsEng.gf @@ -0,0 +1,4 @@ +--# -path=.:present + +concrete CommentsEng of Comments = CommentsI with + (Syntax = SyntaxEng) ; diff --git a/gf-book/examples/chapter4/CommentsI.gf b/gf-book/examples/chapter4/CommentsI.gf new file mode 100644 index 000000000..b7cf0e8f7 --- /dev/null +++ b/gf-book/examples/chapter4/CommentsI.gf @@ -0,0 +1,15 @@ +incomplete concrete CommentsI of Comments = open Syntax in { + lincat + Comment = Cl ; + Item = NP ; + Kind = CN ; + Quality = AP ; + lin + Pred item quality = mkCl item quality ; + This kind = mkNP this_QuantSg kind ; + That kind = mkNP that_QuantSg kind ; + These kind = mkNP these_QuantPl kind ; + Those kind = mkNP those_QuantPl kind ; + Mod quality kind = mkCN quality kind ; + Very quality = mkAP very_AdA quality ; +} diff --git a/gf-book/examples/chapter4/CommentsIta.gf b/gf-book/examples/chapter4/CommentsIta.gf new file mode 100644 index 000000000..c9010c939 --- /dev/null +++ b/gf-book/examples/chapter4/CommentsIta.gf @@ -0,0 +1,4 @@ +--# -path=.:present + +concrete CommentsIta of Comments = CommentsI with + (Syntax = SyntaxIta) ; diff --git a/gf-book/examples/chapter4/Computers.gf b/gf-book/examples/chapter4/Computers.gf new file mode 100644 index 000000000..6bbafd215 --- /dev/null +++ b/gf-book/examples/chapter4/Computers.gf @@ -0,0 +1,5 @@ +abstract Computers = Comments ** { + fun + Computer, HardDisk : Kind ; + Efficient, Slow : Quality ; +} diff --git a/gf-book/examples/chapter4/ComputersEng.gf b/gf-book/examples/chapter4/ComputersEng.gf new file mode 100644 index 000000000..c902be7a7 --- /dev/null +++ b/gf-book/examples/chapter4/ComputersEng.gf @@ -0,0 +1,10 @@ +--# -path=.:present + +concrete ComputersEng of Computers = CommentsEng ** + open SyntaxEng, ParadigmsEng in { + lin + Computer = mkCN (mkN "computer") ; + HardDisk = mkCN (mkA "hard") (mkN "disk") ; + Efficient = mkAP (mkA "efficient") ; + Slow = mkAP (mkA "slow") ; +} diff --git a/gf-book/examples/chapter4/ComputersIta.gf b/gf-book/examples/chapter4/ComputersIta.gf new file mode 100644 index 000000000..274bf6089 --- /dev/null +++ b/gf-book/examples/chapter4/ComputersIta.gf @@ -0,0 +1,9 @@ +concrete ComputersIta of Computers = + CommentsIta ** open ResIta in { + lin + Computer = noun "computer" "computer" Masc ; + HardDisk = noun "disco rigido" "dischi rigidi" Masc ; + Efficient = adjective "efficiente" "efficiente" + "efficienti" "efficienti" ; + Slow = regAdj "lento" ; +} diff --git a/gf-book/examples/chapter4/DefArtGer.gf b/gf-book/examples/chapter4/DefArtGer.gf new file mode 100644 index 000000000..1ef9394eb --- /dev/null +++ b/gf-book/examples/chapter4/DefArtGer.gf @@ -0,0 +1,16 @@ +resource DefArtGer = { + + param DetForm = DSg Gender Case | DPl Case ; + param Gender = Masc | Fem | Neutr ; + param Case = Nom | Acc | Dat | Gen ; + + oper artDef : DetForm => Str = table { + DSg Masc Acc | DPl Dat => "den" ; + DSg (Masc | Neutr) Dat => "dem" ; + DSg (Masc | Neutr) Gen => "des" ; + DSg Neutr _ => "das" ; + DSg Fem (Nom | Acc) | DPl (Nom | Acc) => "die" ; + _ => "der" + } ; + +} diff --git a/gf-book/examples/chapter4/Foods.gf b/gf-book/examples/chapter4/Foods.gf new file mode 100644 index 000000000..d09135421 --- /dev/null +++ b/gf-book/examples/chapter4/Foods.gf @@ -0,0 +1,6 @@ +abstract Foods = Comments ** { + fun + Wine, Cheese, Fish, Pizza : Kind ; + Fresh, Warm, Italian, + Expensive, Delicious, Boring : Quality ; +} diff --git a/gf-book/examples/chapter4/FoodsEng.gf b/gf-book/examples/chapter4/FoodsEng.gf new file mode 100644 index 000000000..39711d908 --- /dev/null +++ b/gf-book/examples/chapter4/FoodsEng.gf @@ -0,0 +1,16 @@ +--# -path=.:present + +concrete FoodsEng of Foods = CommentsEng ** + open SyntaxEng, ParadigmsEng in { + lin + Wine = mkCN (mkN "wine") ; + Pizza = mkCN (mkN "pizza") ; + Cheese = mkCN (mkN "cheese") ; + Fish = mkCN (mkN "fish" "fish") ; + Fresh = mkAP (mkA "fresh") ; + Warm = mkAP (mkA "warm") ; + Italian = mkAP (mkA "Italian") ; + Expensive = mkAP (mkA "expensive") ; + Delicious = mkAP (mkA "delicious") ; + Boring = mkAP (mkA "boring") ; +} diff --git a/gf-book/examples/chapter4/FoodsIta.gf b/gf-book/examples/chapter4/FoodsIta.gf new file mode 100644 index 000000000..502a29cc2 --- /dev/null +++ b/gf-book/examples/chapter4/FoodsIta.gf @@ -0,0 +1,16 @@ +--# -path=.:present + +concrete FoodsIta of Foods = CommentsIta ** + open SyntaxIta, ParadigmsIta in { + lin + Wine = mkCN (mkN "vino") ; + Pizza = mkCN (mkN "pizza") ; + Cheese = mkCN (mkN "formaggio") ; + Fish = mkCN (mkN "pesce") ; + Fresh = mkAP (mkA "fresco") ; + Warm = mkAP (mkA "caldo") ; + Italian = mkAP (mkA "italiano") ; + Expensive = mkAP (mkA "caro") ; + Delicious = mkAP (mkA "delizioso") ; + Boring = mkAP (mkA "noioso") ; +} diff --git a/gf-book/examples/chapter4/Shopping.gf b/gf-book/examples/chapter4/Shopping.gf new file mode 100644 index 000000000..99deb46d9 --- /dev/null +++ b/gf-book/examples/chapter4/Shopping.gf @@ -0,0 +1,2 @@ +abstract Shopping = Foods, Clothes ; + diff --git a/gf-book/examples/chapter4/ShoppingEng.gf b/gf-book/examples/chapter4/ShoppingEng.gf new file mode 100644 index 000000000..9233a00af --- /dev/null +++ b/gf-book/examples/chapter4/ShoppingEng.gf @@ -0,0 +1,4 @@ +--# -path=.:present + +concrete ShoppingEng of Shopping = FoodsEng, ClothesEng ; + diff --git a/gf-book/examples/chapter4/ShoppingIta.gf b/gf-book/examples/chapter4/ShoppingIta.gf new file mode 100644 index 000000000..5abae2674 --- /dev/null +++ b/gf-book/examples/chapter4/ShoppingIta.gf @@ -0,0 +1,4 @@ +--# -path=.:present + +concrete ShoppingIta of Shopping = FoodsIta, ClothesIta ; + diff --git a/gf-book/examples/chapter4/SmallShopping.gf b/gf-book/examples/chapter4/SmallShopping.gf new file mode 100644 index 000000000..10c7c1a17 --- /dev/null +++ b/gf-book/examples/chapter4/SmallShopping.gf @@ -0,0 +1,3 @@ +abstract SmallShopping = + Foods - [Wine], + Clothes [Kind,Quality,Shirt,Elegant] ; diff --git a/gf-book/examples/chapter5/Foods.gf b/gf-book/examples/chapter5/Foods.gf new file mode 100644 index 000000000..8ea02f39d --- /dev/null +++ b/gf-book/examples/chapter5/Foods.gf @@ -0,0 +1,15 @@ +-- (c) 2009 Aarne Ranta under LGPL + +abstract Foods = { + flags startcat = Comment ; + cat + Comment ; Item ; Kind ; Quality ; + fun + Pred : Item -> Quality -> Comment ; + This, That, These, Those : Kind -> Item ; + Mod : Quality -> Kind -> Kind ; + Wine, Cheese, Fish, Pizza : Kind ; + Very : Quality -> Quality ; + Fresh, Warm, Italian, + Expensive, Delicious, Boring : Quality ; +} diff --git a/gf-book/examples/chapter5/FoodsCat.gf b/gf-book/examples/chapter5/FoodsCat.gf new file mode 100644 index 000000000..5ad38d0dc --- /dev/null +++ b/gf-book/examples/chapter5/FoodsCat.gf @@ -0,0 +1,7 @@ +--# -path=.:present + +-- (c) 2009 Jordi Saludes under LGPL + +concrete FoodsCat of Foods = FoodsI with + (Syntax = SyntaxCat), + (LexFoods = LexFoodsCat) ; diff --git a/gf-book/examples/chapter5/FoodsEng.gf b/gf-book/examples/chapter5/FoodsEng.gf new file mode 100644 index 000000000..e1bc40c7a --- /dev/null +++ b/gf-book/examples/chapter5/FoodsEng.gf @@ -0,0 +1,28 @@ +--# -path=.:present + +concrete FoodsEng of Foods = + open SyntaxEng,ParadigmsEng in { + lincat + Comment = Utt ; + Item = NP ; + Kind = CN ; + Quality = AP ; + lin + Pred item quality = mkUtt (mkCl item quality) ; + This kind = mkNP this_Quant kind ; + That kind = mkNP that_Quant kind ; + These kind = mkNP this_Quant plNum kind ; + Those kind = mkNP that_Quant plNum kind ; + Mod quality kind = mkCN quality kind ; + Wine = mkCN (mkN "wine") ; + Pizza = mkCN (mkN "pizza") ; + Cheese = mkCN (mkN "cheese") ; + Fish = mkCN (mkN "fish" "fish") ; + Very quality = mkAP very_AdA quality ; + Fresh = mkAP (mkA "fresh") ; + Warm = mkAP (mkA "warm") ; + Italian = mkAP (mkA "Italian") ; + Expensive = mkAP (mkA "expensive") ; + Delicious = mkAP (mkA "delicious") ; + Boring = mkAP (mkA "boring") ; +} diff --git a/gf-book/examples/chapter5/FoodsFin.gf b/gf-book/examples/chapter5/FoodsFin.gf new file mode 100644 index 000000000..34da5764b --- /dev/null +++ b/gf-book/examples/chapter5/FoodsFin.gf @@ -0,0 +1,7 @@ +--# -path=.:present + +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsFin of Foods = FoodsI with + (Syntax = SyntaxFin), + (LexFoods = LexFoodsFin) ; diff --git a/gf-book/examples/chapter5/FoodsGer.gf b/gf-book/examples/chapter5/FoodsGer.gf new file mode 100644 index 000000000..934cefb9c --- /dev/null +++ b/gf-book/examples/chapter5/FoodsGer.gf @@ -0,0 +1,7 @@ +--# -path=.:present + +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsGer of Foods = FoodsI with + (Syntax = SyntaxGer), + (LexFoods = LexFoodsGer) ; diff --git a/gf-book/examples/chapter5/FoodsI.gf b/gf-book/examples/chapter5/FoodsI.gf new file mode 100644 index 000000000..f4113b724 --- /dev/null +++ b/gf-book/examples/chapter5/FoodsI.gf @@ -0,0 +1,29 @@ +-- (c) 2009 Aarne Ranta under LGPL + +incomplete concrete FoodsI of Foods = + open Syntax, LexFoods in { + lincat + Comment = Utt ; + Item = NP ; + Kind = CN ; + Quality = AP ; + lin + Pred item quality = mkUtt (mkCl item quality) ; + This kind = mkNP this_Det kind ; + That kind = mkNP that_Det kind ; + These kind = mkNP these_Det kind ; + Those kind = mkNP those_Det kind ; + Mod quality kind = mkCN quality kind ; + Very quality = mkAP very_AdA quality ; + + Wine = mkCN wine_N ; + Pizza = mkCN pizza_N ; + Cheese = mkCN cheese_N ; + Fish = mkCN fish_N ; + Fresh = mkAP fresh_A ; + Warm = mkAP warm_A ; + Italian = mkAP italian_A ; + Expensive = mkAP expensive_A ; + Delicious = mkAP delicious_A ; + Boring = mkAP boring_A ; +} diff --git a/gf-book/examples/chapter5/FoodsIta.gf b/gf-book/examples/chapter5/FoodsIta.gf new file mode 100644 index 000000000..51baf9d70 --- /dev/null +++ b/gf-book/examples/chapter5/FoodsIta.gf @@ -0,0 +1,8 @@ +--# -path=.:present + +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsIta of Foods = FoodsI with + (Syntax = SyntaxIta), + (LexFoods = LexFoodsIta) ; + diff --git a/gf-book/examples/chapter5/FoodsSwe.gf b/gf-book/examples/chapter5/FoodsSwe.gf new file mode 100644 index 000000000..cbb35fb98 --- /dev/null +++ b/gf-book/examples/chapter5/FoodsSwe.gf @@ -0,0 +1,7 @@ +--# -path=.:present + +-- (c) 2009 Aarne Ranta under LGPL + +concrete FoodsSwe of Foods = FoodsI with + (Syntax = SyntaxSwe), + (LexFoods = LexFoodsSwe) ** {flags language = sv_SE;} ; diff --git a/gf-book/examples/chapter5/LexFoods.gf b/gf-book/examples/chapter5/LexFoods.gf new file mode 100644 index 000000000..12ace208c --- /dev/null +++ b/gf-book/examples/chapter5/LexFoods.gf @@ -0,0 +1,15 @@ +-- (c) 2009 Aarne Ranta under LGPL + +interface LexFoods = open Syntax in { + oper + wine_N : N ; + pizza_N : N ; + cheese_N : N ; + fish_N : N ; + fresh_A : A ; + warm_A : A ; + italian_A : A ; + expensive_A : A ; + delicious_A : A ; + boring_A : A ; +} diff --git a/gf-book/examples/chapter5/LexFoodsCat.gf b/gf-book/examples/chapter5/LexFoodsCat.gf new file mode 100644 index 000000000..624fc98c8 --- /dev/null +++ b/gf-book/examples/chapter5/LexFoodsCat.gf @@ -0,0 +1,18 @@ +-- (c) 2009 Jordi Saludes under LGPL + +instance LexFoodsCat of LexFoods = + open SyntaxCat, ParadigmsCat, (M = MorphoCat) in { + flags + coding = utf8 ; + oper + wine_N = mkN "vi" "vins" M.Masc ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "formatge" ; + fish_N = mkN "peix" "peixos" M.Masc; + fresh_A = mkA "fresc" "fresca" "frescos" "fresques" "frescament"; + warm_A = mkA "calent" ; + italian_A = mkA "italià" "italiana" "italians" "italianes" "italianament" ; + expensive_A = mkA "car" ; + delicious_A = mkA "deliciós" "deliciosa" "deliciosos" "delicioses" "deliciosament"; + boring_A = mkA "aburrit" "aburrida" "aburrits" "aburrides" "aburridament" ; +} diff --git a/gf-book/examples/chapter5/LexFoodsEng.gf b/gf-book/examples/chapter5/LexFoodsEng.gf new file mode 100644 index 000000000..01024b356 --- /dev/null +++ b/gf-book/examples/chapter5/LexFoodsEng.gf @@ -0,0 +1,20 @@ +instance LexFoodsEng of LexFoods = open SyntaxEng, ParadigmsEng, IrregEng in { + oper + wine_N = mkN "wine" ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "cheese" ; + fish_N = mkN "fish" "fish" ; + fresh_A = mkA "fresh" ; + warm_A = mkA "warm" ; + italian_A = mkA "Italian" ; + expensive_A = mkA "expensive" ; + delicious_A = mkA "delicious" ; + boring_A = mkA "boring" ; + + eat_V2 = mkV2 eat_V ; + drink_V2 = mkV2 drink_V ; + pay_V2 = mkV2 pay_V ; + lady_N = mkN "lady" ; + gentleman_N = mkN "gentleman" "gentlemen" ; + +} diff --git a/gf-book/examples/chapter5/LexFoodsFin.gf b/gf-book/examples/chapter5/LexFoodsFin.gf new file mode 100644 index 000000000..4cf26511a --- /dev/null +++ b/gf-book/examples/chapter5/LexFoodsFin.gf @@ -0,0 +1,20 @@ +-- (c) 2009 Aarne Ranta under LGPL + +instance LexFoodsFin of LexFoods = + open SyntaxFin, ParadigmsFin in { + oper + wine_N = mkN "viini" ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "juusto" ; + fish_N = mkN "kala" ; + fresh_A = mkA "tuore" ; + warm_A = mkA + (mkN "lmmin" "lmpimn" "lmmint" "lmpimn" "lmpimn" + "lmpimin" "lmpimi" "lmpimien" "lmpimiss" "lmpimiin" + ) + "lmpimmpi" "lmpimin" ; + italian_A = mkA "italialainen" ; + expensive_A = mkA "kallis" ; + delicious_A = mkA "herkullinen" ; + boring_A = mkA "tyls" ; +} diff --git a/gf-book/examples/chapter5/LexFoodsGer.gf b/gf-book/examples/chapter5/LexFoodsGer.gf new file mode 100644 index 000000000..a420e22d3 --- /dev/null +++ b/gf-book/examples/chapter5/LexFoodsGer.gf @@ -0,0 +1,16 @@ +-- (c) 2009 Aarne Ranta under LGPL + +instance LexFoodsGer of LexFoods = + open SyntaxGer, ParadigmsGer in { + oper + wine_N = mkN "Wein" ; + pizza_N = mkN "Pizza" "Pizzen" feminine ; + cheese_N = mkN "Kse" "Kse" masculine ; + fish_N = mkN "Fisch" ; + fresh_A = mkA "frisch" ; + warm_A = mkA "warm" "wrmer" "wrmste" ; + italian_A = mkA "italienisch" ; + expensive_A = mkA "teuer" ; + delicious_A = mkA "kstlich" ; + boring_A = mkA "langweilig" ; +} diff --git a/gf-book/examples/chapter5/LexFoodsIta.gf b/gf-book/examples/chapter5/LexFoodsIta.gf new file mode 100644 index 000000000..11de5fcda --- /dev/null +++ b/gf-book/examples/chapter5/LexFoodsIta.gf @@ -0,0 +1,16 @@ +-- (c) 2009 Aarne Ranta under LGPL + +instance LexFoodsIta of LexFoods = + open SyntaxIta, ParadigmsIta in { + oper + wine_N = mkN "vino" ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "formaggio" ; + fish_N = mkN "pesce" ; + fresh_A = mkA "fresco" ; + warm_A = mkA "caldo" ; + italian_A = mkA "italiano" ; + expensive_A = mkA "caro" ; + delicious_A = mkA "delizioso" ; + boring_A = mkA "noioso" ; +} diff --git a/gf-book/examples/chapter5/LexFoodsSwe.gf b/gf-book/examples/chapter5/LexFoodsSwe.gf new file mode 100644 index 000000000..72e7e3e86 --- /dev/null +++ b/gf-book/examples/chapter5/LexFoodsSwe.gf @@ -0,0 +1,16 @@ +-- (c) 2009 Aarne Ranta under LGPL + +instance LexFoodsSwe of LexFoods = + open SyntaxSwe, ParadigmsSwe in { + oper + wine_N = mkN "vin" "vinet" "viner" "vinerna" ; + pizza_N = mkN "pizza" ; + cheese_N = mkN "ost" ; + fish_N = mkN "fisk" ; + fresh_A = mkA "frsk" ; + warm_A = mkA "varm" ; + italian_A = mkA "italiensk" ; + expensive_A = mkA "dyr" ; + delicious_A = mkA "lcker" ; + boring_A = mkA "trkig" ; +} diff --git a/gf-book/examples/chapter6/Aggregation.gf b/gf-book/examples/chapter6/Aggregation.gf new file mode 100644 index 000000000..28cbd39ef --- /dev/null +++ b/gf-book/examples/chapter6/Aggregation.gf @@ -0,0 +1,33 @@ +abstract Aggregation = { + cat S ; NP ; VP ; + data + PredVP : NP -> VP -> S ; + ConjS : S -> S -> S ; + ConjVP : VP -> VP -> VP ; + ConjNP : NP -> NP -> NP ; + Run, Walk : VP ; + John, Mary : NP ; + + fun aggr : S -> S ; -- main aggregation function + def aggr (ConjS (PredVP x X) (PredVP y Y)) = + ifS (eqNP x y) + (PredVP x (ConjVP X Y)) + (ifS (eqVP X Y) + (PredVP (ConjNP x y) X) + (ConjS (PredVP x X) (PredVP y Y))) ; + fun ifS : Bool -> S -> S -> S ; -- if b then x else y + def + ifS True x _ = x ; + ifS False _ y = y ; + fun eqNP : NP -> NP -> Bool ; -- x == y + def + eqNP John John = True ; + eqNP Mary Mary = True ; + eqNP _ _ = False ; + fun eqVP : VP -> VP -> Bool ; -- X == Y + def + eqVP Run Run = True ; + eqVP Walk Walk = True ; + eqVP _ _ = False ; + cat Bool ; data True, False : Bool ; +} diff --git a/gf-book/examples/chapter6/AggregationEng.gf b/gf-book/examples/chapter6/AggregationEng.gf new file mode 100644 index 000000000..9ed403c79 --- /dev/null +++ b/gf-book/examples/chapter6/AggregationEng.gf @@ -0,0 +1,17 @@ +concrete AggregationEng of Aggregation = { + +lincat S, NP, VP = Str ; + +lin + PredVP x y = x ++ y ; + ConjS a b = a ++ "or" ++ b ; + ConjVP a b = a ++ "or" ++ b ; + ConjNP a b = a ++ "or" ++ b ; + + Run = "runs" ; + Walk = "walks" ; + John = "John" ; + Mary = "Mary" ; + +} + diff --git a/gf-book/examples/chapter6/Arithm.gf b/gf-book/examples/chapter6/Arithm.gf new file mode 100644 index 000000000..685627745 --- /dev/null +++ b/gf-book/examples/chapter6/Arithm.gf @@ -0,0 +1,30 @@ +abstract Arithm = { + cat + Prop ; -- proposition + Nat ; -- natural number + data + Zero : Nat ; -- 0 + Succ : Nat -> Nat ; -- the successor of x + fun + Even : Nat -> Prop ; -- x is even + And : Prop -> Prop -> Prop ; -- A and B + + cat Less Nat Nat ; + data LessZ : (y : Nat) -> Less Zero (Succ y) ; + data LessS : (x,y : Nat) -> Less x y -> Less (Succ x) (Succ y) ; + + cat Span ; + data FromTo : (m,n : Nat) -> Less m n -> Span ; + + fun one : Nat ; + def one = Succ Zero ; + + fun twice : Nat -> Nat ; + def twice x = plus x x ; + + fun plus : Nat -> Nat -> Nat ; + def + plus x Zero = x ; + plus x (Succ y) = Succ (plus x y) ; + +} diff --git a/gf-book/examples/chapter6/Bin.gf b/gf-book/examples/chapter6/Bin.gf new file mode 100644 index 000000000..c181656f8 --- /dev/null +++ b/gf-book/examples/chapter6/Bin.gf @@ -0,0 +1,50 @@ +abstract Bin = { + +cat Nat ; Bin ; Pos ; + +data + Zero : Nat ; + Succ : Nat -> Nat ; + + BZero : Bin ; -- 0 + BPos : Pos -> Bin ; -- p + BOne : Pos ; -- 1 + AZero : Pos -> Pos ; -- p0 + AOne : Pos -> Pos ; -- p1 + +fun + bin2nat : Bin -> Nat ; +def + bin2nat BZero = Zero ; + bin2nat (BPos p) = pos2nat p ; +fun + pos2nat : Pos -> Nat ; +def + pos2nat BOne = one ; + pos2nat (AZero p) = twice (pos2nat p) ; + pos2nat (AOne p) = Succ (twice (pos2nat p)) ; +fun one : Nat ; +def one = Succ Zero ; +fun twice : Nat -> Nat ; +def + twice Zero = Zero ; + twice (Succ n) = Succ (Succ (twice n)) ; + +fun + nat2bin : Nat -> Bin ; +def + nat2bin Zero = BZero ; + nat2bin (Succ n) = bSucc (nat2bin n) ; +fun + bSucc : Bin -> Bin ; +def + bSucc BZero = BPos BOne ; + bSucc (BPos p) = BPos (pSucc p) ; +fun + pSucc : Pos -> Pos ; +def + pSucc BOne = AZero BOne ; + pSucc (AZero p) = AOne p ; + pSucc (AOne p) = AZero (pSucc p) ; + +} \ No newline at end of file diff --git a/gf-book/examples/chapter6/Classes.gf b/gf-book/examples/chapter6/Classes.gf new file mode 100644 index 000000000..ac7430d25 --- /dev/null +++ b/gf-book/examples/chapter6/Classes.gf @@ -0,0 +1,28 @@ +abstract Classes = { + +flags + startcat = Command ; + +cat + Command ; + Kind ; + Class ; + Instance Class Kind ; + Action Class ; + Device Kind ; + +fun + Act : (c : Class) -> (k : Kind) -> Instance c k -> Action c -> Device k -> Command ; + The : (k : Kind) -> Device k ; + + Light, Fan : Kind ; + Switchable, Dimmable : Class ; + + SwitchOn, SwitchOff : Action Switchable ; + Dim : Action Dimmable ; + + switchable_Light : Instance Switchable Light ; + switchable_Fan : Instance Switchable Fan ; + dimmable_Light : Instance Dimmable Light ; + +} diff --git a/gf-book/examples/chapter6/ClassesEng.gf b/gf-book/examples/chapter6/ClassesEng.gf new file mode 100644 index 000000000..5bdf80c35 --- /dev/null +++ b/gf-book/examples/chapter6/ClassesEng.gf @@ -0,0 +1,29 @@ +--# -path=.:present + +concrete ClassesEng of Classes = open SyntaxEng, ParadigmsEng in { + +lincat + Command = Utt ; + Kind = CN ; + Class = {} ; + Instance = {} ; + Action = V2 ; + Device = NP ; + +lin + Act _ _ _ a d = mkUtt (mkImp a d) ; + The k = mkNP the_Det k ; + + Light = mkCN (mkN "light") ; + Fan = mkCN (mkN "fan") ; + Switchable, Dimmable = <> ; + + SwitchOn = mkV2 (partV (mkV "switch") "on") ; + SwitchOff = mkV2 (partV (mkV "switch") "off") ; + Dim = mkV2 (mkV "dim") ; + + switchable_Light = <> ; + switchable_Fan = <> ; + dimmable_Light = <> ; + +} diff --git a/gf-book/examples/chapter6/DShopping.gf b/gf-book/examples/chapter6/DShopping.gf new file mode 100644 index 000000000..a5a06e070 --- /dev/null +++ b/gf-book/examples/chapter6/DShopping.gf @@ -0,0 +1,24 @@ +abstract DShopping = { + flags startcat = Comment ; + cat + Comment ; + Dom ; + Item Dom ; + Kind Dom ; + Quality Dom ; + fun + DFood, DCloth : Dom ; + + Pred : (d : Dom) -> Item d -> Quality d -> Comment ; + This, That : (d : Dom) -> Kind d -> Item d ; + Mod : (d : Dom) -> Quality d -> Kind d -> Kind d ; + Wine, Cheese, Fish : Kind DFood ; + Very : (d : Dom) -> Quality d -> Quality d ; + Fresh, Warm, Delicious, Boring : Quality DFood ; + + Shirt, Jacket : Kind DCloth ; + Comfortable : Quality DCloth ; + + Italian, Expensive, Elegant : (d : Dom) -> Quality d ; + +} diff --git a/gf-book/examples/chapter6/DShoppingEng.gf b/gf-book/examples/chapter6/DShoppingEng.gf new file mode 100644 index 000000000..3dc3a2cc2 --- /dev/null +++ b/gf-book/examples/chapter6/DShoppingEng.gf @@ -0,0 +1,33 @@ +--# -path=.:present + +concrete DShoppingEng of DShopping = open SyntaxEng, ParadigmsEng in { + + lincat + Comment = Cl ; + Item = NP ; + Kind = CN ; + Quality = AP ; + lin + Pred _ item quality = mkCl item quality ; + This _ kind = mkNP this_QuantSg kind ; + That _ kind = mkNP that_QuantSg kind ; + Mod _ quality kind = mkCN quality kind ; + Very _ quality = mkAP very_AdA quality ; + + Shirt = mkCN (mkN "shirt") ; + Jacket = mkCN (mkN "jacket") ; + Wine = mkCN (mkN "wine") ; + Cheese = mkCN (mkN "cheese") ; + Fish = mkCN (mkN "fish" "fish") ; + Fresh = mkAP (mkA "fresh") ; + Warm = mkAP (mkA "warm") ; + Italian _ = mkAP (mkA "Italian") ; + Expensive _ = mkAP (mkA "expensive") ; + Elegant _ = mkAP (mkA "elegant") ; + Delicious = mkAP (mkA "delicious") ; + Boring = mkAP (mkA "boring") ; + Comfortable = mkAP (mkA "comfortable") ; + + DFood, DCloth = {s = []} ; + +} diff --git a/gf-book/examples/chapter6/Nat.gf b/gf-book/examples/chapter6/Nat.gf new file mode 100644 index 000000000..ba0dfe4a1 --- /dev/null +++ b/gf-book/examples/chapter6/Nat.gf @@ -0,0 +1,22 @@ +abstract Nat = { + cat + Prop ; -- proposition + Nat ; -- natural number + data + Zero : Nat ; -- 0 + Succ : Nat -> Nat ; -- the successor of x + fun + Even : Nat -> Prop ; -- x is even + And : Prop -> Prop -> Prop ; -- A and B + + fun one : Nat ; + def one = Succ Zero ; + + fun twice : Nat -> Nat ; + def twice x = plus x x ; + + fun plus : Nat -> Nat -> Nat ; + def + plus x Zero = x ; + plus x (Succ y) = Succ (plus x y) ; +} diff --git a/gf-book/examples/chapter6/Smart.gf b/gf-book/examples/chapter6/Smart.gf new file mode 100644 index 000000000..6fc3e0bc5 --- /dev/null +++ b/gf-book/examples/chapter6/Smart.gf @@ -0,0 +1,16 @@ +abstract Smart = { + + cat + Command ; + Kind ; + Device Kind ; + Action Kind ; + + fun + Act : (k : Kind) -> Action k -> Device k -> Command ; + The : (k : Kind) -> Device k ; -- the light + Light, Fan : Kind ; + Dim : Action Light ; + SwitchOn, SwitchOff : (k : Kind) -> Action k ; + +} diff --git a/gf-book/examples/chapter6/Verbs.gf b/gf-book/examples/chapter6/Verbs.gf new file mode 100644 index 000000000..371450aeb --- /dev/null +++ b/gf-book/examples/chapter6/Verbs.gf @@ -0,0 +1,22 @@ +abstract Verbs = { + +cat + S ; NP ; Subcat ; V Subcat ; Args Subcat ; + +fun + cIntr : Subcat ; + cTr : Subcat ; + cS : Subcat ; + + aIntr : NP -> Args cIntr ; + aTr : NP -> NP -> Args cTr ; + aS : NP -> S -> Args cS ; + + pred : (s : Subcat) -> V s -> Args s -> S ; + + john, mary : NP ; + walk : V cIntr ; + love : V cTr ; + know : V cS ; + +} \ No newline at end of file diff --git a/gf-book/examples/chapter6/VerbsEng.gf b/gf-book/examples/chapter6/VerbsEng.gf new file mode 100644 index 000000000..b235178d9 --- /dev/null +++ b/gf-book/examples/chapter6/VerbsEng.gf @@ -0,0 +1,22 @@ +concrete VerbsEng of Verbs = { + +lincat + S, NP, Subcat, V = Str ; Args = Str * Str ; + +lin + cIntr = [] ; + cTr = [] ; + cS = [] ; + + aIntr su = ; + aTr su ob = ; + aS su s = ; + + pred _ v xs = xs.p1 ++ v ++ xs.p2 ; + + john = "John" ; mary = "Mary" ; + walk = "walks" ; + love = "loves" ; + know = "knows" ; + +} diff --git a/gf-book/examples/chapter7/Map.gf b/gf-book/examples/chapter7/Map.gf new file mode 100644 index 000000000..52deebb87 --- /dev/null +++ b/gf-book/examples/chapter7/Map.gf @@ -0,0 +1,10 @@ +abstract Map = { +flags startcat = Query ; +cat + Query ; Input ; Place ; Click ; +fun + GoFromTo : Place -> Place -> Input ; + ThisPlace : Click -> Place ; + QueryInput : Input -> Query ; + ClickCoord : Int -> Int -> Click ; +} diff --git a/gf-book/examples/chapter7/MapEng.gf b/gf-book/examples/chapter7/MapEng.gf new file mode 100644 index 000000000..fee0b502c --- /dev/null +++ b/gf-book/examples/chapter7/MapEng.gf @@ -0,0 +1,17 @@ +concrete MapEng of Map = { +lincat + Query = {s : Str} ; + Input, Place = {s : Str ; p : Str} ; + Click = {p : Str} ; +lin + GoFromTo x y = { + s = "I want to go from" ++ x.s ++ "to" ++ y.s ; + p = x.p ++ y.p + } ; + ThisPlace c = { + s = "this place" ; + p = c.p + } ; + QueryInput i = {s = i.s ++ ";" ++ i.p} ; + ClickCoord x y = {p = "(" ++ x.s ++ "," ++ y.s ++ ")"} ; +} diff --git a/gf-book/examples/chapter7/Query.gf b/gf-book/examples/chapter7/Query.gf new file mode 100644 index 000000000..b6f83e357 --- /dev/null +++ b/gf-book/examples/chapter7/Query.gf @@ -0,0 +1,12 @@ +abstract Query = { + flags startcat=Question ; + cat + Answer ; Question ; Object ; + fun + Even : Object -> Question ; + Odd : Object -> Question ; + Prime : Object -> Question ; + Number : Int -> Object ; + Yes : Answer ; + No : Answer ; +} diff --git a/gf-book/examples/chapter7/QueryEng.gf b/gf-book/examples/chapter7/QueryEng.gf new file mode 100644 index 000000000..cc14d5eb7 --- /dev/null +++ b/gf-book/examples/chapter7/QueryEng.gf @@ -0,0 +1,13 @@ +concrete QueryEng of Query = { + lincat + Answer, Question, Object = Str ; + lin + Even = pred "even" ; + Odd = pred "odd" ; + Prime = pred "prime" ; + Number i = i.s ; + Yes = "yes" ; + No = "no" ; + oper + pred : Str -> Str -> Str = \f,x -> "is" ++ x ++ f ; +} diff --git a/gf-book/examples/chapter7/QueryFin.gf b/gf-book/examples/chapter7/QueryFin.gf new file mode 100644 index 000000000..b3461e34a --- /dev/null +++ b/gf-book/examples/chapter7/QueryFin.gf @@ -0,0 +1,13 @@ +concrete QueryFin of Query = { + lincat + Answer, Question, Object = Str ; + lin + Even = pred "parillinen" ; + Odd = pred "pariton" ; + Prime = pred "alkuluku" ; + Number i = i.s ; + Yes = "kyll" ; + No = "ei" ; + oper + pred : Str -> Str -> Str = \f,x -> "onko" ++ x ++ f ; +} diff --git a/gf-book/examples/chapter8/Calculator.gf b/gf-book/examples/chapter8/Calculator.gf new file mode 100644 index 000000000..188c150e0 --- /dev/null +++ b/gf-book/examples/chapter8/Calculator.gf @@ -0,0 +1,7 @@ +abstract Calculator = { +flags startcat = Exp ; +cat Exp ; +fun + EPlus, EMinus, ETimes, EDiv : Exp -> Exp -> Exp ; + EInt : Int -> Exp ; +} diff --git a/gf-book/examples/chapter8/CalculatorC.gf b/gf-book/examples/chapter8/CalculatorC.gf new file mode 100644 index 000000000..99db80530 --- /dev/null +++ b/gf-book/examples/chapter8/CalculatorC.gf @@ -0,0 +1,10 @@ +concrete CalculatorC of Calculator = open Formal, Prelude in { +lincat + Exp = TermPrec ; +lin + EPlus = infixl 0 "+" ; + EMinus = infixl 0 "-" ; + ETimes = infixl 1 "*" ; + EDiv = infixl 1 "/" ; + EInt i = constant i.s ; +} diff --git a/gf-book/examples/chapter8/CalculatorJ.gf b/gf-book/examples/chapter8/CalculatorJ.gf new file mode 100644 index 000000000..c5f40c8d3 --- /dev/null +++ b/gf-book/examples/chapter8/CalculatorJ.gf @@ -0,0 +1,13 @@ +concrete CalculatorJ of Calculator = open Prelude in { +lincat + Exp = SS ; +lin + EPlus = postfix "iadd" ; + EMinus = postfix "isub" ; + ETimes = postfix "imul" ; + EDiv = postfix "idiv" ; + EInt i = ss ("ldc" ++ i.s) ; +oper + postfix : Str -> SS -> SS -> SS = \op,x,y -> + ss (x.s ++ ";" ++ y.s ++ ";" ++ op) ; +} diff --git a/gf-book/examples/chapter8/CalculatorP.gf b/gf-book/examples/chapter8/CalculatorP.gf new file mode 100644 index 000000000..4e6315827 --- /dev/null +++ b/gf-book/examples/chapter8/CalculatorP.gf @@ -0,0 +1,14 @@ +concrete CalculatorP of Calculator = open Prelude in { + +lincat + Exp = SS ; +lin + EPlus = infix "+" ; + EMinus = infix "-" ; + ETimes = infix "*" ; + EDiv = infix "/" ; + EInt i = i ; +oper + infix : Str -> SS -> SS -> SS = \f,x,y -> + ss ("(" ++ x.s ++ f ++ y.s ++ ")") ; +} diff --git a/gf-book/examples/chapter8/CalculatorS.gf b/gf-book/examples/chapter8/CalculatorS.gf new file mode 100644 index 000000000..d8c1df456 --- /dev/null +++ b/gf-book/examples/chapter8/CalculatorS.gf @@ -0,0 +1,11 @@ +concrete CalculatorS of Calculator = open Prelude in { + lin + EPlus = infix "plus" ; + EMinus = infix "minus" ; + ETimes = infix "times" ; + EDiv = infix ["divided by"] ; + EInt i = i ; + oper + infix : Str -> SS -> SS -> SS = \op,x,y -> + ss (x.s ++ op ++ y.s ++ "PAUSE") ; +} diff --git a/gf-book/examples/chapter8/Geometry.gf b/gf-book/examples/chapter8/Geometry.gf new file mode 100644 index 000000000..0b27d8714 --- /dev/null +++ b/gf-book/examples/chapter8/Geometry.gf @@ -0,0 +1,7 @@ +abstract Geometry = Logic ** { +fun + Line, Point, Circle : Dom ; + Intersect, Parallel : Ind -> Ind -> Atom ; + Vertical : Ind -> Atom ; + Centre : Ind -> Ind ; +} diff --git a/gf-book/examples/chapter8/GeometryEng.gf b/gf-book/examples/chapter8/GeometryEng.gf new file mode 100644 index 000000000..e2e22776e --- /dev/null +++ b/gf-book/examples/chapter8/GeometryEng.gf @@ -0,0 +1,13 @@ +--# -path=.:present + +concrete GeometryEng of Geometry = LogicEng ** + open SyntaxEng, ParadigmsEng in { +lin + Line = mkCN (mkN "line") ; + Point = mkCN (mkN "point") ; + Circle = mkCN (mkN "circle") ; + Intersect = pred (mkV2 "intersect") ; + Parallel = pred (mkA2 (mkA "parallel") (mkPrep "to")) ; + Vertical = pred (mkA "vertical") ; + Centre = app (mkN2 (mkN "centre") (mkPrep "of")) ; +} diff --git a/gf-book/examples/chapter8/GeometryEngb.gf b/gf-book/examples/chapter8/GeometryEngb.gf new file mode 100644 index 000000000..265f3f71a --- /dev/null +++ b/gf-book/examples/chapter8/GeometryEngb.gf @@ -0,0 +1,11 @@ +concrete GeometryEng of Geometry = LogicEng ** + open SyntaxEng, ParadigmsEng in { +lin + Line = mkN "line" ; + Point = mkN "point" ; + Circle = mkN "circle" ; + Intersect = pred (mkV2 "intersect") ; + Parallel = pred (mkA2 (mkA "parallel") (mkPrep "to")) ; + Vertical = pred (mkA "vertical") ; + Centre = app (mkN2 (mkN "centre") (mkPrep "of")) ; +} diff --git a/gf-book/examples/chapter8/Geometryb.gf b/gf-book/examples/chapter8/Geometryb.gf new file mode 100644 index 000000000..dc39c9ce4 --- /dev/null +++ b/gf-book/examples/chapter8/Geometryb.gf @@ -0,0 +1,7 @@ +abstract Geometry = Logic ** { +fun + Line, Point, Circle : Dom ; + Intersect, Parallel : Ind -> Ind -> Prop ; + Vertical : Ind -> Prop ; + Centre : Ind -> Ind ; +} diff --git a/gf-book/examples/chapter8/Graftal.gf b/gf-book/examples/chapter8/Graftal.gf new file mode 100644 index 000000000..e85b9b2f7 --- /dev/null +++ b/gf-book/examples/chapter8/Graftal.gf @@ -0,0 +1,7 @@ +-- (c) Krasimir Angelov 2009 +abstract Graftal = { + cat N; S; + fun z : N ; + s : N -> N ; + c : N -> S ; + } diff --git a/gf-book/examples/chapter8/Logic.gf b/gf-book/examples/chapter8/Logic.gf new file mode 100644 index 000000000..f2b292428 --- /dev/null +++ b/gf-book/examples/chapter8/Logic.gf @@ -0,0 +1,21 @@ +abstract Logic = { +flags startcat = Stm ; +cat + Stm ; -- top-level statement + Prop ; -- proposition + Atom ; -- atomic formula + Ind ; -- individual term + Dom ; -- domain expression + Var ; -- variable + [Prop] {2} ; -- list of propositions, 2 or more + [Var] {1} ; -- list of variables, 1 or more +fun + SProp : Prop -> Stm ; + And, Or : [Prop] -> Prop ; + If : Prop -> Prop -> Prop ; + Not : Prop -> Prop ; + PAtom : Atom -> Prop ; + All, Exist : [Var] -> Dom -> Prop -> Prop ; + IVar : Var -> Ind ; + VString : String -> Var ; +} diff --git a/gf-book/examples/chapter8/LogicBEng.gf b/gf-book/examples/chapter8/LogicBEng.gf new file mode 100644 index 000000000..b950c6b39 --- /dev/null +++ b/gf-book/examples/chapter8/LogicBEng.gf @@ -0,0 +1,38 @@ +concrete LogicEng of Logic = open + SyntaxEng, (P = ParadigmsEng), SymbolicEng, Prelude in { +lincat + Stm = Text ; + Prop = S ; + Atom = Cl ; + Ind = NP ; + Dom = CN ; + Var = NP ; + [Prop] = [S] ; + [Var] = NP ; +lin + SProp = mkText ; + And = mkS and_Conj ; -- A, B ... and C + Or = mkS or_Conj ; -- A, B ... or C + If A B = -- if A B + mkS (mkAdv if_Subj A) B ; + Not A = -- it is not the case that A + mkS negativePol (mkCl + (mkVP (mkNP the_Quant + (mkCN case_CN A)))) ; + All xs A B = -- for all A's xs, B + mkS (mkAdv for_Prep + (mkNP all_Predet (mkNP a_Quant + plNum (mkCN A xs)))) B ; + Exist xs A B = -- for some A's xs, B + mkS (mkAdv for_Prep + (mkNP somePl_Det (mkCN A xs))) B ; + PAtom = mkS ; + IVar x = x ; + VString s = symb s ; + BaseProp A B = mkListS A B ; + ConsProp A As = mkListS A As ; + BaseVar x = x ; + ConsVar x xs = mkNP and_Conj (mkListNP x xs) ; +oper + case_CN : CN = mkCN (P.mkN "case") ; +} diff --git a/gf-book/examples/chapter8/LogicEng.gf b/gf-book/examples/chapter8/LogicEng.gf new file mode 100644 index 000000000..eae85d255 --- /dev/null +++ b/gf-book/examples/chapter8/LogicEng.gf @@ -0,0 +1,39 @@ +concrete LogicEng of Logic = open + SyntaxEng, (P = ParadigmsEng), SymbolicEng, Prelude in { +lincat + Stm = Text ; + Prop = {pos,neg : S ; isAtom : Bool} ; + Atom = Cl ; + Ind = NP ; + Dom = CN ; + Var = NP ; + [Prop] = ListS ; + [Var] = NP ; +lin + SProp p = mkText p.pos ; + And ps = complexProp (mkS and_Conj ps) ; + Or ps = complexProp (mkS or_Conj ps) ; + If A B = complexProp (mkS if_then_Conj (mkListS A.pos B.pos)) ; + Not A = complexProp A.neg ; + All xs A B = complexProp (mkS (mkAdv for_Prep + (mkNP all_Predet (mkNP a_Quant plNum (mkCN A xs)))) B.pos) ; + Exist xs A B = complexProp (mkS (mkAdv for_Prep + (mkNP somePl_Det (mkCN A xs))) B.pos) ; + PAtom p = + {pos = mkS p ; neg = mkS negativePol p ; isAtom = True} ; + IVar x = x ; + VString s = symb s ; + BaseProp A B = mkListS A.pos B.pos ; + ConsProp A As = mkListS A.pos As ; + BaseVar x = x ; + ConsVar x xs = mkNP and_Conj (mkListNP x xs) ; +oper + complexProp : S -> {pos,neg : S ; isAtom : Bool} = \s -> { + pos = s ; + neg = negS s ; + isAtom = False + } ; + negS : S -> S = \s -> mkS negativePol (mkCl (mkNP it_Pron) + (mkNP the_Quant (mkCN (mkCN (P.mkN "case")) s))) ; + if_Then_Conj : Conj = P.mkConj "if" "then" ; +} diff --git a/gf-book/examples/chapter8/Logicb.gf b/gf-book/examples/chapter8/Logicb.gf new file mode 100644 index 000000000..5b5aa9ab9 --- /dev/null +++ b/gf-book/examples/chapter8/Logicb.gf @@ -0,0 +1,11 @@ +abstract Logic = { +cat + Prop ; Ind ; Dom ; Var ; [Prop] {2} ; [Var] {1} ; +fun + And, Or : [Prop] -> Prop ; + If : Prop -> Prop -> Prop ; + Not : Prop -> Prop ; + All, Exist : [Var] -> Dom -> Prop -> Prop ; + IVar : Var -> Ind ; + VString : String -> Var ; +} diff --git a/gf-book/examples/chapter8/Sierpinski.gf b/gf-book/examples/chapter8/Sierpinski.gf new file mode 100644 index 000000000..722088ce5 --- /dev/null +++ b/gf-book/examples/chapter8/Sierpinski.gf @@ -0,0 +1,16 @@ +concrete Sierpinski of Graftal = { + lincat N = {a : Str; b : Str} ; + lincat S = {s : Str} ; + + lin z = {a = A; b = B} ; + lin s x = { + a = x.b ++ R ++ x.a ++ R ++ x.b ; + b = x.a ++ L ++ x.b ++ L ++ x.a + } ; + lin c x = {s = "newpath 300 550 moveto" ++ x.a ++ "stroke showpage"} ; + + oper A : Str = "0 2 rlineto" ; + oper B : Str = "0 2 rlineto" ; + oper L : Str = "+60 rotate" ; + oper R : Str = "-60 rotate" ; +} diff --git a/gf-book/examples/chapter9/Anaphora.gf b/gf-book/examples/chapter9/Anaphora.gf new file mode 100644 index 000000000..5cbb92c94 --- /dev/null +++ b/gf-book/examples/chapter9/Anaphora.gf @@ -0,0 +1,17 @@ +abstract Anaphora = TestSemantics - [she_NP] ** { + +cat + Proof Prop ; + +fun + IfS : (A : S) -> (Proof (iS A) -> S) -> S ; + + AnaNP : (A : CN) -> (a : Ind) -> Proof (iCN A a) -> NP ; + + pe : (B : Ind -> Prop) -> Proof (Exist B) -> Ind ; + qe : (B : Ind -> Prop) -> (c : Proof (Exist B)) -> Proof (B (pe B c)) ; + + pc : (A,B : Prop) -> Proof (And A B) -> Proof A ; + qc : (A,B : Prop) -> Proof (And A B) -> Proof B ; + +} diff --git a/gf-book/examples/chapter9/AnaphoraIta.gf b/gf-book/examples/chapter9/AnaphoraIta.gf new file mode 100644 index 000000000..288872160 --- /dev/null +++ b/gf-book/examples/chapter9/AnaphoraIta.gf @@ -0,0 +1,17 @@ +concrete AnaphoraIta of Anaphora = TestSemanticsIta - [she_NP] ** + open ResIta, Prelude, Formal in { + +lincat + Proof = {} ; + +lin + IfS A B = {s = "se" ++ A.s ++ B.s} ; + + AnaNP cn _ _ = case cn.g of { + Masc => pronNP "lui" "lo" "gli" Masc Sg Per3 ; + Fem => pronNP "lei" "la" "le" Fem Sg Per3 + } ; + + pe _ _ = constant [] ; ---- + +} diff --git a/gf-book/examples/chapter9/Grammar.gf b/gf-book/examples/chapter9/Grammar.gf new file mode 100644 index 000000000..57e3f8dcc --- /dev/null +++ b/gf-book/examples/chapter9/Grammar.gf @@ -0,0 +1,39 @@ +abstract Grammar = { + + flags startcat = S ; + + cat + S ; Cl ; NP ; VP ; AP ; CN ; + Det ; N ; A ; V ; V2 ; AdA ; + Tense ; Pol ; + Conj ; + data + UseCl : Tense -> Pol -> Cl -> S ; + PredVP : NP -> VP -> Cl ; + ComplV2 : V2 -> NP -> VP ; + DetCN : Det -> CN -> NP ; + ModCN : AP -> CN -> CN ; + + CompAP : AP -> VP ; + AdAP : AdA -> AP -> AP ; + + ConjS : Conj -> S -> S -> S ; + ConjNP : Conj -> NP -> NP -> NP ; + + UseV : V -> VP ; + UseN : N -> CN ; + UseA : A -> AP ; + + a_Det, the_Det, every_Det : Det ; + this_Det, these_Det : Det ; + that_Det, those_Det : Det ; + i_NP, she_NP, we_NP : NP ; + very_AdA : AdA ; + + Pos, Neg : Pol ; + Pres, Perf : Tense ; + + and_Conj, or_Conj : Conj ; + + +} diff --git a/gf-book/examples/chapter9/GrammarIta.gf b/gf-book/examples/chapter9/GrammarIta.gf new file mode 100644 index 000000000..93b2b78fb --- /dev/null +++ b/gf-book/examples/chapter9/GrammarIta.gf @@ -0,0 +1,141 @@ +concrete GrammarIta of Grammar = open ResIta, Prelude in { + lincat + S = {s : Str} ; + Cl = {s : ResIta.Tense => Bool => Str} ; + NP = ResIta.NP ; + -- {s : Case => {clit,obj : Str ; isClit : Bool} ; a : Agr} ; + VP = ResIta.VP ; + -- {v : Verb ; clit : Str ; clitAgr : ClitAgr ; obj : Agr => Str} ; + AP = {s : Gender => Number => Str ; isPre : Bool} ; + CN = Noun ; -- {s : Number => Str ; g : Gender} ; + Det = {s : Gender => Case => Str ; n : Number} ; + N = Noun ; -- {s : Number => Str ; g : Gender} ; + A = Adj ; -- {s : Gender => Number => Str ; isPre : Bool} ; + V = Verb ; -- {s : VForm => Str ; aux : Aux} ; + V2 = Verb ** {c : Case} ; + AdA = {s : Str} ; + Pol = {s : Str ; b : Bool} ; + Tense = {s : Str ; t : ResIta.Tense} ; + Conj = {s : Str ; n : Number} ; + lin + UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! p.b} ; + PredVP np vp = + let + subj = (np.s ! Nom).obj ; + obj = vp.obj ! np.a ; + clit = vp.clit ; + verb = table { + Pres => agrV vp.v np.a ; + Perf => agrV (auxVerb vp.v.aux) np.a ++ agrPart vp.v np.a vp.clitAgr + } + in { + s = \\t,b => subj ++ neg b ++ clit ++ verb ! t ++ obj + } ; + + ComplV2 v2 np = + let + nps = np.s ! v2.c + in { + v = v2 ; + clit = nps.clit ; + clitAgr = case of { + => CAgr np.a ; + _ => CAgrNo + } ; + obj = \\_ => nps.obj + } ; + + UseV v = { + v = v ; + clit = [] ; + clitAgr = CAgrNo ; + obj = \\_ => [] + } ; + + DetCN det cn = { + s = \\c => { + obj = det.s ! cn.g ! c ++ cn.s ! det.n ; + clit = [] ; + isClit = False + } ; + a = Ag cn.g det.n Per3 + } ; + + ModCN ap cn = { + s = \\n => preOrPost ap.isPre (ap.s ! cn.g ! n) (cn.s ! n) ; + g = cn.g + } ; + + CompAP ap = { + v = essere_V ; + clit = [] ; + clitAgr = CAgrNo ; + obj = \\ag => case ag of { + Ag g n _ => ap.s ! g ! n + } + } ; + + AdAP ada ap = { + s = \\g,n => ada.s ++ ap.s ! g ! n ; + isPre = ap.isPre ; + } ; + + ConjNP co nx ny = { + s = \\c => { + obj = (nx.s ! c).obj ++ co.s ++ (ny.s ! c).obj ; + clit = [] ; + isClit = False + } ; + a = conjAgr co.n nx.a ny.a + } ; + + ConjS co x y = {s = x.s ++ co.s ++ y.s} ; + + UseN n = n ; + + UseA adj = adj ; + + a_Det = adjDet (mkAdj "un" "una" [] [] True) Sg ; + + every_Det = adjDet (regAdj "ogni") Sg ; + + the_Det = { + s = table { + Masc => table { + Nom | Acc => elisForms "lo" "l'" "il" ; + Dat => elisForms "allo" "all'" "al" + } ; + Fem => table { + Nom | Acc => elisForms "la" "'l" "la" ; + Dat => elisForms "alla" "all'" "alla" + } + } ; + n = Sg + } ; + + this_Det = adjDet (regAdj "questo") Sg ; + these_Det = adjDet (regAdj "questo") Pl ; + that_Det = adjDet quello_A Sg ; + those_Det = adjDet quello_A Pl ; + + i_NP = pronNP "io" "mi" "mi" Masc Sg Per1 ; + she_NP = pronNP "lei" "la" "le" Fem Sg Per3 ; + we_NP = pronNP "noi" "ci" "ci" Masc Pl Per1 ; + + very_AdA = ss "molto" ; + + Pos = {s = [] ; b = True} ; + Neg = {s = [] ; b = False} ; + Pres = {s = [] ; t = ResIta.Pres} ; + Perf = {s = [] ; t = ResIta.Perf} ; + + and_Conj = {s = "e" ; n = Pl} ; + or_Conj = {s = "o" ; n = Sg} ; + + oper + quello_A : Adj = mkAdj + (elisForms "quello" "quell'" "quel") "quella" + (elisForms "quegli" "quegli" "quei") "quelle" + True ; + +} diff --git a/gf-book/examples/chapter9/Logic.gf b/gf-book/examples/chapter9/Logic.gf new file mode 100644 index 000000000..0ce8df7e9 --- /dev/null +++ b/gf-book/examples/chapter9/Logic.gf @@ -0,0 +1,9 @@ +abstract Logic = { + cat + Prop ; Ind ; + data + And, Or, If : Prop -> Prop -> Prop ; + Not : Prop -> Prop ; + All, Exist : (Ind -> Prop) -> Prop ; + Past : Prop -> Prop ; +} diff --git a/gf-book/examples/chapter9/LogicIta.gf b/gf-book/examples/chapter9/LogicIta.gf new file mode 100644 index 000000000..f94edc11c --- /dev/null +++ b/gf-book/examples/chapter9/LogicIta.gf @@ -0,0 +1,54 @@ +concrete LogicIta of Logic = GrammarIta ** open ResIta, Formal, Prelude in { + + +lincat + T, I = SS ; +lin + And x y = infixSS "&" x y ; + Or x y = infixSS "v" x y ; + If x y = infixSS "->" x y ; + Not x = prefixSS "~" x ; + All P = prefixSS (parenth ("A" ++ P.$0)) P ; + Exist P = prefixSS (parenth ("E" ++ P.$0)) P ; + Past P = prefixSS "Past" P ; + +lin + iN f = star (f.s ! Sg) ; + iA f = star (f.s ! Masc ! Sg) ; + iV f = star (f.s ! VInf) ; + iV2 f x y = star (f.s ! VInf) (cc2 x y) ; + +oper star : Str -> SS -> SS = \f,x -> prefixSS f (ss (parenth x.s)) ; + +{- + +lincat + T, I = TermPrec ; +lin + And = infixl 2 "&" ; + Or = infixl 2 "v" ; + If = infixr 1 "->" ; +-- Not = prefix 3 "~" ; +-- All : (I -> T) -> T ; +-- Exist : (I -> T) -> T ; +-- Past : T -> T ; + +lin + iS : S -> T ; + iCl : Cl -> T ; + iNP : NP -> (I -> T) -> T ; + iVP : VP -> I -> T ; + iAP : AP -> I -> T ; + iCN : CN -> I -> T ; + iDet : Det -> (I -> T) -> (I -> T) -> T ; + iN : N -> I -> T ; + iA : A -> I -> T ; + iV : V -> I -> T ; + iV2 : V2 -> I -> I -> T ; + iAdA : AdA -> (I -> T) -> I -> T ; + iTense : Tense -> T -> T ; + iPol : Pol -> T -> T ; + iConj : Conj -> T -> T -> T ; +-} + +} diff --git a/gf-book/examples/chapter9/LogicSymb.gf b/gf-book/examples/chapter9/LogicSymb.gf new file mode 100644 index 000000000..14932fe9b --- /dev/null +++ b/gf-book/examples/chapter9/LogicSymb.gf @@ -0,0 +1,13 @@ +concrete LogicSymb of Logic = open Formal, Prelude in { + +lincat + Prop, Ind = TermPrec ; +lin + And = infixl 2 "\\&" ; + Or = infixl 2 "\\vee" ; + If = infixr 1 "\\sup" ; + Not = prefix 3 "\\sim" ; + All P = prefix 3 (parenth ("\\forall" ++ P.$0)) P ; + Exist P = prefix 3 (parenth ("\\exists" ++ P.$0)) P ; + Past = prefix 3 "P" ; +} diff --git a/gf-book/examples/chapter9/ParadigmsIta.gf b/gf-book/examples/chapter9/ParadigmsIta.gf new file mode 100644 index 000000000..010140a62 --- /dev/null +++ b/gf-book/examples/chapter9/ParadigmsIta.gf @@ -0,0 +1,47 @@ +resource ParadigmsIta = GrammarIta [N,A,V] ** + open ResIta, GrammarIta, Prelude in { + +oper + masculine : Gender = Masc ; + feminine : Gender = Fem ; + + accusative : Case = Acc ; + dative : Case = Dat ; + + mkN = overload { + mkN : (vino : Str) -> N + = \n -> lin N (regNoun n) ; + mkN : (uomo, uomini : Str) -> Gender -> N + = \s,p,g -> lin N (mkNoun s p g) ; + } ; + + mkA = overload { + mkA : (nero : Str) -> A + = \a -> lin A (regAdj a) ; + mkA : (buono,buona,buoni,buone : Str) -> Bool -> A + = \sm,sf,pm,pf,p -> lin A (mkAdj sm sf pm pf False) ; + } ; + + preA : A -> A + = \a -> lin A {s = a.s ; isPre = True} ; + + mkV = overload { + mkV : (finire : Str) -> V + = \v -> lin V (regVerb v) ; + mkV : (andare,vado,vadi,va,andiamo,andate,vanno,andato : Str) -> V + = \i,p1,p2,p3,p4,p5,p6,p -> lin V (mkVerb i p1 p2 p3 p4 p5 p6 p Avere) ; + } ; + + essereV : V -> V + = \v -> lin V {s = v.s ; aux = Essere} ; + + mkV2 = overload { + mkV2 : Str -> V2 + = \s -> lin V2 (regVerb s ** {c = accusative}) ; + mkV2 : V -> V2 + = \v -> lin V2 (v ** {c = accusative}) ; + mkV2 : V -> Case -> V2 + = \v,c -> lin V2 (v ** {c = c}) ; + } ; + +} diff --git a/gf-book/examples/chapter9/ResIta.gf b/gf-book/examples/chapter9/ResIta.gf new file mode 100644 index 000000000..f39db69f9 --- /dev/null +++ b/gf-book/examples/chapter9/ResIta.gf @@ -0,0 +1,178 @@ +resource ResIta = open Prelude in { + +-- parameters + +param + Number = Sg | Pl ; + Gender = Masc | Fem ; + Case = Nom | Acc | Dat ; + Agr = Ag Gender Number Person ; + Aux = Avere | Essere ; + Tense = Pres | Perf ; + Person = Per1 | Per2 | Per3 ; + + VForm = VInf | VPres Number Person | VPart Gender Number ; + + ClitAgr = CAgrNo | CAgr Agr ; + +-- parts of speech + +oper + VP = { + v : Verb ; + clit : Str ; + clitAgr : ClitAgr ; + obj : Agr => Str + } ; + NP = { + s : Case => {clit,obj : Str ; isClit : Bool} ; + a : Agr + } ; + +-- the preposition word of an abstract case + + prepCase : Case -> Str = \c -> case c of { + Dat => "a" ; + _ => [] + } ; + +-- for predication + + agrV : Verb -> Agr -> Str = \v,a -> case a of { + Ag _ n p => v.s ! VPres n p + } ; + + auxVerb : Aux -> Verb = \a -> case a of { + Avere => + mkVerb "avere" "ho" "hai" "ha" "abbiamo" "avete" "hanno" "avuto" Avere ; + Essere => + mkVerb "essere" "sono" "sei" "" "siamo" "siete" "sono" "stato" Essere + } ; + + agrPart : Verb -> Agr -> ClitAgr -> Str = \v,a,c -> case v.aux of { + Avere => case c of { + CAgr (Ag g n _) => v.s ! VPart g n ; + _ => v.s ! VPart Masc Sg + } ; + Essere => case a of { + Ag g n _ => v.s ! VPart g n + } + } ; + + neg : Bool -> Str = \b -> case b of {True => [] ; False => "non"} ; + + essere_V = auxVerb Essere ; + +-- for coordination + + conjAgr : Number -> Agr -> Agr -> Agr = \n,xa,ya -> + let + x = agrFeatures xa ; y = agrFeatures ya + in Ag + (conjGender x.g y.g) + (conjNumber (conjNumber x.n y.n) n) + (conjPerson x.p y.p) ; + + agrFeatures : Agr -> {g : Gender ; n : Number ; p : Person} = \a -> + case a of {Ag g n p => {g = g ; n = n ; p = p}} ; + + conjGender : Gender -> Gender -> Gender = \g,h -> + case g of {Masc => Masc ; _ => h} ; + + conjNumber : Number -> Number -> Number = \m,n -> + case m of {Pl => Pl ; _ => n} ; + + conjPerson : Person -> Person -> Person = \p,q -> + case of { + | <_,Per1> => Per1 ; + | <_,Per2> => Per2 ; + _ => Per3 + } ; + + + +-- for morphology + + Noun : Type = {s : Number => Str ; g : Gender} ; + Adj : Type = {s : Gender => Number => Str ; isPre : Bool} ; + Verb : Type = {s : VForm => Str ; aux : Aux} ; + + mkNoun : Str -> Str -> Gender -> Noun = \vino,vini,g -> { + s = table {Sg => vino ; Pl => vini} ; + g = g + } ; + + regNoun : Str -> Noun = \vino -> case vino of { + fuo + c@("c"|"g") + "o" => mkNoun vino (fuo + c + "hi") Masc ; + ol + "io" => mkNoun vino (ol + "i") Masc ; + vin + "o" => mkNoun vino (vin + "i") Masc ; + cas + "a" => mkNoun vino (cas + "e") Fem ; + pan + "e" => mkNoun vino (pan + "i") Masc ; + _ => mkNoun vino vino Masc + } ; + + mkAdj : (_,_,_,_ : Str) -> Bool -> Adj = \buono,buona,buoni,buone,p -> { + s = table { + Masc => table {Sg => buono ; Pl => buoni} ; + Fem => table {Sg => buona ; Pl => buone} + } ; + isPre = p + } ; + + regAdj : Str -> Adj = \nero -> case nero of { + ner + "o" => mkAdj nero (ner + "a") (ner + "i") (ner + "e") False ; + verd + "e" => mkAdj nero nero (verd + "i") (verd + "i") False ; + _ => mkAdj nero nero nero nero False + } ; + + mkVerb : (_,_,_,_,_,_,_,_ : Str) -> Aux -> Verb = + \amare,amo,ami,ama,amiamo,amate,amano,amato,aux -> { + s = table { + VInf => amare ; + VPres Sg Per1 => amo ; + VPres Sg Per2 => ami ; + VPres Sg Per3 => ama ; + VPres Pl Per1 => amiamo ; + VPres Pl Per2 => amate ; + VPres Pl Per3 => amano ; + VPart g n => (regAdj amato).s ! g ! n + } ; + aux = aux + } ; + + regVerb : Str -> Verb = \amare -> case amare of { + am + "are" => mkVerb amare (am+"o") (am+"i") (am+"a") + (am+"iamo") (am+"ate") (am+"ano") (am+"ato") Avere ; + tem + "ere" => mkVerb amare (tem+"o") (tem+"i") (tem+"e") + (tem+"iamo") (tem+"ete") (tem+"ono") (tem+"uto") Avere ; + fin + "ire" => mkVerb amare (fin+"isco") (fin+"isci") (fin+"isce") + (fin+"iamo") (fin+"ite") (fin+"iscono") (fin+"ito") Avere + } ; + +-- for structural words + + adjDet : Adj -> Number -> {s : Gender => Case => Str ; n : Number} = + \adj,n -> { + s = \\g,c => prepCase c ++ adj.s ! g ! n ; + n = n + } ; + + pronNP : (s,a,d : Str) -> Gender -> Number -> Person -> NP = + \s,a,d,g,n,p -> { + s = table { + Nom => {clit = [] ; obj = s ; isClit = False} ; + Acc => {clit = a ; obj = [] ; isClit = True} ; + Dat => {clit = d ; obj = [] ; isClit = True} + } ; + a = Ag g n p + } ; + +-- phonological auxiliaries + + vowel : pattern Str = #("a" | "e" | "i" | "o" | "u" | "h") ; + s_impuro : pattern Str = #("z" | "s" + ("b"|"c"|"d"|"f"|"m"|"p"|"q"|"t")) ; + + elisForms : (_,_,_ : Str) -> Str = \lo,l',il -> + pre {#s_impuro => lo ; #vowel => l' ; _ => il} ; + +} diff --git a/gf-book/examples/chapter9/Semantics.gf b/gf-book/examples/chapter9/Semantics.gf new file mode 100644 index 000000000..0976caa93 --- /dev/null +++ b/gf-book/examples/chapter9/Semantics.gf @@ -0,0 +1,39 @@ +abstract Semantics = Grammar, Logic ** { +fun + iS : S -> Prop ; + iCl : Cl -> Prop ; + iNP : NP -> (Ind -> Prop) -> Prop ; + iVP : VP -> Ind -> Prop ; + iAP : AP -> Ind -> Prop ; + iCN : CN -> Ind -> Prop ; + iDet : Det -> (Ind -> Prop) -> (Ind -> Prop) -> Prop ; + iN : N -> Ind -> Prop ; + iA : A -> Ind -> Prop ; + iV : V -> Ind -> Prop ; + iV2 : V2 -> Ind -> Ind -> Prop ; + iAdA : AdA -> (Ind -> Prop) -> Ind -> Prop ; + iTense : Tense -> Prop -> Prop ; + iPol : Pol -> Prop -> Prop ; + iConj : Conj -> Prop -> Prop -> Prop ; +def + iS (UseCl t p cl) = iTense t (iPol p (iCl cl)) ; + iCl (PredVP np vp) = iNP np (iVP vp) ; + iVP (ComplV2 v2 np) i = iNP np (iV2 v2 i) ; + iNP (DetCN det cn) f = iDet det (iCN cn) f ; + iCN (ModCN ap cn) i = And (iAP ap i) (iCN cn i) ; + iVP (CompAP ap) i = iAP ap i ; + iAP (AdAP ada ap) i = iAdA ada (iAP ap) i ; + iS (ConjS conj x y) = iConj conj (iS x) (iS y) ; + iNP (ConjNP conj x y) f = iConj conj (iNP x f) (iNP y f) ; + iVP (UseV v) i = iV v i ; + iAP (UseA a) i = iA a i ; + iCN (UseN n) i = iN n i ; + iDet a_Det d f = Exist (\x -> And (d x) (f x)) ; + iDet every_Det d f = All (\x -> If (d x) (f x)) ; + iPol Pos t = t ; + iPol Neg t = Not t ; + iTense Pres t = t ; + iTense Perf t = Past t ; + iConj and_Conj a b = And a b ; + iConj or_Conj a b = Or a b ; +} diff --git a/gf-book/examples/chapter9/SemanticsIta.gf b/gf-book/examples/chapter9/SemanticsIta.gf new file mode 100644 index 000000000..70d4b79b9 --- /dev/null +++ b/gf-book/examples/chapter9/SemanticsIta.gf @@ -0,0 +1,42 @@ +concrete SemanticsIta of Semantics = GrammarIta, LogicSymb ** open ResIta, Formal, Prelude in { + +lin + iN f = star (f.s ! Sg) ; + iA f = star (f.s ! Masc ! Sg) ; + iV f = star (f.s ! VInf) ; + iV2 f x y = star (f.s ! VInf) (cc2 x y) ; + +oper star : Str -> SS -> TermPrec = \f,x -> prefix 3 (f ++ "*") (constant (parenth x.s)) ; + +{- + +lincat + T, I = TermPrec ; +lin + And = infixl 2 "&" ; + Or = infixl 2 "v" ; + If = infixr 1 "->" ; +-- Not = prefix 3 "~" ; +-- All : (I -> T) -> T ; +-- Exist : (I -> T) -> T ; +-- Past : T -> T ; + +lin + iS : S -> T ; + iCl : Cl -> T ; + iNP : NP -> (I -> T) -> T ; + iVP : VP -> I -> T ; + iAP : AP -> I -> T ; + iCN : CN -> I -> T ; + iDet : Det -> (I -> T) -> (I -> T) -> T ; + iN : N -> I -> T ; + iA : A -> I -> T ; + iV : V -> I -> T ; + iV2 : V2 -> I -> I -> T ; + iAdA : AdA -> (I -> T) -> I -> T ; + iTense : Tense -> T -> T ; + iPol : Pol -> T -> T ; + iConj : Conj -> T -> T -> T ; +-} + +} diff --git a/gf-book/examples/chapter9/Syntax.gf b/gf-book/examples/chapter9/Syntax.gf new file mode 100644 index 000000000..01a51d0ee --- /dev/null +++ b/gf-book/examples/chapter9/Syntax.gf @@ -0,0 +1,47 @@ +interface Syntax = Grammar - + [UseCl,PredVP,ComplV2,UseV,DetCN,ModCN,CompAP,AdAP, + ConjS,ConjNP,UseN,UseA,Pres,Perf,Pos,Neg] ** + open Grammar in { + +oper + mkS = overload { + mkS : Cl -> S = UseCl Pres Pos ; + mkS : Tense -> Cl -> S = \t -> UseCl t Pos ; + mkS : Pol -> Cl -> S = UseCl Pres ; + mkS : Tense -> Pol -> Cl -> S = UseCl ; + mkS : Conj -> S -> S -> S = ConjS ; + } ; + + mkCl = overload { + mkCl : NP -> V -> Cl = \np,v -> PredVP np (UseV v) ; + mkCl : NP -> V2 -> NP -> Cl = \np,v,o -> PredVP np (ComplV2 v o) ; + mkCl : NP -> A -> Cl = \np,a -> PredVP np (CompAP (UseA a)) ; + mkCl : NP -> AP -> Cl = \np,ap -> PredVP np (CompAP ap) ; + mkCl : NP -> VP -> Cl = PredVP ; + } ; + + mkAP = overload { + mkAP : A -> AP = UseA ; + mkAP : AdA -> AP -> AP = AdAP ; + } ; + + mkNP = overload { + mkNP : Det -> N -> NP = \d,n -> DetCN d (UseN n) ; + mkNP : Det -> CN -> NP = \d,n -> DetCN d n ; + mkNP : Conj -> NP -> NP -> NP = ConjNP ; + } ; + + mkCN = overload { + mkCN : N -> CN = UseN ; + mkCN : A -> N -> CN = \a,n -> ModCN (UseA a) (UseN n) ; + mkCN : A -> CN -> CN = \a,n -> ModCN (UseA a) n ; + mkCN : AP -> N -> CN = \a,n -> ModCN a (UseN n) ; + mkCN : AP -> CN -> CN = \a,n -> ModCN a n ; + } ; + + presTense : Tense = Pres ; + perfTense : Tense = Perf ; + posPol : Pol = Pos ; + negPol : Pol = Neg ; + +} diff --git a/gf-book/examples/chapter9/SyntaxIta.gf b/gf-book/examples/chapter9/SyntaxIta.gf new file mode 100644 index 000000000..b4562b0de --- /dev/null +++ b/gf-book/examples/chapter9/SyntaxIta.gf @@ -0,0 +1,3 @@ +instance SyntaxIta of Syntax = GrammarIta - + [PredVP,ComplV2,UseV,DetCN,ModCN,CompAP,AdAP,UseN,UseA] ** + open GrammarIta in {} ; diff --git a/gf-book/examples/chapter9/Test.gf b/gf-book/examples/chapter9/Test.gf new file mode 100644 index 000000000..ebe55e7e0 --- /dev/null +++ b/gf-book/examples/chapter9/Test.gf @@ -0,0 +1,9 @@ +abstract Test = Grammar ** { + +fun + man_N, woman_N, house_N, tree_N : N ; + big_A, small_A, green_A : A ; + walk_V, arrive_V : V ; + love_V2, please_V2 : V2 ; + +} ; diff --git a/gf-book/examples/chapter9/TestIta.gf b/gf-book/examples/chapter9/TestIta.gf new file mode 100644 index 000000000..8ae524371 --- /dev/null +++ b/gf-book/examples/chapter9/TestIta.gf @@ -0,0 +1,17 @@ +concrete TestIta of Test = GrammarIta ** open ParadigmsIta in { + +lin + man_N = mkN "uomo" "uomini" masculine ; + woman_N = mkN "donna" ; + house_N = mkN "casa" ; + tree_N = mkN "albero" ; + big_A = preA (mkA "grande") ; + small_A = preA (mkA "piccolo") ; + green_A = mkA "verde" ; + walk_V = mkV "camminare" ; + arrive_V = essereV (mkV "arrivare") ; + love_V2 = mkV2 "amare" ; + please_V2 = mkV2 (essereV (mkV "piacere" "piaccio" "piaci" "piace" + "piacciamo" "piacete" "piacciono" "piaciuto")) dative ; + +} ; diff --git a/gf-book/examples/chapter9/TestSemantics.gf b/gf-book/examples/chapter9/TestSemantics.gf new file mode 100644 index 000000000..ce8fe4428 --- /dev/null +++ b/gf-book/examples/chapter9/TestSemantics.gf @@ -0,0 +1 @@ +abstract TestSemantics = Test, Semantics ; diff --git a/gf-book/examples/chapter9/TestSemanticsIta.gf b/gf-book/examples/chapter9/TestSemanticsIta.gf new file mode 100644 index 000000000..ce6abfc09 --- /dev/null +++ b/gf-book/examples/chapter9/TestSemanticsIta.gf @@ -0,0 +1 @@ +concrete TestSemanticsIta of TestSemantics = TestIta, SemanticsIta ; diff --git a/gf-book/index.html b/gf-book/index.html new file mode 100644 index 000000000..9c7a805fe --- /dev/null +++ b/gf-book/index.html @@ -0,0 +1,127 @@ + + + + +Grammatical Framework: Programming with Multilingual Grammars + +

Grammatical Framework: Programming with Multilingual Grammars

+ +Aarne Ranta
+**Web page work in progress** +
+ +

+This is the web page of the book +

+
    +
  • Aarne Ranta, + Grammatical Framework: Programming with Multilingual Grammars, + CSLI Publications, + Stanford, + 2011 (to appear). +
+ +

Book description

+

+Grammars of natural languages are complex systems, and their +computer implementation requires both programming skills and +linguistic knowledge, especially when dealing with other languages +than English. This book makes such tasks accessible for a wide +range of programmers. It introduces GF (Grammatical Framework), +which is a programming language designed for writing grammars, which +may moreover address several languages in parallel. +The book shows how to write grammars in GF and use them in applications +such as tourist phrasebooks, spoken dialogue systems, and natural +language interfaces. The examples and exercises address several +languages, and the readers are guided to look at their own languages +from the computational perspective. +

+

+With an emphasis on good engineering, the book promotes modularity +and division of labour - in particular, the use of libraries. It +introduces the GF Resource Grammar Library, which currently addresses +16 languages. This number is constantly growing due to contributions +from the international GF community. The library makes it painless to +build applications and to port them to new languages. The book +introduces a wide range of such applications, which run on platforms +ranging from web servers to mobile phones. But the book also gives +guidance for those readers who want to understand the underlying +linguistics and implement resource grammars for new languages. +

+

+The book starts with a hands-on tutorial, continues with a selection +of advanced topics, and ends with a complete reference manual +of GF. Requiring very little background knowledge, it is accessible +for second-year students that have experience with computers and an +interest for languages. At the same time, its novel and advanced +material makes it interesting for senior researchers in computer science, +linguistics, and related fields. +

+

Publisher's information

+

+Forthcoming at http://www-csli.stanford.edu/pubs/ +

+

How to cite

+
+  @Book{ranta-2011,
+    author = {Aarne Ranta},
+    title =  {{Grammatical Framework:
+               Programming with Multilingual Grammars}},
+    publisher = {{CSLI Publications}},
+    year = {2011},
+    note = "to appear"
+  }
+
+

+

Table of Contents

+

+Preliminary Table of Contents +

+

Supporting material

+

+Slides for teaching the book chapter by chapter are forthcoming. +The following should be useful before that. +

+ + +

+Code examples +

+

+Demos +

+ + +

+Works mentioned in references, +download links to more works forthcoming. +

+

+Resource Grammar Library API +

+

+Sources and binaries +for GF 3.2, which exactly matches the book. +

+

+GF Home Page: http://www.grammaticalframework.org/ +

+

+Author's email: aarne'at'chalmers'dot'se +

+

+Author's home page: http://www.cse.chalmers.se/~aarne/ +

+ + + + diff --git a/gf-book/index.txt b/gf-book/index.txt new file mode 100644 index 000000000..a53ae9882 --- /dev/null +++ b/gf-book/index.txt @@ -0,0 +1,101 @@ +Grammatical Framework: Programming with Multilingual Grammars +Aarne Ranta +**Web page work in progress** + + +This is the web page of the book +- Aarne Ranta, + //Grammatical Framework: Programming with Multilingual Grammars//, + CSLI Publications, + Stanford, + 2011 (to appear). + + +==Book description== + +Grammars of natural languages are complex systems, and their +computer implementation requires both programming skills and +linguistic knowledge, especially when dealing with other languages +than English. This book makes such tasks accessible for a wide +range of programmers. It introduces GF (Grammatical Framework), +which is a programming language designed for writing grammars, which +may moreover address several languages in parallel. +The book shows how to write grammars in GF and use them in applications +such as tourist phrasebooks, spoken dialogue systems, and natural +language interfaces. The examples and exercises address several +languages, and the readers are guided to look at their own languages +from the computational perspective. + +With an emphasis on good engineering, the book promotes modularity +and division of labour - in particular, the use of libraries. It +introduces the GF Resource Grammar Library, which currently addresses +16 languages. This number is constantly growing due to contributions +from the international GF community. The library makes it painless to +build applications and to port them to new languages. The book +introduces a wide range of such applications, which run on platforms +ranging from web servers to mobile phones. But the book also gives +guidance for those readers who want to understand the underlying +linguistics and implement resource grammars for new languages. + +The book starts with a hands-on tutorial, continues with a selection +of advanced topics, and ends with a complete reference manual +of GF. Requiring very little background knowledge, it is accessible +for second-year students that have experience with computers and an +interest for languages. At the same time, its novel and advanced +material makes it interesting for senior researchers in computer science, +linguistics, and related fields. + + +==Publisher's information== + +Forthcoming at http://www-csli.stanford.edu/pubs/ + +==How to cite== + +``` +@Book{ranta-2011, + author = {Aarne Ranta}, + title = {{Grammatical Framework: + Programming with Multilingual Grammars}}, + publisher = {{CSLI Publications}}, + year = {2011}, + note = "to appear" +} +``` + +==Table of Contents== + +[Preliminary Table of Contents toc-gf-book.txt] + + +==Supporting material== + +Slides for teaching the book chapter by chapter are forthcoming. +The following should be useful before that. +- [GF Tutorial ../doc/tutorial/gf-tutorial.html]: programmer-oriented, + covering parts of chapters 2-8 +- [GF Resource Tutorial ../doc/gf-lrec-2010.pdf]: linguist-oriented, + covering parts of chapters 2-5, 9-10 + + +[Code examples ./examples] + +Demos +- [on-line translator http://www.grammaticalframework.org:41296/minibar/minibar.html] (Section 7.12) +- [syntax editor http://www.grammaticalframework.org/demos/resource-api/editor.html] (Section 7.13) +- [multimodal dialogue system http://www.youtube.com/watch?v=1bfaYHWS6zU] (Section 7.15) + + +[Works mentioned in references http://www.grammaticalframework.org/doc/gf-bibliography.html], +download links to more works forthcoming. + +[Resource Grammar Library API http://www.grammaticalframework.org/lib/doc/synopsis.html] + +[Sources and binaries http://www.grammaticalframework.org/download] +for GF 3.2, which exactly matches the book. + +GF Home Page: http://www.grammaticalframework.org/ + +Author's email: aarne'at'chalmers'dot'se + +Author's home page: http://www.cse.chalmers.se/~aarne/ diff --git a/gf-book/toc-gf-book.txt b/gf-book/toc-gf-book.txt new file mode 100644 index 000000000..b46165de7 --- /dev/null +++ b/gf-book/toc-gf-book.txt @@ -0,0 +1,263 @@ +1 Introduction +1.1 What this book is about +1.2 How to use this book +1.3 The role of grammars in language processing +1.4 The cost of grammars +1.5 Multilinguality +1.6 Semantic actions and interoperability +1.7 Application grammars and resource grammars +1.8 History of GF and its applications +1.9 Related work + +part I A GF Tutorial + +2 Basic concepts of multilingual grammars +2.1 The BNF grammar format +2.2 Using the GF system +2.3 Testing a grammar in the GF system +2.4 A BNF grammar for Italian +2.5 BNF grammars and translation +2.6 Abstract and concrete syntax +2.7 Translating in GF +2.8 The structure of grammar modules +2.9 On the limitations of BNF grammars +2.10 Suppression and metavariables +2.11 Free variation +2.12 Ambiguity +2.13 Remaining problems +2.14 Graph-based visualization and shell escapes +2.15 Lexing and unlexing +2.16 Character encoding + +3 Parameters, tables, and records +3.1 The problem of morphological variation +3.2 Parameters and tables +3.3 Variable vs. inherent features +3.4 Records and record types +3.5 Linearization types and agreement +3.6 Functional programming in GF: operation definitions +3.7 The Food grammar revisited +3.8 Testing inflection and operations in GF +3.9 Partial application +3.10 Discontinuous constituents +3.11 Non-concatenative morphology + +4 Modular and scalable grammar writing +4.1 Reusable resource modules +4.2 Data abstraction +4.3 Case expressions and string matching +4.4 Smart paradigms +4.5 Arabic morphology revisited +4.6 Separating operation types and definitions +4.7 Overloading of operations +4.8 Module extension and inheritance +4.9 Inheritance and opening +4.10 Dependency graphs +4.11 Algebraic datatypes for parameters +4.12 Record extension and subtyping +4.13 Tuples and product types +4.14 Prefix-dependent choices and pattern macros +4.15 Strings at compile time vs. run time + +5 Using the Resource Grammar Library +5.1 The purpose and coverage of the library +5.2 Lexical vs. phrasal rules +5.3 Lexical categories and rules +5.4 Phrasal categories and rules +5.5 The resource API +5.6 The library path +5.7 Example: English +5.8 Functor implementation of multilingual grammars +5.9 Interfaces and instances +5.10 A design pattern for multilingual grammars +5.11 Division of labour revisited +5.12 Overriding a functor +5.13 Compile-time transfer +5.14 The resource grammar as a linguistic ontology +5.15 A tour of the resource API +5.16 Flattening of constructions +5.17 Tense and polarity +5.18 Browsing the library + +6 Semantic actions and conditions in abstract syntax +6.1 GF as a logical framework +6.2 Dependent types +6.3 Selectional restrictions +6.4 Polymorphism +6.5 Dependent types in concrete syntax +6.6 Proof objects +6.7 Proof-carrying documents +6.8 Restricted polymorphism +6.9 Variable bindings and higher-order abstract syntax +6.10 Anaphoric expressions +6.11 Semantic definitions +6.12 Intensional and extensional equality +6.13 Semantic actions and run-time transfer +6.14 Predefined categories +6.15 Probabilistic GF grammars + +part II Larger Grammars and Applications + +7 Embedded grammars and code generation +7.1 The portable grammar format +7.2 The embedded interpreter and its API +7.3 Embedded GF applications in Haskell +7.4 The module PGF +7.5 A stand-alone translator +7.6 A translator loop +7.7 A question-answer system +7.8 Exporting GF datatypes +7.9 Putting it all together +7.10 Web server applications +7.11 Embedded grammars in other host languages +7.12 Multilingual syntax editing +7.13 Language models for speech recognition +7.14 Statistical language models +7.15 Multimodal dialogue systems + +8 Interfacing formal and natural languages +8.1 Arithmetic expressions +8.2 Code generation as linearization +8.3 Programs with variables +8.4 The concrete syntax of assignments +8.5 A liberal syntax of variables +8.6 Is GF useful for defining formal languages? +8.7 Natural language generation from logic +8.8 Logical semantics of natural language +8.9 Grammars for fractals + +9 Getting started with resource grammar programming +9.1 Overview +9.2 The miniature resource grammar +9.3 Feature design +9.4 Predication +9.5 Complementation +9.6 Determination +9.7 Modification +9.8 Lexical insertion +9.9 The miniature resource in Italian +9.10 Implementing morphology +9.11 Implementing modification and determination +9.12 Implementing verb phrases and complementation +9.13 Implementing predication +9.14 Implementing the rest +9.15 Coordination and extraction + +10 Extending the Resource Grammar Library +10.1 The module structure of a resource grammar +10.2 Effort statistics +10.3 Workflow for a new language +10.4 Reusing code from the miniature resource +10.5 The development-test cycle +10.6 Non-ASCII alphabets and transliterations +10.7 Coding discipline +10.8 Functors in the resource grammar +10.9 Widening the coverage for parsing text +10.10 Bootstrapping a resource lexicon + +A A miniature resource grammar +A.1 Abstract syntax +A.2 Auxiliary resource module for Italian +A.3 Italian concrete syntax +A.4 Morphological paradigms API for Italian +A.5 Test lexicon +A.6 Syntax API + +B A glossary of linguistic terms + +part III GF Reference Manual + +C The GF Programming Language + +C.1 Overview of GF +C.2 The module system +C.2.1 Top-level and supplementary module structure +C.2.2 Compilation units +C.2.3 Names +C.2.4 The structure of a module +C.2.5 Module types, headers, and bodies +C.2.6 Digression: the logic of module types +C.2.7 Inheritance +C.2.8 Opening +C.2.9 Name resolution +C.2.10 Functor instantiations +C.2.11 Completeness +C.3 Judgements +C.3.1 Overview of the forms of judgement +C.3.2 Category declarations, cat +C.3.3 Hypotheses and contexts +C.3.4 Function declarations, fun +C.3.5 Function definitions, def +C.3.6 Data constructor declarations, data +C.3.7 The semantic status of an abstract syntax function +C.3.8 Linearization type definitions, lincat +C.3.9 Linearization definitions, lin +C.3.10 Linearization default definitions, lindef +C.3.11 Printname definitions, printname cat/fun +C.3.12 Parameter type definitions, param +C.3.13 Parameter values +C.3.14 Operation definitions, oper +C.3.15 Operation overloading +C.3.16 Flag definitions, flags +C.4 Types and expressions +C.4.1 Overview of expression forms +C.4.2 The functional fragment: expressions in abstract syntax +C.4.3 List categories +C.4.4 Conversions +C.4.5 Syntax trees +C.4.6 Predefined types in abstract syntax +C.4.7 Overview of expressions in concrete syntax +C.4.8 Values, canonical forms, and run-time variables +C.4.9 Token lists, tokens, and strings +C.4.10 Records and record types +C.4.11 Subtyping +C.4.12 Tables and table types +C.4.13 Pattern matching +C.4.14 Free variation +C.4.15 Local definitions +C.4.16 Function applications in concrete syntax +C.4.17 Reusing top-level grammars as resources +C.4.18 Predefined concrete syntax types +C.4.19 Predefined concrete syntax operations +C.5 Flags and pragmas +C.5.1 Some flags and their values +C.5.2 Compiler pragmas +C.6 The grammar of GF +C.6.1 The lexical structure of GF +C.6.2 The syntactic structure of GF + +D The GF Resource Grammar Library +D.1 The category system +D.1.1 Phrasal and closed lexical categories +D.1.2 Open lexical categories +D.2 Syntax rules +D.2.1 Suprasentential level: texts and utterances +D.2.2 Sentential level: polarity, tense, and mood +D.2.3 Predication, complementation, and extraction +D.2.4 Question and relative clause formation +D.2.5 Interrogative and relative pronouns +D.2.6 Noun phrases and determiners +D.2.7 The numeral system +D.2.8 Common nouns, adjectives, and adverbs +D.2.9 Coordination +D.2.10 Structural words +D.3 Lexical Paradigms +D.3.1 Paradigms for regular words +D.3.2 Paradigms for verb, adjective, and noun subcategories +D.4 Other library modules +D.4.1 The Prelude module +D.4.2 The Formal module +D.4.3 The Symbolic module +D.4.4 The Combinators module + +E The GF Software System +E.1 The GF shell +E.2 The GF batch compiler + +F Bibliography +F.1 Publications on GF +F.2 Background and related work + +Index + + -- cgit v1.2.3