summaryrefslogtreecommitdiff
path: root/doc/tutorial/resource/MorphoIta.gf
diff options
context:
space:
mode:
Diffstat (limited to 'doc/tutorial/resource/MorphoIta.gf')
-rw-r--r--doc/tutorial/resource/MorphoIta.gf33
1 files changed, 23 insertions, 10 deletions
diff --git a/doc/tutorial/resource/MorphoIta.gf b/doc/tutorial/resource/MorphoIta.gf
index 2d5272812..7bf4de1a1 100644
--- a/doc/tutorial/resource/MorphoIta.gf
+++ b/doc/tutorial/resource/MorphoIta.gf
@@ -4,6 +4,13 @@
resource MorphoIta = open Prelude in {
+ -- the lexicographer's API
+
+ oper
+ masculine, feminine : Gender ;
+
+
+
param
Number = Sg | Pl ;
Gender = Masc | Fem ;
@@ -16,6 +23,10 @@
Verb : Type = {s : Number => Str} ;
+ -- two-place verbs have a preposition
+
+ Verb2 : Type = Verb ** {c : Str} ;
+
-- this function takes the gender and both singular and plural forms
mkNoun : Gender -> Str -> Str -> Noun = \g,vino,vini -> {
@@ -28,16 +39,18 @@
-- this function takes the singular form
- regNoun : Str -> Noun = \vino ->
- let
- vin = init vino ;
- o = last vino
- in
- case o of {
- "a" => mkNoun Fem vino (vin + "e") ; -- pizza
- "o" | "e" => mkNoun Masc vino (vin + "i") ; -- vino, pane
- _ => mkNoun Masc vino vino -- tram
- } ;
+ regNoun : Str -> Noun = \vino ->
+ case vino of {
+ vin + c@("c" | "g") + "a"
+ => mkNoun Fem vino (vin + c + "he") ; -- banche
+ vin + "a"
+ => mkNoun Fem vino (vin + "e") ; -- pizza
+ vin + c@("c" | "g") + "o"
+ => mkNoun Masc vino (vin + c + "hi") ; -- boschi
+ vin + ("o" | "e")
+ => mkNoun Masc vino (vin + "i") ; -- vino, pane
+ _ => mkNoun Masc vino vino -- tram
+ } ;
-- to make nouns such as "carne", "università" feminine