summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/tutorial/syntax/Grammar.gf5
-rw-r--r--examples/tutorial/syntax/GrammarEng.gf7
-rw-r--r--examples/tutorial/syntax/GrammarIta.gf14
3 files changed, 25 insertions, 1 deletions
diff --git a/examples/tutorial/syntax/Grammar.gf b/examples/tutorial/syntax/Grammar.gf
index 7dd06f6df..5484321ee 100644
--- a/examples/tutorial/syntax/Grammar.gf
+++ b/examples/tutorial/syntax/Grammar.gf
@@ -19,6 +19,7 @@ abstract Grammar = {
V ; -- intransitive verb e.g. "boil"
V2 ; -- two-place verb e.g. "eat"
Pol ; -- polarity (pos or neg)
+ Conj ; -- conjunction e.g. "and"
fun
PhrS : S -> Phr ;
@@ -41,6 +42,9 @@ abstract Grammar = {
IDetCN : IDet -> CN -> IP ;
+ ConjS : Conj -> S -> S -> S ;
+ ConjNP : Conj -> NP -> NP -> NP ;
+
-- lexical insertion
UseN : N -> CN ;
@@ -64,6 +68,7 @@ abstract Grammar = {
very_AdA : AdA ;
+ and_Conj : Conj ;
-- polarities
PPos, PNeg : Pol ;
diff --git a/examples/tutorial/syntax/GrammarEng.gf b/examples/tutorial/syntax/GrammarEng.gf
index 1a9b1ac6e..d35b33fff 100644
--- a/examples/tutorial/syntax/GrammarEng.gf
+++ b/examples/tutorial/syntax/GrammarEng.gf
@@ -18,6 +18,7 @@ concrete GrammarEng of Grammar = open Prelude, MorphoEng in {
A = {s : Str} ;
V = Verb ;
V2 = Verb2 ;
+ Conj = {s : Str} ;
Pol = {s : Str ; p : Bool} ;
lin
@@ -52,6 +53,9 @@ concrete GrammarEng of Grammar = open Prelude, MorphoEng in {
IDetCN det cn = {s = det.s ++ cn.s ! det.n ; n = det.n} ;
+ ConjS c a b = {s = a.s ++ c.s ++ b.s} ;
+ ConjNP c a b = {s = a.s ++ c.s ++ b.s ; n = Pl} ;
+
UseN n = n ;
UseA a = a ;
UseV v = {s = \\q,b,n => predVerb v q b n} ;
@@ -71,6 +75,8 @@ concrete GrammarEng of Grammar = open Prelude, MorphoEng in {
which_IDet = {s = "which" ; n = Sg} ;
+ and_Conj = {s = "and"} ;
+
PPos = {s = [] ; p = True} ;
PNeg = {s = [] ; p = False} ;
@@ -113,4 +119,5 @@ concrete GrammarEng of Grammar = open Prelude, MorphoEng in {
artIndef : Str =
pre {"a" ; "an" / strs {"a" ; "e" ; "i" ; "o"}} ;
+
}
diff --git a/examples/tutorial/syntax/GrammarIta.gf b/examples/tutorial/syntax/GrammarIta.gf
index 98a935379..e24372e39 100644
--- a/examples/tutorial/syntax/GrammarIta.gf
+++ b/examples/tutorial/syntax/GrammarIta.gf
@@ -18,6 +18,7 @@ concrete GrammarIta of Grammar = open Prelude, MorphoIta in {
A = Adjective ;
V = Verb ;
V2 = Verb2 ;
+ Conj = {s : Str} ;
Pol = {s : Str ; p : Bool} ;
@@ -36,12 +37,16 @@ concrete GrammarIta of Grammar = open Prelude, MorphoIta in {
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} ;
- IDetCN 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} ;
+ IDetCN det cn = {s = det.s ! cn.g ++ cn.s ! det.n ; g = cn.g ; n = det.n} ;
+
+ ConjS c a b = {s = a.s ++ c.s ++ b.s} ;
+ ConjNP c a b = {s = a.s ++ c.s ++ b.s ; n = Pl ; g = conjGender a.g b.g} ;
+
UseN n = n ;
UseA a = a ;
UseV v = {s = \\b,_,n => posneg b ++ v.s ! n} ;
@@ -58,6 +63,7 @@ concrete GrammarIta of Grammar = open Prelude, MorphoIta in {
two_Det = {s = \\_ => "due" ; n = Pl} ;
very_AdA = {s = "molto"} ;
which_IDet = {s = \\_ => "quale" ; n = Sg} ;
+ and_Conj = {s = "e"} ;
PPos = {s = [] ; p = True} ;
PNeg = {s = [] ; p = False} ;
@@ -95,7 +101,13 @@ concrete GrammarIta of Grammar = open Prelude, MorphoIta in {
Fem => pre {"una" ; "un'" / vowel}
} ;
+ conjGender : Gender -> Gender -> Gender = \g,h -> case g of {
+ Masc => Masc ;
+ _ => h
+ } ;
+
sImpuro : Strs = strs {"sb" ; "sp" ; "sy" ; "z"} ;
vowel : Strs = strs {"a" ; "e" ; "i" ; "o" ; "u"} ;
+
}