summaryrefslogtreecommitdiff
path: root/doc/tutorial/resource/MorphoEng.gf
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2005-12-19 16:31:40 +0000
committeraarne <aarne@cs.chalmers.se>2005-12-19 16:31:40 +0000
commitbfbe2e3d47e5f1904846609c80058f0561d76ede (patch)
treee41e9d1f35e48afa7049b0d05362d10df7078ae6 /doc/tutorial/resource/MorphoEng.gf
parent7878cd5e0ad8d8097a1f7a6b9885b4825fc47686 (diff)
resource examples
Diffstat (limited to 'doc/tutorial/resource/MorphoEng.gf')
-rw-r--r--doc/tutorial/resource/MorphoEng.gf33
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/tutorial/resource/MorphoEng.gf b/doc/tutorial/resource/MorphoEng.gf
new file mode 100644
index 000000000..a6a25b08c
--- /dev/null
+++ b/doc/tutorial/resource/MorphoEng.gf
@@ -0,0 +1,33 @@
+--# -path=.:prelude
+
+resource MorphoEng = open Prelude in {
+
+ param
+ Number = Sg | Pl ;
+
+ oper
+ Noun, Verb : Type = {s : Number => Str} ;
+
+ mkNoun : Str -> Str -> Noun = \x,y -> {
+ s = table {
+ Sg => x ;
+ Pl => y
+ }
+ } ;
+
+ regNoun : Str -> Noun = \s -> case last s of {
+ "s" | "z" => mkNoun s (s + "es") ;
+ "y" => mkNoun s (init s + "ies") ;
+ _ => mkNoun s (s + "s")
+ } ;
+
+ mkVerb : Str -> Str -> Verb = \x,y -> mkNoun y x ;
+
+ regVerb : Str -> Verb = \s -> case last s of {
+ "s" | "z" => mkVerb s (s + "es") ;
+ "y" => mkVerb s (init s + "ies") ;
+ "o" => mkVerb s (s + "es") ;
+ _ => mkVerb s (s + "s")
+ } ;
+
+ }