diff --git a/transfer/examples/reflexive/Abstract.gf b/transfer/examples/reflexive/Abstract.gf new file mode 100644 index 000000000..0426defdc --- /dev/null +++ b/transfer/examples/reflexive/Abstract.gf @@ -0,0 +1,15 @@ +abstract Abstract = { + +cat + S ; NP ; V2 ; Conj ; + +fun + PredV2 : V2 -> NP -> NP -> S ; + ReflV2 : V2 -> NP -> S ; + ConjNP : Conj -> NP -> NP -> NP ; + + And, Or : Conj ; + John, Mary, Bill : NP ; + See, Whip : V2 ; + +} diff --git a/transfer/examples/reflexive/English.gf b/transfer/examples/reflexive/English.gf new file mode 100644 index 000000000..73fa00e91 --- /dev/null +++ b/transfer/examples/reflexive/English.gf @@ -0,0 +1,54 @@ +concrete English of Abstract = { + +lincat + S = { s : Str } ; + V2 = {s : Num => Str} ; + Conj = {s : Str ; n : Num} ; + NP = {s : Str ; n : Num; g : Gender} ; + +lin + PredV2 v s o = ss (s.s ++ v.s ! s.n ++ o.s) ; + ReflV2 v s = ss (s.s ++ v.s ! s.n ++ self ! s.n ! s.g) ; + -- FIXME: what is the gender of "Mary or Bill"? + ConjNP c A B = {s = A.s ++ c.s ++ B.s ; n = c.n; g = A.g } ; + + John = pn Masc "John" ; + Mary = pn Fem "Mary" ; + Bill = pn Masc "Bill" ; + See = regV2 "see" ; + Whip = regV2 "whip" ; + + And = {s = "and" ; n = Pl } ; + Or = { s = "or"; n = Sg } ; + +param + Num = Sg | Pl ; + Gender = Neutr | Masc | Fem ; + +oper + regV2 : Str -> {s : Num => Str} = \run -> { + s = table { + Sg => run + "s" ; + Pl => run + } + } ; + + self : Num => Gender => Str = + table { + Sg => table { + Neutr => "itself"; + Masc => "himself"; + Fem => "herself" + }; + Pl => \\g => "themselves" + }; + + pn : Gender -> Str -> {s : Str ; n : Num; g : Gender} = \gen -> \bob -> { + s = bob ; + n = Sg ; + g = gen + } ; + + ss : Str -> {s : Str} = \s -> {s = s} ; + +} diff --git a/transfer/examples/reflexive/reflexive.tra b/transfer/examples/reflexive/reflexive.tra new file mode 100644 index 000000000..9f8533f7a --- /dev/null +++ b/transfer/examples/reflexive/reflexive.tra @@ -0,0 +1,31 @@ +{- + +$ ../../transferc -i../../lib reflexive.tra + +$ gf English.gf reflexive.trc + +> p -tr "John sees John" | at -tr reflexivize_S | l +PredV2 See John John +ReflV2 See John +John sees himself + +> p -tr "John and Bill see John and Bill" | at -tr reflexivize_S | l +PredV2 See (ConjNP And John Bill) (ConjNP And John Bill) +ReflV2 See (ConjNP And John Bill) +John and Bill see themselves + +> p -tr "John sees Mary" | at -tr reflexivize_S | l +PredV2 See John Mary +PredV2 See John Mary +John sees Mary + +-} + +import tree + +reflexivize : (C : Cat) -> Tree C -> Tree C +reflexivize _ (PredV2 v s o) | eq ? (eq_Tree ?) s o = ReflV2 v s +reflexivize _ t = composOp ? ? compos_Tree ? reflexivize t + +reflexivize_S : Tree S -> Tree S +reflexivize_S = reflexivize S diff --git a/transfer/examples/reflexive/tree.tra b/transfer/examples/reflexive/tree.tra new file mode 100644 index 000000000..7bef5e019 --- /dev/null +++ b/transfer/examples/reflexive/tree.tra @@ -0,0 +1,21 @@ +import prelude ; +data Cat : Type where { + Conj : Cat ; + NP : Cat ; + S : Cat ; + V2 : Cat +} ; +data Tree : Cat -> Type where { + And : Tree Conj ; + Bill : Tree NP ; + ConjNP : Tree Conj -> Tree NP -> Tree NP -> Tree NP ; + John : Tree NP ; + Mary : Tree NP ; + Or : Tree Conj ; + PredV2 : Tree V2 -> Tree NP -> Tree NP -> Tree S ; + ReflV2 : Tree V2 -> Tree NP -> Tree S ; + See : Tree V2 ; + Whip : Tree V2 +} ; +derive Eq Tree ; +derive Compos Tree ;