Add support for pre

This commit is contained in:
John J. Camilleri
2021-02-15 21:57:05 +01:00
parent 4f0abe5540
commit 4d1217b06d
7 changed files with 59 additions and 2 deletions
+7
View File
@@ -0,0 +1,7 @@
abstract Pre = {
cat S; N; Det;
fun
ant, dog: N ;
a, the: Det ;
mkS : Det -> N -> S;
}
+12
View File
@@ -0,0 +1,12 @@
Pre: mkS a ant
PreCnc: an ant
Pre: mkS the ant
PreCnc: the ant
Pre: mkS a dog
PreCnc: a dog
Pre: mkS the dog
PreCnc: the dog
+4
View File
@@ -0,0 +1,4 @@
mkS a ant
mkS the ant
mkS a dog
mkS the dog
+15
View File
@@ -0,0 +1,15 @@
concrete PreCnc of Pre = {
lincat
S = { s : Str } ;
N = { s : Str } ;
Det = { s : Str } ;
lin
ant = { s = "ant" } ;
dog = { s = "dog" } ;
a = { s = pre {
"a"|"e"|"i"|"o"|"u" => "an" ;
_ => "a"
} } ;
the = { s = "the" } ;
mkS det n = { s = det.s ++ n.s } ;
}
+1
View File
@@ -18,6 +18,7 @@ main = do
doGrammar "Bind"
doGrammar "Tables"
doGrammar "Params"
doGrammar "Pre"
doGrammar "Walking"
doGrammar "Foods"
-- doGrammar' "Foods" ["Fre"]