diff options
| author | aarne <aarne@cs.chalmers.se> | 2007-08-16 16:18:54 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2007-08-16 16:18:54 +0000 |
| commit | 6234e536f63e3e803286b94cee8a0e0a3adcdcb2 (patch) | |
| tree | 76151e2a18d5dc2e724f99b066860b4cb7897240 /examples/tutorial/syntax/SyntaxIta.gf | |
| parent | 5f0e8a16ecbf06a6dad344ce2ef0974692ffc581 (diff) | |
moved tutorial examples to GF/examples
Diffstat (limited to 'examples/tutorial/syntax/SyntaxIta.gf')
| -rw-r--r-- | examples/tutorial/syntax/SyntaxIta.gf | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/examples/tutorial/syntax/SyntaxIta.gf b/examples/tutorial/syntax/SyntaxIta.gf new file mode 100644 index 000000000..4721a5d4e --- /dev/null +++ b/examples/tutorial/syntax/SyntaxIta.gf @@ -0,0 +1,102 @@ +--# -path=.:prelude + +concrete SyntaxIta of Syntax = open Prelude, MorphoIta in { + + lincat + Phr = {s : Str} ; + S = {s : Str} ; + QS = {s : Str} ; + NP = {s : Str ; g : Gender ; n : Number} ; + IP = {s : Str ; g : Gender ; n : Number} ; + CN = Noun ; + Det = {s : Gender => Str ; n : Number} ; + AP = {s : Gender => Number => Str} ; + AdA = {s : Str} ; + VP = {s : Bool => Gender => Number => Str} ; + + N = Noun ; + A = Adjective ; + V = Verb ; + V2 = Verb2 ; + + lin + PhrS = postfixSS "." ; + PhrQS = postfixSS "?" ; + + PosVP np vp = {s = np.s ++ vp.s ! True ! np.g ! np.n} ; + NegVP np vp = {s = np.s ++ vp.s ! False ! np.g ! np.n} ; + QPosVP np vp = {s = np.s ++ vp.s ! True ! np.g ! np.n} ; + QNegVP np vp = {s = np.s ++ vp.s ! False ! np.g ! np.n} ; + IPPosVP np vp = {s = np.s ++ vp.s ! True ! np.g ! np.n} ; + IPNegVP np vp = {s = np.s ++ vp.s ! False ! np.g ! np.n} ; + + IPPosV2 ip np v2 = {s = v2.c ++ ip.s ++ v2.s ! np.n ++ np.s} ; + IPNegV2 ip np v2 = {s = v2.c ++ ip.s ++ "non" ++ v2.s ! np.n ++ np.s} ; + + ComplV2 v2 np = {s = \\b,_,n => posneg b ++ v2.s ! n ++ v2.c ++ np.s} ; + ComplAP ap = {s = \\b,g,n => posneg b ++ copula n ++ ap.s ! g ! n} ; + + DetCN det cn = {s = det.s ! cn.g ++ cn.s ! det.n ; g = cn.g ; n = det.n} ; + + ModCN ap cn = {s = \\n => cn.s ! n ++ ap.s ! cn.g ! n ; g = cn.g} ; + + AdAP ada ap = {s = \\n,g => ada.s ++ ap.s ! n ! g} ; + + WhichCN cn = {s = "quale" ++ cn.s ! Sg ; g = cn.g ; n = Sg} ; + + UseN n = n ; + UseA a = a ; + UseV v = {s = \\b,_,n => posneg b ++ v.s ! n} ; + + + this_Det = mkDet Sg (regAdjective "questo") ; + that_Det = mkDet Sg (regAdjective "quello") ; + these_Det = mkDet Pl (regAdjective "questo") ; + those_Det = mkDet Pl (regAdjective "quello") ; + every_Det = {s = \\_ => "ogni" ; n = Sg} ; + theSg_Det = {s = artDef Sg ; n = Sg} ; + thePl_Det = {s = artDef Pl ; n = Pl} ; + indef_Det = {s = artIndef ; n = Sg} ; + plur_Det = {s = \\_ => [] ; n = Pl} ; + two_Det = {s = \\_ => "due" ; n = Pl} ; + + very_AdA = {s = "molto"} ; + + + oper + copula : Number -> Str = \n -> case n of { + Sg => "è" ; + Pl => "sono" + } ; + + posneg : Bool -> Str = \b -> case b of { + True => [] ; + False => "non" + } ; + + mkDet : Number -> Adjective -> Det = \n,adj -> { + s = \\g => adj.s ! g ! n ; + n = n ; + lock_Det = <> + } ; + + artDef : Number -> Gender => Str = \n -> case n of { + Sg => table { + Masc => pre {"il" ; "lo" / sImpuro} ; + Fem => "la" + } ; + Pl => table { + Masc => pre {"i" ; "gli" / sImpuro ; "gli" / vowel} ; + Fem => "le" + } + } ; + + artIndef : Gender => Str = table { + Masc => pre {"un" ; "uno" / sImpuro} ; + Fem => pre {"una" ; "un'" / vowel} + } ; + + sImpuro : Strs = strs {"sb" ; "sp" ; "sy" ; "z"} ; + vowel : Strs = strs {"a" ; "e" ; "i" ; "o" ; "u"} ; + +} |
