summaryrefslogtreecommitdiff
path: root/book/examples/chapter8/LogicEng.gf
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2010-11-22 12:55:37 +0000
committeraarne <aarne@chalmers.se>2010-11-22 12:55:37 +0000
commit76ba03b545600054176612201de78dca16eb65e1 (patch)
tree5615286b239bee637b32465e9cbf36807ab2c318 /book/examples/chapter8/LogicEng.gf
parent0bf41793694e8b3101d09e34858eba8ab2c8c5b6 (diff)
started a subdir for the book
Diffstat (limited to 'book/examples/chapter8/LogicEng.gf')
-rw-r--r--book/examples/chapter8/LogicEng.gf39
1 files changed, 39 insertions, 0 deletions
diff --git a/book/examples/chapter8/LogicEng.gf b/book/examples/chapter8/LogicEng.gf
new file mode 100644
index 000000000..eae85d255
--- /dev/null
+++ b/book/examples/chapter8/LogicEng.gf
@@ -0,0 +1,39 @@
+concrete LogicEng of Logic = open
+ SyntaxEng, (P = ParadigmsEng), SymbolicEng, Prelude in {
+lincat
+ Stm = Text ;
+ Prop = {pos,neg : S ; isAtom : Bool} ;
+ Atom = Cl ;
+ Ind = NP ;
+ Dom = CN ;
+ Var = NP ;
+ [Prop] = ListS ;
+ [Var] = NP ;
+lin
+ SProp p = mkText p.pos ;
+ And ps = complexProp (mkS and_Conj ps) ;
+ Or ps = complexProp (mkS or_Conj ps) ;
+ If A B = complexProp (mkS if_then_Conj (mkListS A.pos B.pos)) ;
+ Not A = complexProp A.neg ;
+ All xs A B = complexProp (mkS (mkAdv for_Prep
+ (mkNP all_Predet (mkNP a_Quant plNum (mkCN A xs)))) B.pos) ;
+ Exist xs A B = complexProp (mkS (mkAdv for_Prep
+ (mkNP somePl_Det (mkCN A xs))) B.pos) ;
+ PAtom p =
+ {pos = mkS p ; neg = mkS negativePol p ; isAtom = True} ;
+ IVar x = x ;
+ VString s = symb s ;
+ BaseProp A B = mkListS A.pos B.pos ;
+ ConsProp A As = mkListS A.pos As ;
+ BaseVar x = x ;
+ ConsVar x xs = mkNP and_Conj (mkListNP x xs) ;
+oper
+ complexProp : S -> {pos,neg : S ; isAtom : Bool} = \s -> {
+ pos = s ;
+ neg = negS s ;
+ isAtom = False
+ } ;
+ negS : S -> S = \s -> mkS negativePol (mkCl (mkNP it_Pron)
+ (mkNP the_Quant (mkCN (mkCN (P.mkN "case")) s))) ;
+ if_Then_Conj : Conj = P.mkConj "if" "then" ;
+}