summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-10-14 11:19:30 +0000
committeraarne <aarne@cs.chalmers.se>2008-10-14 11:19:30 +0000
commita11f1b14370883b903da5b93de88984a3cfb9344 (patch)
treea067b0505df5e755f07dc16a5405b5d48838d6c1 /examples
parent3fe0cccaf7bcf3dc85edd597f15ff468cae957ef (diff)
paraphrase works a little better now ; added examples/paraphrase for testing
Diffstat (limited to 'examples')
-rw-r--r--examples/paraphrase/City.gf26
-rw-r--r--examples/paraphrase/CityEng.gf16
-rw-r--r--examples/paraphrase/Nat.gf29
3 files changed, 71 insertions, 0 deletions
diff --git a/examples/paraphrase/City.gf b/examples/paraphrase/City.gf
new file mode 100644
index 000000000..2ea8a10ff
--- /dev/null
+++ b/examples/paraphrase/City.gf
@@ -0,0 +1,26 @@
+abstract City = {
+
+cat S ; City ; Country ; Adj ;
+
+data
+ PredIn : City -> Country -> S ;
+fun
+ PredAdj : City -> Adj -> S ;
+ Capital : Country -> City ;
+ CountryAdj : Adj -> Country ;
+data
+ Stockholm, Helsinki : City ;
+ Sweden, Finland : Country ;
+ Swedish, Finnish : Adj ;
+
+def
+ PredAdj city x = PredIn city (CountryAdj x) ;
+
+ Capital Finland = Helsinki ;
+ Capital Sweden = Stockholm ;
+
+ CountryAdj Finnish = Finland ;
+ CountryAdj Swedish = Sweden ;
+
+
+}
diff --git a/examples/paraphrase/CityEng.gf b/examples/paraphrase/CityEng.gf
new file mode 100644
index 000000000..39a0974c8
--- /dev/null
+++ b/examples/paraphrase/CityEng.gf
@@ -0,0 +1,16 @@
+concrete CityEng of City = {
+
+lincat S, City, Country, Adj = Str ;
+
+lin
+ PredIn ci co = ci ++ "is in" ++ co ;
+ PredAdj ci ad = ci ++ "is" ++ ad ;
+ Capital co = "the capital of" ++ co ;
+ CountryAdj ad = "the" ++ ad ++ "country" ;
+ Stockholm = "Stockholm" ;
+ Helsinki = "Helsinki" ;
+ Sweden = "Sweden" ;
+ Finland = "Finland" ;
+ Swedish = "Swedish" ;
+ Finnish = "Finnish" ;
+}
diff --git a/examples/paraphrase/Nat.gf b/examples/paraphrase/Nat.gf
new file mode 100644
index 000000000..7caa0fc93
--- /dev/null
+++ b/examples/paraphrase/Nat.gf
@@ -0,0 +1,29 @@
+abstract Nat = {
+
+cat Nat ;
+
+data
+ Zero : Nat ;
+ Succ : Nat -> Nat ;
+
+fun one : Nat ;
+def one = Succ Zero ;
+
+fun plus : Nat -> Nat -> Nat ;
+def plus x Zero = x ;
+def plus x (Succ y) = Succ (plus x y) ;
+
+fun twice : Nat -> Nat ;
+def twice x = plus x x ;
+
+fun times : Nat -> Nat -> Nat ;
+def times x Zero = Zero ;
+def times x (Succ y) = plus (times x y) x ;
+
+fun four : Nat ;
+def four = twice (twice one) ;
+
+fun exp : Nat -> Nat ;
+def exp Zero = one ;
+def exp (Succ x) = twice (exp x) ;
+}