summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-06-10 19:55:45 +0000
committeraarne <aarne@cs.chalmers.se>2007-06-10 19:55:45 +0000
commit0f3d06022ee38e9301c4f1796b38c1f220d16e95 (patch)
tree1f251f5920cab71ebc0cd876c9e67b51ed7ecf92
parentfb730a75b5366a0ae6debc5393e5b78d347e0216 (diff)
started regulus grammar implementation
-rw-r--r--examples/regulus/Toy0.gf18
-rw-r--r--examples/regulus/Toy0Eng.gf28
-rw-r--r--examples/regulus/Toy0Fin.gf5
-rw-r--r--examples/regulus/Toy0Fre.gf30
-rw-r--r--examples/regulus/Toy0Ger.gf30
-rw-r--r--examples/regulus/Toy0I.gf20
-rw-r--r--examples/regulus/Toy0Swe.gf5
-rw-r--r--examples/regulus/Toy0_eng.gf39
8 files changed, 175 insertions, 0 deletions
diff --git a/examples/regulus/Toy0.gf b/examples/regulus/Toy0.gf
new file mode 100644
index 000000000..ed0ba51e8
--- /dev/null
+++ b/examples/regulus/Toy0.gf
@@ -0,0 +1,18 @@
+abstract Toy0 = {
+
+-- grammar from Chapter 2 of the Regulus book
+
+flags startcat=MAIN ;
+
+cat
+ MAIN ; NP ; Noun ; Spec ;
+
+fun
+ Main : NP -> MAIN ;
+ SpecNoun : Spec -> Noun -> NP ;
+
+ One, Two : Spec ;
+ Felis, Canis : Noun ;
+
+}
+
diff --git a/examples/regulus/Toy0Eng.gf b/examples/regulus/Toy0Eng.gf
new file mode 100644
index 000000000..68e2e4c07
--- /dev/null
+++ b/examples/regulus/Toy0Eng.gf
@@ -0,0 +1,28 @@
+concrete Toy0Eng of Toy0 = {
+
+param
+ Number = Sg | Pl ;
+
+lincat
+ Spec = {s : Str ; n : Number} ;
+ Noun = {s : Number => Str} ;
+ MAIN,NP = {s : Str} ;
+
+lin
+ Main np = np ;
+ SpecNoun spec noun = {s = spec.s ++ noun.s ! spec.n} ;
+
+ One = {s = "one" ; n = Sg} ;
+ Two = {s = "two" ; n = Pl} ;
+
+ Felis = regNoun "cat" ;
+ Canis = regNoun "dog" ;
+
+oper
+ regNoun : Str -> {s : Number => Str} = \s -> {
+ s = table {
+ Sg => s ;
+ Pl => s + "s"
+ }
+ } ;
+}
diff --git a/examples/regulus/Toy0Fin.gf b/examples/regulus/Toy0Fin.gf
new file mode 100644
index 000000000..f550e751e
--- /dev/null
+++ b/examples/regulus/Toy0Fin.gf
@@ -0,0 +1,5 @@
+--# -path=.:present:prelude
+
+concrete Toy0Fin of Toy0 = Toy0I with
+ (Syntax = SyntaxFin),
+ (Lexicon = LexiconFin) ;
diff --git a/examples/regulus/Toy0Fre.gf b/examples/regulus/Toy0Fre.gf
new file mode 100644
index 000000000..425c85af0
--- /dev/null
+++ b/examples/regulus/Toy0Fre.gf
@@ -0,0 +1,30 @@
+concrete Toy0Fre of Toy0 = {
+
+param
+ Number = Sg | Pl ;
+ Gender = Masc | Fem ;
+
+lincat
+ Spec = {s : Gender => Str ; n : Number} ;
+ Noun = {s : Number => Str ; g : Gender} ;
+ MAIN,NP = {s : Str} ;
+
+lin
+ Main np = np ;
+ SpecNoun spec noun = {s = spec.s ! noun.g ++ noun.s ! spec.n} ;
+
+ One = {s = table {Fem => "une" ; _ => "un"} ; n = Sg} ;
+ Two = {s = \\_ => "deux" ; n = Pl} ;
+
+ Felis = mkNoun "chat" Masc ;
+ Canis = mkNoun "chien" Masc ;
+
+oper
+ mkNoun : Str -> Gender -> {s : Number => Str ; g : Gender} = \s,g -> {
+ s = table {
+ Sg => s ;
+ Pl => s + "s"
+ } ;
+ g = g
+ } ;
+}
diff --git a/examples/regulus/Toy0Ger.gf b/examples/regulus/Toy0Ger.gf
new file mode 100644
index 000000000..68b3b7969
--- /dev/null
+++ b/examples/regulus/Toy0Ger.gf
@@ -0,0 +1,30 @@
+concrete Toy0Ger of Toy0 = {
+
+param
+ Number = Sg | Pl ;
+ Gender = Masc | Fem | Neutr ;
+
+lincat
+ Spec = {s : Gender => Str ; n : Number} ;
+ Noun = {s : Number => Str ; g : Gender} ;
+ MAIN,NP = {s : Str} ;
+
+lin
+ Main np = np ;
+ SpecNoun spec noun = {s = spec.s ! noun.g ++ noun.s ! spec.n} ;
+
+ One = {s = table {Fem => "eine" ; _ => "ein"} ; n = Sg} ;
+ Two = {s = \\_ => "zwei" ; n = Pl} ;
+
+ Felis = mkNoun "Katze" "Katzen" Fem ;
+ Canis = mkNoun "Hund" "Hünde" Masc ;
+
+oper
+ mkNoun : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} = \s,p,g -> {
+ s = table {
+ Sg => s ;
+ Pl => p
+ } ;
+ g = g
+ } ;
+}
diff --git a/examples/regulus/Toy0I.gf b/examples/regulus/Toy0I.gf
new file mode 100644
index 000000000..3d206d612
--- /dev/null
+++ b/examples/regulus/Toy0I.gf
@@ -0,0 +1,20 @@
+incomplete concrete Toy0I of Toy0 = open Syntax, Lexicon in {
+
+lincat
+ Spec = Det ;
+ Noun = N ;
+ NP = Syntax.NP ;
+ MAIN = Utt ;
+
+lin
+ Main np = mkUtt np ;
+ SpecNoun spec noun = mkNP spec noun ;
+
+ One = mkDet one_Quant ;
+ Two = mkDet (mkNum n2_Numeral) ;
+
+ Felis = cat_N ;
+ Canis = dog_N ;
+
+}
+
diff --git a/examples/regulus/Toy0Swe.gf b/examples/regulus/Toy0Swe.gf
new file mode 100644
index 000000000..5de273d00
--- /dev/null
+++ b/examples/regulus/Toy0Swe.gf
@@ -0,0 +1,5 @@
+--# -path=.:present:prelude
+
+concrete Toy0Swe of Toy0 = Toy0I with
+ (Syntax = SyntaxSwe),
+ (Lexicon = LexiconSwe) ;
diff --git a/examples/regulus/Toy0_eng.gf b/examples/regulus/Toy0_eng.gf
new file mode 100644
index 000000000..ed8fe8063
--- /dev/null
+++ b/examples/regulus/Toy0_eng.gf
@@ -0,0 +1,39 @@
+-- grammar from Chapter 2 of the Regulus book
+
+flags startcat=MAIN ;
+
+cat
+ MAIN ; NP ; Noun ; Spec ;
+
+fun
+ Main : NP -> MAIN ;
+ SpecNoun : Spec -> Noun -> NP ;
+
+ One, Two : Spec ;
+ Felis, Canis : Noun ;
+
+param
+ Number = Sg | Pl ;
+
+lincat
+ Spec = {s : Str ; n : Number} ;
+ Noun = {s : Number => Str} ;
+ MAIN,NP = {s : Str} ;
+
+lin
+ Main np = np ;
+ SpecNoun spec noun = {s = spec.s ++ noun.s ! spec.n} ;
+
+ One = {s = "one" ; n = Sg} ;
+ Two = {s = "two" ; n = Pl} ;
+
+ Felis = regNoun "cat" ;
+ Canis = regNoun "dog" ;
+
+oper
+ regNoun : Str -> {s : Number => Str} = \s -> {
+ s = table {
+ Sg => s ;
+ Pl => s + "s"
+ }
+ } ;