diff options
| author | aarne <aarne@cs.chalmers.se> | 2005-12-17 12:33:15 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2005-12-17 12:33:15 +0000 |
| commit | d3157ad7e7a85a78e60a5bc406ec6cc805037e06 (patch) | |
| tree | aeab4a2095015862386c6205691b5472914291cb | |
| parent | c9264a4e1f439d9c82d75aff60dd053008f3d3ca (diff) | |
morpho in tutorial
| -rw-r--r-- | doc/tutorial/MorphoEng.gf | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/doc/tutorial/MorphoEng.gf b/doc/tutorial/MorphoEng.gf new file mode 100644 index 000000000..a6a25b08c --- /dev/null +++ b/doc/tutorial/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") + } ; + + } |
